Last active
February 25, 2017 12:58
-
-
Save hseritt/4dac1695b992915e0d066703c8d00111 to your computer and use it in GitHub Desktop.
Django forms - setting help text for fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In the __init__ method: | |
self.fields['description'].help_text = mark_safe(FIELD_REQUIRED_MSG) | |
self.fields['issue_type'].help_text = mark_safe(FIELD_REQUIRED_MSG) | |
self.fields['priority'].help_text = mark_safe(FIELD_REQUIRED_MSG) | |
self.fields['project'].help_text = mark_safe(FIELD_REQUIRED_MSG) | |
self.fields['title'].help_text = mark_safe(FIELD_REQUIRED_MSG) | |
# and in class Meta: | |
class Meta: | |
model = Contact | |
fields = ['user', 'bio', 'organization', 'phone_number', 'skype', 'google', 'image_file'] | |
help_texts = { | |
'bio': 'Tell us what you do and how you got here.', | |
'user': 'Referred user must already exist in the system ' \ | |
+ 'and not be assigned to an organization.' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment