Top "Django-models" questions

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

What's the difference between django OneToOneField and ForeignKey?

What's the difference between Django OneToOneField and ForeignKey?

django django-models
How to define two fields "unique" as couple

Is there a way to define a couple of fields as unique in Django? I have a table of volumes (…

django django-models
How do I create a slug in Django?

I am trying to create a SlugField in Django. I created this simple model: from django.db import models class …

python django django-models slug
Bulk create model objects in django

I have a lot of objects to save in database, and so I want to create Model instances with that. …

django django-models
Getting a count of objects in a queryset in django

How can I add a field for the count of objects in a database. I have the following models: class …

django django-models django-queryset
How to do SELECT MAX in Django?

I have a list of objects how can I run a query to give the max value of a field: …

django django-models max
Good ways to sort a queryset? - Django

what I'm trying to do is this: get the 30 Authors with highest score ( Author.objects.order_by('-score')[:30] ) order the …

python django django-models
Django ManyToMany filter()

I have a model: class Zone(models.Model): name = models.CharField(max_length=128) users = models.ManyToManyField(User, related_name='zones', …

django django-models
Get model's fields in Django

Given a Django model, I'm trying to list all of its fields. I've seen some examples of doing this using …

django django-models introspection metamodel
Automatic creation date for Django model form objects?

What's the best way to set a creation date for an object automatically, and also a field that will record …

python django django-models