Skip to main content

Pluggable application for TurboGears2 which provides a basic user profile page withforms to allow users to edit their own profile or change their password

Project description

About userprofile

userprofile is a Pluggable application for TurboGears2 which provides a basic user profile page with forms to allow users to edit their own profile or change their password.

Installing

userprofile can be installed both from pypi or from bitbucket:

easy_install tgapp-userprofile

should just work for most of the users

Plugging userprofile

In your application config/app_cfg.py import plug:

from tgext.pluggable import plug

Then at the end of the file call plug with userprofile:

plug(base_config, 'userprofile')

You will be able to access the registration process at http://localhost:8080/userprofile.

Options

tgapp-userprofile supports some options that can be passed to the plug method to customize various aspects of the application:

  • user_partial - Path of a partial to display into the user profile page.

    Useful to add more data to the profile page without changing its template

  • custom_css - Path to a CSS file which will be used for the profile pages in place of the default one.

User Properties

tgapp-userprofile looks for various properties into the User class instances to drive its default behavior, the most important property is the profile_data property which can provide a dictionary with the user informations to display on the profile page, but other properties are available to tune the behavior:

profile_data

A dictionary of entries to display into the profile page, the default dictionary is built with:

{'display_name':('Display Name', user.display_name),
 'email_address':('Email Address', user.email_address)}

each key of the dictionary if the id of the field, in most cases it will have the same name of the user property where that field is stored. Values of the dictionary are tuples where the first value is the name of the field which will be displayed and the second one is the real value of the field.

If an avatar key is available that is expected to provide the url of the avatar image of the user. If it is not available userprofile will look for a tgapp-fbauth facebook avatar or will falleback to the default avatar.

display_name key will be used as the profile page title.

profile_form

A ToscaWidgets or tw2 form that can be used to edit the user profile. By default an autogenerated one with a text field for each entry in profile_data is provided.

save_profile

A callable which will receive the user data submitted by the edit form and is expected to update the user accordingly.

By default values will be stored as they are into the user field with the same id provided into profile_data.

Bootstrap Layout

If you want use bootstrap for beautify style of UserForm or ChangePasswordForm form layout, in your app_cfg:

def replace_profile_form_layout():
    from axf.bootstrap import BootstrapFormLayout
    from userprofile.lib import UserForm
    from userprofile.lib import ChangePasswordForm

    UserForm.child = BootstrapFormLayout(children=UserForm.child.children)
    UserForm.submit.css_class = 'btn-primary form-control'

    ChangePasswordForm.child = BootstrapFormLayout(children=ChangePasswordForm.child.children)
    ChangePasswordForm.submit.css_class = 'btn-primary form-control'

milestones.config_ready.register(replace_profile_form_layout)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tgapp-userprofile-0.1.2.tar.gz (14.3 kB view details)

Uploaded Source

File details

Details for the file tgapp-userprofile-0.1.2.tar.gz.

File metadata

File hashes

Hashes for tgapp-userprofile-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7a9216dd0b880b44da42be94473af341d76641e375a5b65a1833719b40cc8152
MD5 d2de35cfada3724a42bd8a1a2faec9f9
BLAKE2b-256 fc3651185edfdaae8158228664cdb6baea342c9274cd4ebd1cfeb43478978965

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page