SlugField
"Slug" is a newspaper term. A slug is a short label for something, containing only letters, numbers, underscores or hyphens. They're generally used in URLs.
Implies maxlength=50 and db_index=True.
Accepts an extra option, prepopulate_from, which is a list of fields from which to auto-populate the slug, via JavaScript, in the object's admin form:
meta.SlugField(prepopulate_from=("pre_name", "name"))
prepopulate_from doesn't accept DateTimeFields.
The admin represents SlugField as an (a single-line input).
No comments:
Post a Comment