[Django]-What is the correct way to extend / modify a view of external app in Django?

4👍

You can wrap the external app’s view with your own view. In your own views.py:

from external_app.views import upload_view

@login_required
def custom_upload_view(self, request, *args, **kwargs):
     # Do something before
     ...
     return upload_view(request, *args, **kwargs)

You just need to make sure you have your own URL pattern pointing to your custom view in your url config before the external apps urls

Leave a comment