If I have a custom object manager with a custom create
function for a model:
class CustomManager(models.Manager):
def get_queryset(self):
return super().get_queryset().filter(custom=True)
def create(self):
kwargs["custom"] = True
return super().create(**kwargs)
class Item(models.Model):
customs = CustomManager()
custom = BooleanField()
...
And I use that custom manager as the queryset for a view:
class ItemViewSet(views.ModelViewSet):
queryset = Item.customs.all()
Will the ItemViewSet
's create/post function automatically apply my custom object manager's kwargs["custom"] = True
?