Source

semanticeditor / semanticeditor / models.py

Full commit
Luke Plant b67206d 
Luke Plant b1c7fe1 



Luke Plant b67206d 
Luke Plant b338f06 
Luke Plant 0b2a8e2 
Luke Plant c7cf19d 
Luke Plant 0b2a8e2 

Luke Plant c7cf19d 




Luke Plant b1c7fe1 


Luke Plant 7936ba8 

Luke Plant 0f39f05 
Luke Plant 7936ba8 
Luke Plant 2565dc7 
Luke Plant b338f06 
Luke Plant d593125 


Luke Plant 1bf0001 
Luke Plant d593125 

Luke Plant b338f06 
Luke Plant e64215a 
Luke Plant b338f06 



Luke Plant cb09308 
Luke Plant b338f06 
from django.db import models
from semanticeditor.fields import MultiSelectField
from django.conf import settings

template_list = [(f,n) for (f,n) in settings.CMS_TEMPLATES if f != settings.CMS_TEMPLATE_INHERITANCE_MAGIC]

class CssClass(models.Model):
    name = models.CharField("CSS class name", max_length=255, unique=True,
                                  help_text="The name as it appears in the CSS file")
    verbose_name = models.CharField("Human name", max_length=255, blank=False, unique=True,
                                    help_text="User-visible name of the style.")
    description = models.TextField("Description", max_length=255, blank=True,
                                   help_text="This is displayed as a 'tooltip' "
                                   "when the user hovers over the name in the "
                                   "list of styles.  The data will be interpreted "
                                   "as raw HTML, so it can include an example.")
    templates = MultiSelectField("Templates", choices=template_list, blank=True,
                                 default="")

    allowed_elements = models.CharField("Allowed HTML elements", max_length=255,
                                        help_text="A space separated list of HTML "
                                        "element names.  Use 'newrow' or 'newcol' to indicate "
                                        "it can be applied to layout rows or columns ",
                                        default="h1 h2 h3 h4 h5 h6 p blockquote ul ol li newrow newcol")

    column_equiv = models.IntegerField("Column count equivalent", null=True, blank=True,
                                       help_text="For classes designed to be applied to "
                                       "columns only, this is the number of columns this "
                                       "should be considered as equivalent to. This can be "
                                       "useful for generating double width columns etc. "
                                       "within a column layout.")
    def __unicode__(self):
        return self.verbose_name

    class Meta:
        verbose_name = "CSS class"
        verbose_name_plural = "CSS classes"
        ordering = ('verbose_name',)