Replies: 2 comments
-
yer this is not a trival situation. maybe what you could do is: When subsceribing subscribe to all Articles (assume this is a small enough list... not in the 1000s)
In the consume when you detect a change to a ManyToMany table (eg a new article is created) subscribe to that article. Or if the many to many table is updated and the article is removed from the publication un-subscribe from the articles changes. does this make any sense? happy to mock up how this migh look in code if you need? (if you expect there to be many articles then we need to come up with a differnt solution) Go through your code and ensure the many to many table is also included as a prefetch related (this way you could emmmit an event for every single publication without doing extra db quries). |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the ideas. |
Beta Was this translation helpful? Give feedback.
-
First of all thanks for this great library. It made a lot of stuff I have to handle much easier. But now I'm confronted with a hard-to-solve problem. I have a many-to-many relationship and want to subscribe to all the children. Just like the documentation (https://github.com/hishnash/djangochannelsrestframework#subscribing-to-a-filtered-list-of-models) shows. But I can't think of a way to implement the
groups_for_signal
without database calls.Let's say my models look like this:
(https://docs.djangoproject.com/en/3.2/topics/db/examples/many_to_many/)
To get the
groups_for_signal
I would need to do something like this:But as stated in the documentation this doesn't seem to be a good idea. Is there a better way that I forgot?
Beta Was this translation helpful? Give feedback.
All reactions