Commits

Anonymous committed fab2dda

now classes apply to all (not none) templates by default

  • Participants
  • Parent commits 1541c00

Comments (0)

Files changed (1)

File semanticeditor/models.py

     # Can't do filter in DB easily, because 'templates' is actually a comma
     # separated list in DB.
     classes = CssClass.objects.all().order_by('category__name', 'verbose_name')
-    return filter(lambda c: template in c.templates, classes)
+    # the class is allowed in the template if explicitly mentioned, or if no templates
+    # are specified - useful, because many classes will be used across all templates
+    return [c for c in classes if c.templates is None or template in c.templates]