added new buttons and einen artikel bearbeiten

This commit is contained in:
Esther Kleinhenz
2018-11-12 19:17:20 +01:00
parent 67e91fc5af
commit 5ec22d5ff9
17 changed files with 250 additions and 145 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
{% extends 'base.html' %}{% block content %}
{% load hitcount_tags %}
{% load hitcount_tags %}
<div class="post">
{% if post.published_date %}
@@ -10,19 +10,19 @@
<a class="btn btn-outline-dark" href="{% url 'post_publish' pk=post.pk %}">Publish</a>
{% endif %} {% if user.is_staff and user == post.author %}
<a class="btn btn-outline-dark" href="{% url 'post_edit' pk=post.pk %}">
<span class="glyphicon glyphicon-pencil">Edit</span>
<span class="glyphicon glyphicon-pencil">Bearbeiten</span>
</a>
<a class="btn btn-outline-dark" href="{% url 'post_remove' pk=post.pk %}">
<span class="glyphicon glyphicon-remove">Remove</span>
<span class="glyphicon glyphicon-remove">Löschen</span>
</a>
{% endif %}
<h1>{{ post.title }}</h1>
<p>{{ post.text|linebreaksbr }}</p>
<p>
Tags:
Tags:
{% for tag in post.tags.all %}
<a href="{% url 'blog_search_list_view' %}">{{ tag.name }} </a>
{% if not forloop.last %}, {% endif %}
{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
<p>
+2 -2
View File
@@ -1,9 +1,9 @@
{% extends 'base.html' %}
{% block content %}
<h1>New post</h1>
<h1>Artikel-Editor</h1>
<form method="POST" class="post-form">{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="save btn btn-outline-dark">Save</button>
<button type="submit" class="save btn btn-outline-dark">Sichern</button>
</form>
{% endblock %}
+7
View File
@@ -1,5 +1,12 @@
{% extends 'base.html' %} {% block content %}
{% if tag %} Posts tagged with "{{ tag.name }}" {% endif %}
{% if messages %}
<div class="messages">
{% for message in messages %}
<p {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</p>
{% endfor %}
</div>
{% endif %}
{% for post in posts %}
<div class="post">
<div class="date">
+1
View File
@@ -121,6 +121,7 @@ def post_publish(request, pk):
@staff_member_required
def post_remove(request, pk):
post = get_object_or_404(Post, pk=pk)
messages.info(request, 'Der Artikel "' + post.title + '" wurde gelöscht')
post.delete()
return redirect('post_list')