Ejemplo n.º 1
0
 def get_template_choices():
     """ For figuring out what templates are valid to store in the DB """
     layout_dir = 'varlet/pages/layouts/*.html'
     found_templates = find_all_templates(pattern=layout_dir)
     return template_choices(found_templates)
Ejemplo n.º 2
0
 def lookups(self, request, model_admin):
     bad_entries = Q(template=None) | Q(template="")
     templates = tuple(model_admin.model.objects.exclude(bad_entries).values_list("template", flat=True).distinct())
     templates_sorted = sorted(templates)
     return template_choices(templates=templates_sorted)