made quest title, description and banner image editable to the qm
This commit is contained in:
parent
f2f6095080
commit
af482c7449
|
@ -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):
|
||||
|
|
|
@ -29,8 +29,16 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Live time:</td>
|
||||
<td><input type="date" name="live_date" id="live_date" value="{% if quest.live_time %}{{ localtime(quest.live_time).strftime('%Y-%m-%d') }}{% endif %}"></td>
|
||||
<td><input type="time" name="live_time" id="live_time" step="60" value="{% if quest.live_time %}{{ localtime(quest.live_time).strftime('%H:%M:%S') }}{% endif %}"></td>
|
||||
<td><input type="date" name="live_date" id="live_date" value="{% if quest.live_time %}{{ localtime(quest.live_time).strftime('%Y-%m-%d') }}{% endif %}">
|
||||
<input type="time" name="live_time" id="live_time" step="60" value="{% if quest.live_time %}{{ localtime(quest.live_time).strftime('%H:%M:%S') }}{% endif %}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description:</td>
|
||||
<td><textarea name="description">{{ quest.description }}</textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Banner Image URL:</td>
|
||||
<td><input type="text" name="banner_url" maxlength="200" value="{% if quest.banner_url %}{{ quest.banner_url }}{% endif %}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="timezone" id="timezone">
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue
Block a user