I have created a custom model that allows users to put in a list of their "qualifications". I have that model/table set up along with some forms, views, urls (all in my module). Now, I want to integrate that info into the rest of the site. For example, I would like to do at least two things:

1) on the profile page, list their qualifications. Also, add a link under the user tools menu to my edit form.

2) everywhere the user's signature appears (ie, after a question/answer/comment that they post) modify that signature, so that I can include a list of their qualifications, or something like that.

I would like some advice on the appropriate way to do this/how to get started? Or, even more generally, how is osqa set up to allow these types of "injections"?

asked 07 Nov '10, 16:44

rsp's gravatar image

rsp
41661420
accept rate: 66%


Take a look at forum/registry.py for examples of how to insert stuff in the "user tools" menu. Then look at forum/views/users.py, specially to the user_subscriptions (which I believe is closer of what you want) method to see how to add one profile based page.

To modify the user signature you'll have to override the node/reviser_info.html template by creating a new skin or something. There's no way yet to override a specific skin from a template, so the skin will not be completely tied to a template. However that may be a nice addition for the future.

link

answered 08 Nov '10, 11:15

Hernani%20Cerqueira's gravatar image

Hernani Cerq... ♦♦
16.8k65975
accept rate: 52%

@hernani. thanks, that's helpful. one clarification: I think I should put this code to add my menu item:

from forum.modules import ui

ui.register(ui.USER_MENU, ui.UserMenuItem( label=_("my custom menu item"), url=lambda u, c: reverse('edit_user', kwargs={'id': c['user'].id}), span_attrs={'class': 'user-edit'}, weight=0 ) )

I thought of putting this in a startup.py file in my module's folder, but that doesn't work? Also, reviser_info.html was helpful for some of the signatures. I still have to find out where the other signatures come from, but that approach should work for me.

(08 Nov '10, 15:59) rsp

I'd like to make a suggestion: From what I gather, questions_list/item.html uses the custom tag 'user_signature' which in turn uses users/signature.html to render the user's signature by using the passed in parameter to indicate the type of signature. However, the various node html files seem to directly render a signature themselves, or using other signature pages such as node/reviser_info.html, or using other template tags. I think consolidating them all into the one tag 'user_signature' and users/signature.html file is cleaner and makes modifying them easier.

(08 Nov '10, 17:01) rsp
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×44
×24
×11
×2

Asked: 07 Nov '10, 16:44

Seen: 556 times

Last updated: 08 Nov '10, 17:13

powered by OSQA