S
S
Spike Spiegel2022-04-10 19:31:37
Django
Spike Spiegel, 2022-04-10 19:31:37

What tools are needed to make a notification in Django?

I want to notify the user about the response to his comment
How it will look, I figured out
How it should look like in general
The user writes a comment. If someone replies to his comment, the user is notified that someone has replied to his comment, and he can go there using the link
No idea how to do this, with the visual part of the code I found a solution (where the notification pops up on the right)
But the brain of this problem , the head of this problem, I don’t know how to solve it, I DEFINITELY don’t know what tools are needed for this
Please, tell me what tools are needed in order to do this! (like async or something else, any of your answers will be very important)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nesterov, 2022-04-10
@AlexNest

One can simply add a foreign key to itself and a boolean field is_read indicating whether the author of the parent comment has "seen" the child. Then it will be enough to select by the criterion:
- child comment
- not read
This is the simplest implementation, but not optimal in terms of queries. At least at the django ORM level.
You can create a separate table containing fields (conditionally):
- original comment (or any other object. see " content types " )
- type (like/reply/etc.)
- whether read
All this can be implemented using django. It will look like it is now implemented here - the user refreshes the page - notifications are shown.
If you need in real time (as in vk / tg / discord) use sockets .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question