django-queryset
Custom Query for Django ModelChoiceField using user.get_profile()
I am wondering how to access a user\'s profile when creating the queryset for a ModelChoiceField. I would like to be able to use the[详细]
2023-03-12 10:49 分类:问答Django Combine a Variable Number of QuerySets
Is there a way to concatenate a unknown number of querysets into a list? Here are my models: class Item(models.Model):[详细]
2023-03-11 10:56 分类:问答How to reduce queries in django model has_relation method?
Here are two example Django models. Pay special attention to the has_pet method. class Person(models.Model):[详细]
2023-03-10 01:03 分类:问答Django: get the first object from a filter query or create
In Django, queryset provides a method called get_or_create that either returns an objects or creates an object.[详细]
2023-03-09 07:00 分类:问答Retrieving newest object for persons
So, I have a Person model and then I have a model name Carusage. The relevant part of Carusage is this:[详细]
2023-03-08 12:06 分类:问答Filter related set in a related set
I have the following structure of models : parent Park child Warehouse(foreign key with Park, related_name = park_warehouses)[详细]
2023-03-07 14:01 分类:问答django compound querysets
I have this filtering mechanism that works, however, it is not very elegant.There has to be a better way to write this.Any recommendations would be greatly appreciated.[详细]
2023-03-07 02:40 分类:问答Django Select query with specific column
I have a model called MessagePerson which has the fields of details which depict the messages for a particular person, who\'s details are in Personal models.[详细]
2023-03-05 19:31 分类:问答QuerySet caching: executing get after filter was fired
How many database queries will be executed for the following code: q = SomeModel.objec开发者_如何转开发ts.filter(pk__in=ids)[详细]
2023-03-05 16:38 分类:问答Django 'objects.filter()' with list?
It is possible to limiting QuerySet in this kind of way: creators_list = [\'jane\',开发者_Go百科 \'tarzan\', \'chita\'][详细]
2023-03-05 10:24 分类:问答