django-queryset
Django queries: __iexact doesn't work with non-ASCII?
>>> p = Pet(kind=\"Кошка\") >>> p.kind \'\\xd0\\x9a\\xd0\\xbe\\xd1\\x88\\xd0\\xba\\xd0\\xb0\'[详细]
2023-03-16 20:40 分类:问答Django-MPTT - ordering root nodes by count of immediate descendants
I\'m using Django-MPTT to do a display a simple 2 level hierarchy (root => child(ren)). I\'m looking for a way to structure my queryset so that nodes get returned with the root node having the most ch[详细]
2023-03-16 12:28 分类:问答Django SUM Query?
I have a query akin to the following: SELECT SUM(name) FROM table WH开发者_JAVA技巧ERE name IS NULL[详细]
2023-03-15 22:08 分类:问答Trying to create a tuple of objects create an object and a queryset
I need to iterate through a tuple in the template, but from the code i\'ve built i am getting a tuple of an object (album) and a queryset (photo). The problem is how do i iterate over them now in the[详细]
2023-03-15 06:48 分类:问答How to chain quesrysets in the right order not sorted by date, sorted by foreignKey?
I am building a photo gallery, and the ones that are published don\'t give me what i need so i am building it form scratch.[详细]
2023-03-15 06:42 分类:问答django admin use changelist_view queryset for geraldo report
I have the following variable in my admin: class ModelAdmin(admin.ModelAdmin): qs = QuerySet ... and the following def within the admin:[详细]
2023-03-14 09:42 分类:问答Find the most recent rating for a user in a django queryset
I\'m looking for a method to get the most recent rating for a specific Person for all Resources. Currently I\'m using a query like Rating.objects.filter(Person = person).order_by(\'-timestamp\')[详细]
2023-03-14 05:47 分类:问答manytomanyfield distinct value
i have a model called mti(Material Information) which have a list of MTD(Material Description) and in eachmaterial description description there is a size and color[详细]
2023-03-13 16:00 分类:问答Is there a way to construct lazy sequences in Python?
There is a Django view that loads Member objects from the database with a certain filter. Now I need to change this logic to present a specific Member first, and let the rest follow in their natural[详细]
2023-03-13 12:15 分类:问答'private' models, default query sets and chaining methods
I have a private boolean flag on my model, and a custom manager that overwrites the get_query_set method, with a filter, removing private=True:[详细]
2023-03-13 11:45 分类:问答