User Tools

Site Tools


Sidebar

Writing /opt/bitnami/dokuwiki/data/meta/python/django_include_exclude_m2m_none.meta failed
Writing /opt/bitnami/dokuwiki/data/meta/git/delete-tag.meta failed
Unable to save metadata file. Hint: disk full; file permissions; safe_mode setting.

Go Back

Contact
Recent Changes
Sitemap
python:django_include_exclude_m2m_none

django - query filter on manytomany is empty

https://stackoverflow.com/questions/4184558/django-query-filter-on-manytomany-is-empty

class TestModel(models.Model):
    name = models.CharField(_('set name'), max_length=200)
    manytomany = models.ManyToManyField('AnotherModel', blank=True, null=True)

TestModel.objects.filter(manytomany=None)
TestModel.objects.exclude(manytomany=None)
python/django_include_exclude_m2m_none.txt · Last modified: 2020/07/07 09:44 by whtsky