From f0e6b5676cd1ac22537e107ebfa20992079da759 Mon Sep 17 00:00:00 2001 From: patrick Date: Sun, 23 May 2021 15:33:06 +0000 Subject: [PATCH] add ChoiceField for template name --- fet2020/core/forms.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fet2020/core/forms.py b/fet2020/core/forms.py index 50005d42..879d3add 100644 --- a/fet2020/core/forms.py +++ b/fet2020/core/forms.py @@ -1,9 +1,17 @@ from ckeditor_uploader.widgets import CKEditorUploadingWidget from django import forms +from django.utils.translation import gettext_lazy as _ + from .models import CustomFlatPage class FlatPageForm(forms.ModelForm): + __choices = [ + ("flatpages/default.html", _("default.html")), + ("flatpages/social_media.html", _("social_media.html")), + ] + template_name = forms.ChoiceField(choices=__choices) + class Meta: model = CustomFlatPage fields = '__all__'