when ever i override the change_view in admin i will get the following line of code
@csrf_protect_m
@transaction.commit_on_success
def change_view(self, request, object_id, extra_context=None):
return admin.ModelAdmin.change_view(self, request, object_id, extra_context=extra_context)
What is the First two line of code ?? Should i use this ?? What it does ?
I am just started Extending Django Admin. So hope your answers will be simple and with example.
@csrf_protect_mis a method decorator. To understand what its doing, read the documentation on csrf protection@transaction.commit_on_successis also a decorator. To understand what its doing, read the documentation on database transactionsDecorators in simple terms are a way to wrap conditional functionality around methods or functions. They wrap around a function, modify it, and return the function. The python manual has an explaination of how they are written.