Menu
  • HOME
  • TAGS

Django One(Many)-To-Many Relation in reusable app

django,django-related-manager

Regarding your comment here is what you could do something like this: class Exam(models.Model): participants = models.ManyToMany(settings.AUTH_USER_MODEL, through='Participation') class Participation(models.Model) user = models.OneToOneField(settings.AUTH_USER_MODEL) exam = models.ForeignKey('Exam') active = models.BooleanField(default=False) Another option would be to use django's limit_coices_to. It's not transaction save, but might do the job. You would just limit...

Django updates that span relationships

django,django-queryset,django-related-manager

From Django docs. Entry.objects.update(blog__name='foo') # Won't work! The update() method is applied instantly, and the only restriction on the QuerySet that is updated is that it can only update columns in the model’s main table, not on related models So, the answer is not, you can't do it in that...

Django queryset on related field

django,postgresql,relational-database,django-related-manager

A better way of writing this query without the subqueries would be: Card.objects.all().exclude(sentiments__user__id=user.id) ...