through one many form example django django-queryset

one - many to many filter django



django-filtro de consulta en manytomany está vacío (1)

En Django hay una manera de filtrar en un campo manytomany vacío o nulo.

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


print TestModel.objects.filter(manytomany=None)