Models¶
-
class
markdownx.models.MarkdownxField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)¶ Custom Django field for Markdown text.
Parameters are identical to those of the ordinary Django TextField parameters for the model fields. For consistency therefore, the descriptions have been borrowed from Django’s official documentations (with minor modifications).
Parameters: - verbose_name (str) – A human-readable name for the field. If the verbose name isn’t given, Django will automatically create it using the field’s attribute name, converting underscores to spaces.
- blank (bool) – If
True, the field is allowed to be blank. Default isFalse. - null (bool) – If
True, Django will store empty values as NULL in the database. Default isFalse. - editable (bool) – If
False, the field will not be displayed in the admin or any other ModelForm. They are also skipped during model validation. Default isTrue. - help_text (str) – Extra “help” text to be displayed with the form widget. It’s useful for
documentation even if your field isn’t used on a form. Note that this value
is not HTML-escaped in automatically-generated forms. This lets you include
HTML in
help_textif you so desire. - validators (list, tuple) – A list of validators to run for this field. See the validators documentations for additional information.
- error_messages (dict) – The error_messages argument lets you override the default messages that the field
will raise. Pass in a dictionary with keys matching the error messages you want
to override. Relevant error message keys include
null,blank, andinvalid. - kwargs – Other
django.db.models.fieldparameters. See Django documentations for additional information.
-
formfield(**kwargs)¶ Customising the
form_class.Returns: TextField with a custom form_class.Return type: django.db.models.TextField