choices templates

This commit is contained in:
Jonas Legion 2021-12-22 10:45:51 +04:00
parent 4d04ec864e
commit 219363acbb
2 changed files with 14 additions and 7 deletions

View File

@ -158,8 +158,18 @@ class Configuration(SingletonModel):
verbose_name=_("Clé d'API du serveur cashless") verbose_name=_("Clé d'API du serveur cashless")
) )
ARNAUD, MASSIVELY, BLK_MVC, BLK_VUE = 'arnaud_mvc', 'html5up-masseively', 'blk_mvc', 'blk_vue'
CHOICE_TEMPLATE = [
(ARNAUD, _('arnaud_mvc')),
(MASSIVELY, _("html5up-masseively")),
(BLK_MVC, _("blk_mvc")),
(BLK_VUE, _("blk_vue")),
]
# choices=[(folder, folder) for folder in os.listdir(f"{settings.BASE_DIR}/BaseBillet/templates")],
template_billetterie = models.CharField( template_billetterie = models.CharField(
choices=[(folder, folder) for folder in os.listdir(f"{settings.BASE_DIR}/BaseBillet/templates")], choices=CHOICE_TEMPLATE,
default=ARNAUD,
max_length=250, max_length=250,
blank=True, blank=True,
null=True, null=True,
@ -167,7 +177,8 @@ class Configuration(SingletonModel):
) )
template_meta = models.CharField( template_meta = models.CharField(
choices=[(folder, folder) for folder in os.listdir(f"{settings.BASE_DIR}/MetaBillet/templates")], choices=CHOICE_TEMPLATE,
default=MASSIVELY,
max_length=250, max_length=250,
blank=True, blank=True,
null=True, null=True,

View File

@ -24,14 +24,10 @@ class index(APIView):
if not configuration.activer_billetterie: if not configuration.activer_billetterie:
return HttpResponseRedirect('https://www.tibillet.re') return HttpResponseRedirect('https://www.tibillet.re')
first_event = None
events = Event.objects.filter(datetime__gt=datetime.now())
if len(events) > 0:
first_event = events[0]
context = { context = {
'configuration': configuration, 'configuration': configuration,
'events': events, 'events': Event.objects.filter(datetime__gt=datetime.now()),
'categorie_billet': Product.BILLET, 'categorie_billet': Product.BILLET,
} }