Snippet List
Sometimes a plain-text help-text isn't sufficient, and it's handy to be able to add links to pages, documentation or external websites.
This javascript snippet can be added to your page, in combination with adding a class to your help text in your template. This assumes you're using jQuery on your website.
Field template snippet:
```
{% if field.help_text %}<p class="help-text">{{ field.help_text }}</p>{% endif %}
```
On document ready, this will convert the markdown-style links into anchor tags, allowing you to have richer help text for your users
- help
- link
- documentation
- docs
- href
- help_text
I found model definitions with large number of fields with long help_text unreadable and feel that help_text doesn't really belong to field definition. With this snippet help_text attributes can live outside field definitions in inner HelpText class so field definitions become shorter and more readable.
Usage:
from django.db import models
import readable_models
class MyModel(models.Model):
__metaclass__ = readable_models.ModelBase
name = models.CharField('Name', max_length=30)
address = models.CharField('Address', max_length=255)
# ... long list of fields
class HelpText:
name = 'The name ...'
address = 'Example: <very verbose example is here>'
4 snippets posted so far.