Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Okay, I've implemented this on my fork, both on the activity tab and the overview page, but only for badges for questions and answers.

A bit of a hack, hopefully Evgeny can clean it up... :)

For the overview page, I just add a template list:

awarded_badge_context = models.Award.objects.filter(
                            user = user
                        ).values(
                            'object_id', 'badge', 'content_type'
                        )

and then use these to get the question or answer number (object_id) and whether it is a question or an answer (content_type), then display a collapsible list of links below each question, hidden by default, opened via jquery clicking on the badge count (x1, etc.).

For the activity page, had to add some variables to the db query for awards to get the context. Preserve question and answer lists, pass them to the template and do the same as on the overview page, this time with a simple (source) link beside the badge.

The answer links don't have the question slug or the question summary, but they work anyway, so I left it for now.

Okay, I've implemented this on my fork, both on the activity tab and the overview page, but only for badges for originating from either questions and or answers.

A bit of a hack, hopefully Evgeny can clean it up... :)

For the overview page, tab, I just add a template list:

awarded_badge_context = models.Award.objects.filter(
                            user = user
                        ).values(
                            'object_id', 'badge', 'content_type'
                        )

and then use these to get the id of the associated question or answer number (object_id) and whether it is a question or an answer (content_type), then display a collapsible list of links below each question, badge type, hidden by default, opened via jquery clicking on the badge count (x1, etc.).

For the activity page, had to add some variables to the db query for populating the user's awards to get the context. (content_type_id and object_id). Preserve question and answer lists, lists as fetched, pass them to the template and do the same as on the overview page, tab, this time with a simple (source) link beside the badge.

The answer links to answers don't have the associated question slug or the question summary, summary in them, but they work anyway, so I left it for now.