How To Tell Django Ive Overridden A Third Party App

234 views Asked by At

Im wanting to add functionality to a Django-Notifications view. I guess the best way to do this is to override the class, add my custom logic, then pass the class to super:

from notifications import AllNotificationsList

class CustomAllNotificationsList(AllNotificationsList):
    def get_queryset(self):
        # my custom logic
        return super(CustomAllNotificationsList, self).get_queryset(self)

I know of this guide for overriding Django Admin, but I cant find how to do this for other third party packages.

My questions are:

  1. I dont know where to put this overridden class (in my project tree).

  2. I dont know how to tell Django that it has been overridden (settings.py?).

Thank you.

1

There are 1 answers

0
horse On

This is how I ended up doing this:

https://medium.com/@RStein/extending-third-party-django-app-without-touching-its-code-d35fb136c08f

It's a bit hacky but its the best I could find.