Top "Django-orm" questions

Django's ORM system, comprising its queryset and model systems.

Django Admin ManyToManyField

I've made a model (models.py): class opetest(models.Model): name = models.CharField(max_length=200) author = models.ForeignKey(User, related_…

django django-models django-admin manytomanyfield django-orm
Django equivalent of SQL not in

I have a very simple query: select * from tbl1 where title not in('asdasd', 'asdasd'). How do I translate that …

django django-orm
Django Blob Model Field

How do you store a "blob" of binary data using Django's ORM, with a PostgreSQL backend? Yes, I know Django …

python django django-models django-orm django-blob
Default image for ImageField in Django's ORM

I'm using an ImageField to store profile pictures on my model. How do I set it to return a default …

django django-orm
Django, query filtering from model method

I have these models: def Foo(Models.model): size = models.IntegerField() # other fields def is_active(self): if check_condition: …

python django django-models django-queryset django-orm
In a Django QuerySet, how to filter for "not exists" in a many-to-one relationship

I have two models like this: class User(models.Model): email = models.EmailField() class Report(models.Model): user = models.ForeignKey(…

django django-models django-orm
Django model method - create_or_update

Similar to get_or_create, I would like to be able to update_or_create in Django. Until now, I …

python django django-models django-orm
Django Aggregation: Summation of Multiplication of two fields

I have a model something like this: class Task(models.Model): progress = models.PositiveIntegerField() estimated_days = models.PositiveIntegerField() Now I …

python django django-models django-queryset django-orm
Django: Order_by multiple fields

I am getting order_by fields in the form of a list. I want to order_by by multiple fields …

django django-orm
Saving Many To Many data via a modelform in Django

I have a problem saving many to many fields from a form. Here are my models: class TextIssue(models.Model): …

django django-forms django-orm