Choose your template power !

This commit is contained in:
Jonas Legion 2021-12-06 18:31:55 +04:00
parent 7ae07441ba
commit 499daa30e2
5 changed files with 71 additions and 28 deletions

View File

@ -115,7 +115,7 @@ class ConfigurationAdmin(SingletonModelAdmin):
'map_img',
)
}),
('Réstaurant', {
('Restaurant', {
'fields': (
'carte_restaurant',
),
@ -144,6 +144,8 @@ class ConfigurationAdmin(SingletonModelAdmin):
('Billetterie', {
'fields': (
'activer_billetterie',
'template_billetterie',
'template_meta',
'name_required_for_ticket',
'jauge_max',
'option_generale_radio',

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2 on 2021-12-06 14:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('BaseBillet', '0020_auto_20211111_1219'),
]
operations = [
migrations.AddField(
model_name='configuration',
name='template_billetterie',
field=models.CharField(blank=True, choices=[('html5up-massively', 'html5up-massively'), ('arnaud_mvc', 'arnaud_mvc'), ('original_arnaud', 'original_arnaud')], max_length=250, null=True, verbose_name='Template'),
),
migrations.AddField(
model_name='configuration',
name='template_meta',
field=models.CharField(blank=True, choices=[('html5up-massively', 'html5up-massively'), ('arnaud_mvc', 'arnaud_mvc'), ('original_arnaud', 'original_arnaud')], max_length=250, null=True, verbose_name='Template'),
),
]

View File

@ -1,3 +1,4 @@
import os
import uuid
import requests
@ -157,6 +158,22 @@ class Configuration(SingletonModel):
verbose_name=_("Clé d'API du serveur cashless")
)
template_billetterie = models.CharField(
choices=[(folder, folder) for folder in os.listdir(f"{settings.BASE_DIR}/BaseBillet/templates")],
max_length=250,
blank=True,
null=True,
verbose_name=_("Template Billetterie")
)
template_meta = models.CharField(
choices=[(folder, folder) for folder in os.listdir(f"{settings.BASE_DIR}/MetaBillet/templates")],
max_length=250,
blank=True,
null=True,
verbose_name=_("Template Meta")
)
class Product(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, unique=True, db_index=True)
@ -348,7 +365,7 @@ class Event(models.Model):
return f"{self.datetime.strftime('%d/%m')} {self.name}"
class Meta:
unique_together = ('name','datetime')
unique_together = ('name', 'datetime')
ordering = ('datetime',)
verbose_name = _('Evenement')
verbose_name_plural = _('Evenements')
@ -463,7 +480,6 @@ class Ticket(models.Model):
f"{self.last_name.capitalize()}" \
f".pdf"
def pdf_url(self):
domain = connection.tenant.domains.all().first().domain
api_pdf = reverse("ticket_uuid_to_pdf", args=[f"{self.uuid}"])
@ -474,7 +490,6 @@ class Ticket(models.Model):
port = ":8002"
return f"{protocol}{domain}{port}{api_pdf}"
def event(self):
return self.reservation.event
@ -528,7 +543,6 @@ class Paiement_stripe(models.Model):
reservation = models.ForeignKey(Reservation, on_delete=models.PROTECT, blank=True, null=True,
related_name="paiements")
QRCODE, API_BILLETTERIE = 'Q', 'B'
SOURCE_CHOICES = (
(QRCODE, _('Depuis scan QR-Code')),

View File

@ -37,7 +37,11 @@ class index(APIView):
# return render(request, 'html5up-massively/index.html', context=context)
# return render(request, self.template_name , context=context)
return render(request, 'arnaud_mvc/lieux.html', context=context)
if configuration.template_billetterie :
return render(request, f'{configuration.template_billetterie}/index.html', context=context)
else :
return render(request, 'arnaud_mvc/index.html', context=context)
# class adhesion(APIView):