post now complete visible, files added to db

This commit is contained in:
Johannnes Bürst
2020-03-19 14:54:06 +01:00
parent 1ea7cff2f1
commit de0da705fa
12 changed files with 235 additions and 190 deletions

View File

@@ -59,4 +59,5 @@
</section>
{% block content %}
{% endblock %}
</body>
</body>
<footer class="w3-highway-red">Special thanks to <strong>Langspielplatte</strong> for hosting this webspace! <strong>&lt;3</strong> </footer>

View File

@@ -8,11 +8,14 @@
<form method=post enctype=multipart/form-data>
<label for="title">Title</label>
<input name="title" id="title" value="{{ request.form['title'] }}" required>
<label for="nickname">Nickname</label>
<input name="nickname" id="nickname" value="{{ request.form['nickname'] }}" required>
<label for="body">Body</label>
<textarea name="body" id="body">{{ request.form['body'] }}</textarea>
<label for="file">Body</label>
<div>
<p>Choose a mp4, webm, gif , png or jpg file.(max 25MB)</p>
<input type="file" placeholder="meme" name="file" required>
<input type="file" placeholder="meme" name="file" id="file" required>
</div>
<input type="submit" value=Upload>
</form>

View File

@@ -1,7 +1,8 @@
{% extends 'base.html' %}
{% block header %}
{% block header %}
<div class="container w3-center">
<h1>{% block title %}Welcome to the Dankventskalender 2020!{% endblock %}</h1>
<div>
@@ -14,25 +15,31 @@
{% endif %}
</div>
</div>
{% endblock %}
{% block content %}
{% for post in posts %}
<article class="post">
<header>
<div>
<h1>{{ post['title'] }}</h1>
<div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div>
</div>
{% if g.user['id'] == post['author_id'] %}
<a class="action" href="{{ url_for('calender.update', id=post['id']) }}">Edit</a>
<div class="container w3-center">
{% for post in posts %}
<div class="item">
<article class="post">
<header>
<div>
<h1>{{ post['title'] }}</h1>
<h2>{{ post['nickname'] }}</h2>
<div class="about">by {{ post['username'] }}
on {{ post['created'].strftime('%Y-%m-%d') }}</div>
</div>
{% if g.user['id'] == post['author_id'] %}
<a class="action" href="{{ url_for('calender.update', id=post['id']) }}">Edit</a>
{% endif %}
</header>
<img class="file" src="{{ post['file'] }}">
<p class="body">{{ post['body'] }}</p>
</article>
{% if not loop.last %}
<hr>
{% endif %}
</header>
<p class="body">{{ post['body'] }}</p>
</article>
{% if not loop.last %}
<hr>
{% endif %}
{% endfor %}
{% endblock %}
</div>
{% endfor %}
</div>
{% endblock %}