Top "Django-models" questions

For questions concerning use of the model class from the web framework Django.

Django post_save() signal implementation

I have a question about django. I have ManyToMany Models here class Product(models.Model): name = models.CharField(max_length=255) …

python django django-models django-signals
"Post Image data using POSTMAN"

I am trying to POST data to my API. I have a model with an image field where: image = models.…

django django-models django-rest-framework postman
How to insert data to django database from views.py file?

How can I insert data to my django database from a function in the views,py file? Is python manage.…

python django django-models django-views pymysql
How to create an object for a Django model with a many to many field?

My model: class Sample(models.Model): users = models.ManyToManyField(User) I want to save both user1 and user2 in that …

python django django-models django-orm
How to view corresponding SQL query of the Django ORM's queryset?

Is there a way I can print the query the Django ORM is generating? Say I execute the following statement: …

django django-models django-orm
Django filter versus get for single object?

I was having a debate on this with some colleagues. Is there a preferred way to retrieve an object in …

django django-models django-queryset
Django Model - Case-insensitive Query / Filtering

How can I query/filter in Django and ignore the cases of my query-string? I've got something like and like …

database django django-models filtering
django models selecting single field

I have a table/models called Employees and I would like to get all rows of a single field as …

python django django-models
sql "LIKE" equivalent in django query

What is the equivalent of this SQL statement in django? SELECT * FROM table_name WHERE string LIKE pattern; How do …

python sql django django-models django-queryset
Raw SQL queries in Django views

How would I perform the following using raw SQL in views.py? from app.models import Picture def results(request): …

django django-models django-views django-queryset