Saturday, January 31, 2015

Re: How to get hold of a session after getting signaled?

I can't just call badge.award_to(user) because I need to wait for the check logic to verify if the user should receive a badge or not.
My workaround is that I created a new table that inserts badge and user foreign keys and before the view is rendered I will check this table for any entries for that user. If there are, I will copy the data to a message and delete the object from the database again.

It's rather ugly due to the many database hits which I would like to avoid but I can't think of anything else at the moment. Apparently (using google) there is no way to get hold of the request in a post_save() signal - which I need to check all achievements.

The only real solution would be to not use this post_save() signal but manually do the checking for achievements before my view is rendered, which would require some work on the original source code. I will look into it though next week.

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment