def get_serializer self instance None data None kwargs if instance is

1
2
3
4
5
def get_serializer(self, instance=None, data=None, **kwargs):
if instance is None and data:
instance = self.get_queryset().model(
organization=OrganizationMembership.objects.get_primary(self.request.user).organization)
return super(TemplateViewSet, self).get_serializer(instance=instance, data=data, **kwargs)