diff --git a/quest/forms.py b/quest/forms.py index 2368f4b..296156a 100644 --- a/quest/forms.py +++ b/quest/forms.py @@ -56,7 +56,7 @@ class QuestForm(forms.ModelForm): """ class Meta: model = Quest - fields = ('title', 'description', 'tags') + fields = ('title', 'description', 'tags', 'banner_url') class PostForm(forms.ModelForm): diff --git a/quest/jinja2/quest/new_quest.html b/quest/jinja2/quest/new_quest.html index b9c0c7f..ce12a52 100644 --- a/quest/jinja2/quest/new_quest.html +++ b/quest/jinja2/quest/new_quest.html @@ -5,6 +5,7 @@
{{ csrf_input }}
+


diff --git a/quest/jinja2/quest/quest.html b/quest/jinja2/quest/quest.html index 3ef2cb3..cab74dd 100644 --- a/quest/jinja2/quest/quest.html +++ b/quest/jinja2/quest/quest.html @@ -47,7 +47,8 @@ {% endblock %} {% block content %}
-

{{ quest.title }}

+

{{ quest.title }}

+ {% if quest.banner_url %}{% endif %}
{% for post in posts %} {% if post.post_type == "text" %} diff --git a/quest/jinja2/quest/quest_homepage.html b/quest/jinja2/quest/quest_homepage.html index 34d4400..75c342d 100644 --- a/quest/jinja2/quest/quest_homepage.html +++ b/quest/jinja2/quest/quest_homepage.html @@ -54,7 +54,9 @@ {% endblock %} {% block content %}
-

{{ quest.title }}

+

{{ quest.title }}

+ {% if quest.banner_url %}{% endif %} + {% if quest.description %}
{{ quest.description }}
{% endif %}
Tags: {% for tag in quest.tags.names() %}{{ tag }}{% if not loop.last %}, {% endif %}{% endfor %}
diff --git a/quest/migrations/0010_quest_banner_url.py b/quest/migrations/0010_quest_banner_url.py new file mode 100644 index 0000000..84e657d --- /dev/null +++ b/quest/migrations/0010_quest_banner_url.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.1 on 2018-10-11 12:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('quest', '0009_quest_latest_post_date'), + ] + + operations = [ + migrations.AddField( + model_name='quest', + name='banner_url', + field=models.URLField(blank=True, null=True), + ), + ] diff --git a/quest/models.py b/quest/models.py index 4fc0f14..d37b284 100644 --- a/quest/models.py +++ b/quest/models.py @@ -22,6 +22,7 @@ class Quest(models.Model): anonymize = models.BooleanField(default=True) description = models.CharField(max_length=256, blank=True, null=True) latest_post_date = models.DateTimeField(null=True, blank=True) + banner_url = models.URLField(null=True, blank=True) def update_post_date(self): try: diff --git a/quest/static/quest.css b/quest/static/quest.css index 2236d73..c5e468b 100644 --- a/quest/static/quest.css +++ b/quest/static/quest.css @@ -26,6 +26,10 @@ h3 { width: 70%; } +#questTitle { + text-align: center; +} + #tags { padding-bottom: 0.25em; } diff --git a/quest/views.py b/quest/views.py index bd61cef..d01ced5 100644 --- a/quest/views.py +++ b/quest/views.py @@ -14,7 +14,7 @@ from django.conf import settings from .models import Quest, DiceRoll, PollOption, PollVote, Page, Post from .forms import EditQuestForm, QuestForm, PostForm from user.models import User -from .tools import send_to_websocket +from .tools import download_img, send_to_websocket def index(request): """The quest page index.""" @@ -135,6 +135,9 @@ def new_quest(request): if quest_form.is_valid(): quest = quest_form.save(commit=False) quest.owner = request.user + quest.banner_url = download_img(quest.banner_url) + if not quest.banner_url.startswith('http'): + quest.banner_url = None quest.save() quest_form.save_m2m() print(quest.tags.names()) diff --git a/todo b/todo index 7b28fb8..e983225 100644 --- a/todo +++ b/todo @@ -1,12 +1,13 @@ New Features: Notifications -Banner images Front page to show new quests Webm posting (you) counter Account managament Display profile link in header bar Quote backlinks +Email +RSS Improvements: More options for text posts (lists and so on)