django-queryset
Distinct values in ManyToManyField over a subset of objects in Django
In my models I have the classes Book and Category defined like this: class Category(models.Model): name = models.CharField()[详细]
2023-03-27 02:59 分类:问答Following ForgeinKeys in Django's select_related to populate a *_set variable?
I have some simple 开发者_运维知识库Django Models like this: class Event(models.Model): # some stuff[详细]
2023-03-27 02:18 分类:问答Is there a way to augment django QuerySets with extra attributes?
I\'m trying to add some extra attributes to the elements of a QuerySet so I can use the extra information in templates, instead of hitting the database multiple times. Let me illustrate by example, as[详细]
2023-03-26 23:37 分类:问答How to get database records only with filled field?
I have model w开发者_运维知识库ith an optional ForeignKey field. I need filter all records with filled this field. How do I do this?Model.objects.exclude(foreignkey__isnull=True)[详细]
2023-03-26 04:06 分类:问答Querying data from Django
Here\'s what my model structure looks like: 开发者_开发问答 class Visitor(models.Model): id = models.AutoField(primary_key=True)[详细]
2023-03-25 21:40 分类:问答Django query optimization: retrieve values in groups possible?
I have: active = Node.objects.filter(status = \'a\') potential = Node.objects.filter(status = \'p\') hotspot = Node.objects.filter(status = \'h\')[详细]
2023-03-25 14:54 分类:问答Django Boolean Queryset Filter Not Working
This has been frustrating me for the better part of an hour. I have the following model: sold= models.BooleanField(default=False)[详细]
2023-03-24 21:01 分类:问答Changes in DB data not reflecting in the Django queryset in a continuously looping script
I am using Django\'s ORM to get newly added entries from a Db and pass them to a Messaging queue. I am doing this in an infinite while loop , The PROBLEM in every loop iterationI am getting the same q[详细]
2023-03-24 17:01 分类:问答Django queryset question
class Ticket(models.Model): event = models.ForeignKey(Event) name = models.CharField(\'Name\', max_length=255)[详细]
2023-03-23 19:28 分类:问答Complex 'AND' Django Queries
I\'m trying to do the equ开发者_开发百科ivalent of this SQL query: \"SELECT * FROM something WHERE ((something >= something AND something <= something) AND(something >= something AND somethi[详细]
2023-03-23 14:19 分类:问答