Answer the question
In order to leave comments, you need to log in
What is the correct way to call the get method of the CreateView parent class in Django?
In the overridden get method, you need to implement an access check and call the parent get() if the check was successful. How to do it right?
class ItemCreateView(CreateView):
model = Item
fields = ['title', 'description', 'image', 'price']
def get(self, request):
if not request.user.is_staff:
raise PermissionDenied
super() #???????????
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question