Django-queryset Questions
Ad
Get "Foo" queryset of ForeignKey relationships for initial "Bar" queryset?
I have a simple foreignkey relationship: class foo(models.model): id =
Django query set filter reverse startswith on charfield
Image some kind of product-rule which has 2 conditions: name are equal sku's have partial match, starts with.
How to filter QuerySet depending on fields of a reverse foreign key related model?
I have two following models: class tour(models.model): name = models.charfield(max_length=100) description =
Django: QuerySet with ExpressionWrapper
I currently try to get max_total_grossfrom all tickets within an event. that's how far i came but it doesn't work yet.
Context processor for filter empty categories
In my blog the posts are divided based on the categories. i've excluded the category named uncategorized from the list of categories and now i
How to extend manager method in django?
I would like to extend _filter_or_exclude method on my manager, but for some reason, the method is never called. what i want to achieve is
Non-relational field given in select_related: ' '. Choices are: (none)
I have two models from different apps: class measure(models.model): date = models.datetimefield(default="2018-01-23 15:55")
filter object which begin by string in a list
Here is my code : communelist = [ "78", "95", "77", "91", "92", "93", "94", "75", ]
Get all Objects one by one but in a random way
Here is the code from an other post : from random import randint count = article.objects.all().count() random_index = randint(0,
Django-filter - I want to filter in different attributes with just one filter input
Having the following model: class project(models.model): ... name = models.charfield(max_lenght=70) short_description
Ad
What is the difference between two querysets and django?
I have two querysets and i want to get the difference between them and pass them in one query to use it in my view and display to my template
django override delete cascade for one time
Is there an option for to make sure that a model instance does not have any related objects? i.e, if the person object has any related objects, i
Group the django object according to the foreign key
I want to group the model object according to the foreign key with a query or without any iteration. example: let, i have a model
Remove duplicates in the query set
I have a query set like the one below which depicts the albums and songs associated with those albums. the model name is
Django REST TestCase: How to retrieve a response queryset that wasn't assigned to an attribute?
For a view that extends a generic listapiview and returns a queryset by simply assigning a collection to the view
Django query - combine two different cases in filter
I'm using django 1.10 i have a query that depends on the received parameter - it depends on whether 'job_name' is none or not:
does splitting querset requires cleaned data?
I have a queryset named fp_items and look like 201;202;205 etc... here how it looks like: <queryset [{'fp_items':
For filtering data in Django, build dynamic query for multiple columns
I have to filter data from model based on the run time values. i am getting 5 values via query string. my querystring is like below:
Django - Multi filtering queryset return empty queryset
I have a problem with queryset in django 2.0, after some research, i don't find any problem looks like mine. i think it's because of my
How to QuerySet for Post per month
I have a model as such class post(models.model): submission_time = models.datetimefield() user = models.foreignkey(user)
Django exclude queryset __in for *every* item in list
This is a bit different from django filter
Ad
Django - Zip multiple querysets with uncommon fields data
I have this one model where i have fetch published count , under process count, rejected count,
Django: M2M field query using 'in' each value in a list
I'm trying to find problem objects having all the tags contained in tags related to it. i have the following
How to filter in django using adding days to existing dates
Class payment(models.model): name = models.charfield() payment_date = models.datefield() example table
How to get all objects with certain interval of time in django
I want to get all objects which has time to live next 5 seconds with django python orm. i'm trying in a following way and i don't know why that is
Django - Optimal way to sort models by boolean operation
Let's imagine i have this model and i would like to sort them by logical operation n1 != n2: class thing(model):
How to use reverse relation in my query?(django)
I'm trying to make a query to show all the branches which have the food. i've tried a lot but i can't make it work. could someone help me?
Search part in navbar doesn't work properly (django)
I wanted to create a search box in my navbar and show the food which i search, but it seems it doesn't work properly. i can't find out where's the
Related name returning post.commentpost.none
Can anyone explain me, why i get post.commentpost.none? how to correct connect commentpost with posty in query? i need get
Django restframework import data from another table?
I'm using django rest framework with mysql. let me explain my two tables. [article] - articleno(primary key) -
Django. How I can optimize db query?
I have two models: class status(models.model): choises = ( ('new', 'new'), ('in_progress',
Is it safe to delete a Django QuerySet that may be empty?
Is it safe to attempt to delete a queryset that might be empty? in other words, if i am not sure if the name "mj" exists, is there any
Ad
django admin list_display from two tables, no relations like foreign key or manytomany relation available
I have two tables, one is measuredcontroller and measuredgrid, and there is no relation like foreign key or manytoman etc , and in admin i have to
Display Todo under its category [Django]
I'm not sure how to ask this question but i'll give it a shot. i am writing a todo application and want to display each todo under its
How to get max score of answers to a question by each user
I have these 2 models: class question(models.model): title = models.charfield(max_length=200) # other fields class
Limiting queryset for foreign key for inline formset in Django
I have build a program (using django 1.9) to track tournaments. each tournament consists of a series of bouts, and each bout has two people
Filter queryset to return only the best result for each user
I have a couple of django models, one of which holds a number of user results for different events. i'm looking for a way to generate a queryset
Ad
Blog Categories
Ad