misago.users.profilefields.ProfileFieldclass or one of higher-level base fields.
fieldnameattribute specifies field's unique identifier in Misago. This identifier is used as key on
user.profile_fieldsmodel field to store field's value as well as source form inputs
websiteas it's fieldname:
get_label(user)method if you wish to customize the label content's depending on user's field contents.
readonly = Trueon field will make it never editable. This is useful when you are defining profile fields that display different information about user but are never editable on their own.
is_editablemethod allows you make field conditionally read-only.
get_form_fieldmethod is called to obtain form field that is then added to user edit form, plugging the field to Django's form handling mechanics.
URLFieldas field that should be used to edit its value:
help_textwithin it, and use
help_textprops documented ealier for user-facing UI.
required=Falseon field returned by
ProfileFieldis versalite enough for great majority of use cases, its unlikely that you'll ever want to write custom implementation for your fields, instead limiting yourself to editing the
get_form_fielddocumented ealier, because this method is origin of truth for details edit forms in user-facing UI, you may modify it to customize field's label and help text.
get_form_field, you may include custom cleaning and validation logic on your field that gets run as part of form's clean and validate process.
cleanmethod is called only when user filled it in edit form. It should return cleaned value, or raise ValidationError on any errors. Those errors will be associated with and displayed by their fields in form.
get_input_jsonreturns JSON describing how form field should be displayed in user-facing edit interface, the
get_display_datashould return JSON describing how its value should be displayed on user's "details" tab in profile. This field is also well covered by the default implementation provided by the
ProfileFieldclass, which does following:
None, telling interface to don't display it.
get_value_display_datamethod to obtain JSON describing how field's value should be displayed on the page. If this method returns
None, don't display field on user's profile.
get_value_display_datawhen writing your fields, and only ever use this method if you want to customize displayed label.
ProfileField, this field is called by the
get_display_data. As such its prefferable in most cases for field to provide custom
Nonefrom this methid will prevent this field from beind displayed on user's profile.
criteria, that contains search string entered in search form, and should return
Qobject that lets Misago search field's value.
ProfileFieldclass implements generic
search_usersimplementation that assumes that field's value is text and performs case sensitive search on users
profile_fieldsvalue as well as excludes readonly fields from search:
ChoiceProfileFieldbase field provides custom implementation that searches users by label and value of their choice.
GenderFieldthat allows user to select gender information to be displayed on his or her profile.
ChoiceProfileFieldrequire you to specify either
get_choicesmethod if you wish for choices to be dependant on individual user.
get_choices, all possible choices should be returned - however this only affects the behaviour of searching users in admin control panel.
UrlifiedTextareaProfileField, but if user enters urls in the field, those will be turned into clickable anchor links.
rel="nofollow"attribute on user's profile.
UrlifiedTextareaProfileFieldthat allows user to enter small text bit about themselves.
TextProfileFieldthat allows user to enter real name.
TextProfileFieldthat allows user to enter their location or origin.
ChoiceProfileFieldthat allows user to disclose his/her gender to other members, or make their wish to keep it secret explictly known via "Not telling" option.
UrlProfileFieldthat allows user to enter their website's address.
TextProfileFieldthat allows user to enter their Skype ID.
TextProfileFieldthat allows user to enter their Twitter handle. This field validates valid handles, strips optional leading "@" and displays handle as
rel="nofollow"url to user's Twitter profile.
listusedprofilefieldscommand that lists fields existing in database, by their
real_namekeys and two users have
locationkey. This tool doesn't filter off empty values, meaning that those key exist, but may be empty strings.
profile_fields, you may do it with
deleteprofilefieldcommant. For example, to delete all information set in
websitefield, you may do this:
profile_fieldsvalue is edited either in admin control panel or via "edit details" form, such event, new values and old values are logged by