Ask Your Question
2

Badges associated with which activity?

asked 2011-07-18 06:37:21 -0500

mether gravatar image mether flag of India
1312 33 18 47
http://fedoraproject.org/

updated 2011-07-31 13:26:15 -0500

When I get a badge, I would like to see the association between that and my action specifically in the activity tab in my profile. For instance, if I get a "nice question" badge, I want it to be shown against the link of the question which I received it for.

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-07-24 12:41:48 -0500

NoahY gravatar image NoahY
313 4 2 14
https://github.com/NoahY/...

updated 2011-07-25 02:35:25 -0500

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

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

For the overview 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 (object_id) and whether it is a question or an answer (content_type), then display a collapsible list of links below each 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 populating the user's awards (content_type_id and object_id). Preserve question and answer lists as fetched, pass them to the template and do the same as on the overview tab, this time with a simple (source) link beside the badge.

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

link publish delete flag offensive edit

Comments

Is this in the latest upstream release? mether ( 2011-07-31 13:17:54 -0500 )edit
Yes, it is. Evgeny ( 2011-07-31 13:22:46 -0500 )edit
Not sure it is related but with the latest update, I get a internal server error for my username at http://ask01.dev.fedoraproject.org:8888/users/2/mether/. Other usernames are ok. I cant find anything useful in the logs. mether ( 2011-07-31 13:35:54 -0500 )edit
Could you set DEBUG = True, hit the page and send me traceback? Sorry, apparently I missed something. Evgeny ( 2011-07-31 13:37:03 -0500 )edit
Set. Refresh that page to get traceback mether ( 2011-07-31 13:39:57 -0500 )edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow
1 follower

subscribe to rss feed

Stats

Asked: 2011-07-18 06:37:21 -0500

Seen: 81 times

Last updated: Jul 25 '11