changed tempalte design
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
<a class="nav-link" href="{% url 'tag_list' %}">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'blog_search_list_view' %}">Suche</a>
|
||||
<a class="nav-link" href="{% url 'search_add' %}">Suche</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'post_new' %}" class="top-menu"><span class="glyphicon glyphicon-plus">+</span></a>
|
||||
@@ -52,7 +52,7 @@
|
||||
<a class="nav-link" href="{% url 'tag_list' %}">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'blog_search_list_view' %}">Suche</a>
|
||||
<a class="nav-link" href="{% url 'search_add' %}">Suche</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'post_new' %}" class="top-menu"><span class="glyphicon glyphicon-plus">+</span></a>
|
||||
@@ -65,7 +65,7 @@
|
||||
<a class="nav-link" href="{% url 'tag_list' %}">{{user.get_username}}'s Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'blog_search_list_view' %}">Suche</a>
|
||||
<a class="nav-link" href="{% url 'search_add' %}">Suche</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
<div class="content container">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="col-md-12">
|
||||
{% block content %} {% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
{% extends 'base.html' %}{% block content %}
|
||||
{% load hitcount_tags %}
|
||||
<div class="post">
|
||||
|
||||
{% if post.published_date %}
|
||||
<div class="date">
|
||||
{{ post.published_date }}
|
||||
<div class="col-md-8">
|
||||
<div class="post">
|
||||
{% if post.published_date %}
|
||||
<div class="date">
|
||||
{{ post.published_date }}
|
||||
</div>
|
||||
{% else %}
|
||||
<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">Bearbeiten</span>
|
||||
</a>
|
||||
<a class="btn btn-outline-dark" href="{% url 'post_remove' pk=post.pk %}">
|
||||
<span class="glyphicon glyphicon-remove">Löschen</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
<h1>{{ post.title }}</h1>
|
||||
<p>{{ post.text|linebreaksbr }}</p>
|
||||
<p>
|
||||
Tags:
|
||||
{% for tag in post.tags.all %}
|
||||
<a href="{% url 'search_add' %}">{{ tag.name }} </a>
|
||||
{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
Autor: {{ post.author }}
|
||||
</p>
|
||||
{% if user.is_staff %}
|
||||
<p>
|
||||
{% get_hit_count for post %} Benutzer haben diesen Post bereits gelesen!
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<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">Bearbeiten</span>
|
||||
</a>
|
||||
<a class="btn btn-outline-dark" href="{% url 'post_remove' pk=post.pk %}">
|
||||
<span class="glyphicon glyphicon-remove">Löschen</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
<h1>{{ post.title }}</h1>
|
||||
<p>{{ post.text|linebreaksbr }}</p>
|
||||
<p>
|
||||
Tags:
|
||||
{% for tag in post.tags.all %}
|
||||
<a href="{% url 'blog_search_list_view' %}">{{ tag.name }} </a>
|
||||
{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
Autor: {{ post.author }}
|
||||
</p>
|
||||
{% if user.is_staff %}
|
||||
<p>
|
||||
{% get_hit_count for post %} Benutzer haben diesen Post bereits gelesen!
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,11 +1,17 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% for post in posts %}
|
||||
<div class="post">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h1> Unveröffentliche Artikel<br>
|
||||
</h1>
|
||||
{% for post in posts %}
|
||||
<div class="post mt-5">
|
||||
<p class="date">created: {{ post.created_date|date:'d-m-Y' }}</p>
|
||||
<h1><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h1>
|
||||
<p>{{ post.text|truncatechars:200 }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
@@ -1,9 +1,13 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Artikel-Editor</h1>
|
||||
<form method="POST" class="post-form">{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="mx-auto">
|
||||
<h1>Artikel-Editor</h1>
|
||||
<form method="POST" class="mt-5 post-form">{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="save btn btn-outline-dark">Sichern</button>
|
||||
</form>
|
||||
<button type="submit" class="save btn btn-outline-dark">Sichern</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,20 +1,34 @@
|
||||
{% 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 %}
|
||||
{% extends 'base.html' %} {% block content %}
|
||||
<div class="row">
|
||||
|
||||
|
||||
{% if tag %} <div class="mx-auto">
|
||||
<h2> Artikel mit dem Tag "{{ tag.name }}" </h2>
|
||||
</div>{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="mx-auto">
|
||||
<h1> Artikleübersicht </h1>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
{% 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="mt-5 post">
|
||||
<div class="date">
|
||||
{{ post.published_date }}
|
||||
</div>
|
||||
<h1>
|
||||
<h2>
|
||||
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
|
||||
</h1>
|
||||
</h2>
|
||||
<p>{{ post.text|linebreaks }}</p>
|
||||
Tags: {% for tag in post.tags.all %}
|
||||
<a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
|
||||
@@ -22,6 +36,7 @@
|
||||
{{ post.author }}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
+15
-10
@@ -2,10 +2,11 @@
|
||||
{% load taggit_templatetags2_tags %}
|
||||
<div class="container-fluid">
|
||||
<div class="modal-body row">
|
||||
<div class="col-md-8">
|
||||
<p> Alle Tags im Überblick<br>
|
||||
</p>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-6">
|
||||
<h1> Alle Tags im Überblick<br>
|
||||
</h1>
|
||||
<div class="col-md-10">
|
||||
|
||||
<div style="border:solid; text-align:center;padding:5px;">
|
||||
{% get_tagcloud as tags for 'application' %}
|
||||
{% include_tagcloud 'application.Post' %}
|
||||
@@ -43,28 +44,32 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<p> Bereits abonnierten Tags
|
||||
</p>
|
||||
<div class="col-md-6">
|
||||
<h1> Bereits abonnierten Tags
|
||||
</h1>
|
||||
<div class="col-md-10">
|
||||
{% if tags %}
|
||||
{% if tags %}
|
||||
<div style="border:solid; text-align:center;padding:5px;">
|
||||
{% for tag in tagsuser %}
|
||||
{{ tag.name }}
|
||||
{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="padding-bottom:40px;">
|
||||
</div>
|
||||
Abonniere deine Tags hier!
|
||||
<div>
|
||||
Abonniere deine Tags hier!
|
||||
</div>
|
||||
<form class="post-form" method="post">
|
||||
{% csrf_token %} {{form.as_p}}
|
||||
<button type="submit" class="save btn btn-outline-dark">Sichern</button>
|
||||
</form>
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
{% extends "base.html" %} {% block content %} {% load taggit_templatetags2_tags %}
|
||||
{% get_taglist as tags for 'application.post'%}
|
||||
|
||||
<div>
|
||||
<form class="post-form" method="post">
|
||||
{% csrf_token %} {{form.as_p}}
|
||||
<button type="submit" class="save btn btn-outline-dark">Save</button>
|
||||
</form>
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -1,28 +1,36 @@
|
||||
{% extends "base.html" %} {% block content %}
|
||||
{% load taggit_templatetags2_tags %}
|
||||
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<a id="search_submit" href="/posts" class="save btn btn-outline-dark">alle Artikel
|
||||
</a>
|
||||
|
||||
{% for post in posts %}
|
||||
<div class="post">
|
||||
<div class="date">
|
||||
{{ post.published_date }}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="mx-auto">
|
||||
<h1>
|
||||
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
|
||||
Dein Newsfeed ...
|
||||
</h1>
|
||||
<p>{{ post.text|linebreaks }}</p>
|
||||
Tags: {% for tag in post.tags.all %}
|
||||
<a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
|
||||
{% if not forloop.last %}, {% endif %} {% endfor %} <p>
|
||||
{{ post.author }}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div>
|
||||
{% for post in posts %}
|
||||
<div class="mt-5 post">
|
||||
<div class="date">
|
||||
{{ post.published_date }}
|
||||
</div>
|
||||
<h2>
|
||||
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a>
|
||||
</h2>
|
||||
<p>{{ post.text|linebreaks }}</p>
|
||||
Tags: {% for tag in post.tags.all %}
|
||||
<a href="{% url 'post_list_by_tag' tag.slug %}">{{ tag.name }}</a>
|
||||
{% if not forloop.last %}, {% endif %} {% endfor %} <p>
|
||||
{{ post.author }}
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 col-md-4">
|
||||
|
||||
<a id="search_submit" href="/posts" class="save btn btn-outline-dark">alle Artikel
|
||||
</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
+2
-2
@@ -11,8 +11,8 @@ urlpatterns = [
|
||||
url(r'^$', views.tag_list, name='tag_list'),
|
||||
url(r'^tag/(?P<slug>[-\w]+)/$', views.post_list, name='post_list_by_tag'),
|
||||
url(r'^posts/$', views.post_list, name='post_list'),
|
||||
url(r'^search/', views.blog_search_list_view, name='blog_search_list_view'),
|
||||
url(r'^search/result/$', views.blog_search_list_view, name='post_list_by_search'),
|
||||
url(r'^search/', views.search_add, name='search_add'),
|
||||
url(r'^search/result/$', views.search_add, name='post_list_by_search'),
|
||||
url(r'^post/(?P<pk>\d+)/$', views.post_detail, name='post_detail'),
|
||||
url(r'^post/new/$', views.post_new, name='post_new'),
|
||||
url(r'^post/(?P<pk>\d+)/edit/$', views.post_edit, name='post_edit'),
|
||||
|
||||
+2
-10
@@ -148,32 +148,24 @@ def tag_list(request):
|
||||
log.info(posts)
|
||||
return render(request, 'tag_list.html', locals())
|
||||
|
||||
def blog_search_list_view(request):
|
||||
log = logging.getLogger('mysite')
|
||||
def search_add(request):
|
||||
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
|
||||
if request.method == 'GET':
|
||||
search_query = request.GET.get('search_box', None)
|
||||
log.info(search_query)
|
||||
posts = posts.filter(tags__name__in=[search_query])
|
||||
log = logging.getLogger('mysite')
|
||||
u = User.objects.get(username=request.user)
|
||||
if u:
|
||||
tagsuser = Tag.objects.filter(customuser__user = u)
|
||||
user_instance = get_object_or_404(CustomUser, user=request.user)
|
||||
if request.method == "POST":
|
||||
log.info('post method')
|
||||
form = NewTagForm(request.POST, instance=user_instance)
|
||||
if form.is_valid():
|
||||
log.info('form is valid')
|
||||
obj = form.save(commit=False)
|
||||
obj.user = request.user
|
||||
tag_names = [tag.name for tag in Tag.objects.all()]
|
||||
log.info(tag_names)
|
||||
m_tags = form.cleaned_data['tags']
|
||||
m_tags = ' '.join(str(m_tags) for m_tags in m_tags)
|
||||
log.info(m_tags)
|
||||
if m_tags in tag_names:
|
||||
log.info('worked out')
|
||||
obj.tags.add(m_tags)
|
||||
obj.save()
|
||||
messages.info(request, 'Der Tag "' + m_tags + '" wurde gespeichert')
|
||||
@@ -182,7 +174,7 @@ def blog_search_list_view(request):
|
||||
messages.info(request, 'Sorry !! Den Tag den du suchst gibt es leider nicht!')
|
||||
else:
|
||||
form = NewTagForm()
|
||||
return render(request, 'blog_search_list_view.html', locals())
|
||||
return render(request, 'search_add.html', locals())
|
||||
|
||||
mail.send(
|
||||
'kleinhenz.e@gmail.com', # List of email addresses also accepted
|
||||
|
||||
Reference in New Issue
Block a user