User Profiles
Community / UserProfilesBack to Snip <-- Previous Change | Next Change -->
| Diff Summary | |||||
|---|---|---|---|---|---|
| Title | |||||
| Date | 2007-07-22 15:27:32 | 2007-07-22 15:35:05 | |||
| Editor | Herbert Poul | Herbert Poul | |||
| Tags | |||||
| 2007-07-22 15:27:32 by Herbert Poul | 2007-07-22 15:35:05 by Herbert Poul | ||||
|---|---|---|---|---|---|
| 15 | - Renderstring: A python formatting string how the | 15 | - Renderstring: A python formatting string how the | ||
| > | value should be rendered. You can use %(value)s t | > | value should be rendered. You can use %(value)s t | ||
| > | o include the value. | > | o include the value. | ||
| 16 | - Sortorder: Defines the order in which the fields | 16 | - Sortorder: Defines the order in which the fields | ||
| > | appear while editing or viewing a user profile. | > | appear while editing or viewing a user profile. | ||
| 17 | 17 | ||||
| 18 | 18 | ||||
| 19 | # Taking advantage of user profiles in your own ap | 19 | # Taking advantage of user profiles in your own ap | ||
| > | plications | > | plications | ||
| t | t | 20 | |||
| 21 | The user profiles are ment to be as extensible as | ||||
| > | possible. To achieve this, at specific places whil | ||||
| > | e editing or displaying the profile signals are di | ||||
| > | spatched which can be intercepted by any django ap | ||||
| > | plication to modify the resulting output. | ||||
| 22 | |||||
| 23 | Three signals are currently defined (all under sph | ||||
| > | ene.community.signals) | ||||
| 24 | - profile_edit_init_form: dispatched after initiat | ||||
| > | ing the form (django newforms). Allows application | ||||
| > | s to add additional fields. | ||||
| 25 | - profile_edit_save_form: Called after the basic u | ||||
| > | ser information has been saved and further profile | ||||
| > | information can be retrieved and saved. (In this | ||||
| > | stage the form was already validated) | ||||
| 26 | - profile_display: dispatched whenever a profile i | ||||
| > | s displayed. signal handlers can return a string w | ||||
| > | hich will be added to the HTML input inside a two- | ||||
| > | column table tag. | ||||
| 27 | |||||
| 28 | I hope you now at least have grasp what could be d | ||||
| > | one currently. Since I'm not sure how useful this | ||||
| > | can be I'm not extensively documenting this part. | ||||
| > | If you think this can be useful for you check for | ||||
| > | example how sphboard uses these signals (sphenecol | ||||
| > | l/sphene/sphboard/models.py), post in the board or | ||||
| > | write me (herbert.poul@gmail.com) an email. | ||||
| 29 | |||||
| 30 | # Disabling profiles | ||||
| 31 | |||||
| 32 | If you want to disable the user profiles for some | ||||
| > | reason (e.g. because you have your own user profil | ||||
| > | e mechanism) - it shouldn't be too hard to accompl | ||||
| > | ish this. | ||||
| 33 | |||||
| 34 | The most important thing to do is overload the tem | ||||
| > | plate sphene/community/_display_username.html whic | ||||
| > | h is used throughout SCT to display the full usern | ||||
| > | ame including a link the the user profile. You can | ||||
| > | adopt the template to link to your profile implem | ||||
| > | entation. | ||||
Powered by Sphene Community Tools
