From af482c7449950f7e9540b35d65fe7918e720333c Mon Sep 17 00:00:00 2001 From: iou1name Date: Thu, 11 Oct 2018 10:19:46 -0400 Subject: [PATCH] made quest title, description and banner image editable to the qm --- quest/forms.py | 3 +++ quest/jinja2/quest/edit_quest.html | 12 ++++++++++-- quest/views.py | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/quest/forms.py b/quest/forms.py index 296156a..adf6004 100644 --- a/quest/forms.py +++ b/quest/forms.py @@ -43,11 +43,14 @@ class EditQuestForm(forms.Form): """ Form for the /edit_quest page. """ + quest_title = forms.CharField(max_length=100) anon_name = forms.CharField(max_length=20) live = forms.BooleanField(required=False) live_date = forms.DateField(required=False) live_time = forms.TimeField(required=False) timezone = forms.IntegerField() + description = forms.CharField(max_length=256, required=False) + banner_url = forms.URLField(required=False) class QuestForm(forms.ModelForm): diff --git a/quest/jinja2/quest/edit_quest.html b/quest/jinja2/quest/edit_quest.html index a1168d5..7ef7130 100644 --- a/quest/jinja2/quest/edit_quest.html +++ b/quest/jinja2/quest/edit_quest.html @@ -29,8 +29,16 @@ Live time: - - + + + + + Description: + + + + Banner Image URL: + diff --git a/quest/views.py b/quest/views.py index d01ced5..e1b590d 100644 --- a/quest/views.py +++ b/quest/views.py @@ -90,8 +90,13 @@ def edit_quest(request, quest_id, page_num='0'): if request.method == 'POST': form = EditQuestForm(request.POST) if form.is_valid(): + quest.title = form.cleaned_data['quest_title'] quest.anon_name = form.cleaned_data['anon_name'] quest.live = form.cleaned_data['live'] + quest.description = form.cleaned_data['description'] + quest.banner_url = download_img(form.cleaned_data['banner_url']) + if not quest.banner_url.startswith('http'): + quest.banner_url = None live_date = form.cleaned_data['live_date'] live_time = form.cleaned_data['live_time']