User Profiles
Community / UserProfilesUser profiles in the Community application serve two purposes:
- Allow the user define public attributes which will be visible in his public profile.
- Set application specific settings.
1. Configuring information fields
An administrator of a site can define which fields are available. These can be set in the django admin under Community -> Community user profile fields.
Each configured field has four properties:
- Name: The label visible to the user while editing or viewing a user profile.
- Regex: A regular expression which checks if the input of a user is valid. Useful for example to validate that a URL is prefixed with http://
- Renderstring: A python formatting string how the value should be rendered. You can use %(value)s to include the value.
- Sortorder: Defines the order in which the fields appear while editing or viewing a user profile.
2. Taking advantage of user profiles in your own applications
The user profiles are ment to be as extensible as possible. To achieve this, at specific places while editing or displaying the profile signals are dispatched which can be intercepted by any django application to modify the resulting output.
Three signals are currently defined (all under sphene.community.signals)
- profile_edit_init_form: dispatched after initiating the form (django newforms). Allows applications to add additional fields.
- profile_edit_save_form: Called after the basic user information has been saved and further profile information can be retrieved and saved. (In this stage the form was already validated)
- profile_display: dispatched whenever a profile is displayed. signal handlers can return a string which will be added to the HTML input inside a two-column table tag.
I hope you now at least have grasp what could be done 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 (sphenecoll/sphene/sphboard/models.py), post in the board or write me (herbert.poul@gmail.com) an email.
3. Disabling profiles
If you want to disable the user profiles for some reason (e.g. because you have your own user profile mechanism) - it shouldn't be too hard to accomplish this.
The most important thing to do is overload the template sphene/community/_display_username.html which is used throughout SCT to display the full username including a link the the user profile. You can adopt the template to link to your profile implementation.
Last Modified: 2007-07-22 15:35:22 by Herbert Poul - [ Snip Changes ] [ Wiki History ]
1 Comments
Customize ListPlease login to create a new thread.