Hello Django Community,
I am working on implementing a feature in a project that I built and I am looking for some guidance on how implement the database side of this feature most efficiently.
The models in question:
The two models in question are the user model and a model that tracks tickets raised by users. A ticket has a requester, self explanatory, and an owner, the owner being the person who winds up getting assigned and working the ticket to action the underlying request. Both of these columns on tickets are foreign keys to user.
example models
User:
id = auto pk
username = charfield
other things....
Ticket:
id = auto pk
requester = fk to user
owner = fk to user
other things....
The problem Im now trying to solve:
We have a desire to be able to allow other users outside the requestor/owner to get notified in the event of a ticket being updated by either the owner or the requestor, effectively a list of subscribers. What would be the best practice for implementing a column to track 1 or more subscribers from a user model to some other model using a single column in a project like this?
My initial brainstorming:
I am sending notifications using logic that just requires username so I know I could just store a list of users in a charfield but ive got to imagine theres a more elegant way of doing this. Is this a use case for a manytomany field? Ive not used this field before so if it is im having a hard time wrapping my head around how this would work in this use case.
Any guidance from the community on this would be greatly appreciated!