Category "django-queryset"

Can OR-clauses be combined with distance filters in Haystack for Django?

I've been using a distance filter using regular django query filters within an OR-clause: # either it's within the preset distance of the location # OR it's not

Extract only values without key from QuerySet and save them to list

I have problem with getting only values from QuerySet. I have my table: class Temperature(models.Model): id = models.IntegerField(primary_key=True) # AutoF

How to write sql COALESCE in Django

I'm new to Django. How to write COALESCE sql queryset in to django orm. query = 'SELECT COALESCE(max(CAST(order_no as UNSIGNED)), 0) as o,id from nanossc_Sales

Django deleting querysets with paging, not catching all parts of the set

I have a bit of a strange problem that I'm not quite able to explain. I have a django project with some old, stale objects lying around. For example, lets say

Django ORM: get the monthly average of price for each category

Imagine this simple model: class Expense(models.Model): price = models.DecimalField(decimal_places=2, max_digits=6) description = models.CharField(max_len

A Django query to find top 3 posts with maximum comments

how can i find the top 3 blogpost with the maximum comments here are my models: class BlogPost(models.Model): title = models.CharField(max_length=250)

Foreignkey relationship returning an AttributeError when queried in Django

Hy please am new to Django,I have a childmodel(relationship) referencing a parent model(Profile) through a foreign key. I want to get the relationship status of

Django ORM returns non-iterable object

The model is class WeeklyStrMst(BaseModel): StoreId = models.AutoField(primary_key=True) TDLinx_No = models.IntegerField(blank=True, null=True, default=

Django queryset TruncMonth output format issue

I'm using Django ORM queryset for chart, and having difficulty with changing the format of output 'source': ActivityLog.objects.filter(requestType='add',doDat