Creation was broken - when you create an object, there is no object in
context, so can_update does not work
diff --git a/planetstack/apigen/api.template.py b/planetstack/apigen/api.template.py
index f595d2b..bc1b743 100644
--- a/planetstack/apigen/api.template.py
+++ b/planetstack/apigen/api.template.py
@@ -138,12 +138,13 @@
def create(self, request, *args, **kwargs):
#obj = {{ object.camel }}().update(request.DATA)
- obj = self.get_object()
- obj.caller = request.user
- if obj.can_update(request.user):
- return super({{ object.camel }}List, self).create(request, *args, **kwargs)
- else:
- return Response(status=status.HTTP_400_BAD_REQUEST)
+ #obj = self.get_object()
+ #obj.caller = request.user
+ return super({{ object.camel }}List, self).create(request, *args, **kwargs)
+ #if obj.can_update(request.user):
+ # return super({{ object.camel }}List, self).create(request, *args, **kwargs)
+ #else:
+ # return Response(status=status.HTTP_400_BAD_REQUEST)
class {{ object.camel }}Detail(PlanetStackRetrieveUpdateDestroyAPIView):
queryset = {{ object.camel }}.objects.select_related().all()