How to use the martor.models.MartorField function in martor

To help you get started, we’ve selected a few martor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github agusmakmun / django-markdown-editor / martor_demo / app / models.py View on Github external
from django.db import models
from martor.models import MartorField


class Post(models.Model):
    title = models.CharField(max_length=200)
    description = MartorField()
    wiki = MartorField()
github PragmaticMates / django-flatpages-i18n / flatpages_i18n / models.py View on Github external
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from martor.models import MartorField
from modeltrans.fields import TranslationField
from mptt.models import MPTTModel, TreeForeignKey
from pragmatic.mixins import SlugMixin


class FlatPage_i18n(SlugMixin, models.Model):
    FORCE_SLUG_REGENERATION = False

    title = models.CharField(_('title'), max_length=200)
    slug = models.SlugField(unique=True, max_length=SlugMixin.MAX_SLUG_LENGTH, blank=True, default='')
    machine_name = models.SlugField(_('machine name'), max_length=30, blank=True, help_text=_('unique'))
    content = MartorField(_('content'), blank=True)
    template_name = models.CharField(
        _('template name'), max_length=70, blank=True,
        help_text=_(u"Example: 'flatpages_i18n/contact_page.html'. If this isn't provided, the system will use 'flatpages_i18n/default.html'."))
    registration_required = models.BooleanField(
        _('registration required'), default=False,
        help_text=_(u"If this is checked, only logged-in users will be able to view the page."))
    sites = models.ManyToManyField(Site)
    created = models.DateTimeField(_('created'), auto_now_add=True)
    modified = models.DateTimeField(_('modified'), auto_now=True)
    i18n = TranslationField(fields=('title', 'slug', 'content'))

    class Meta:
        verbose_name = _('flat page')
        verbose_name_plural = _('flat pages')
        ordering = ('title',)
        indexes = [GinIndex(fields=["i18n"]), ]
github agusmakmun / django-markdown-editor / martor_demo / app / models.py View on Github external
from django.db import models
from martor.models import MartorField


class Post(models.Model):
    title = models.CharField(max_length=200)
    description = MartorField()
    wiki = MartorField()