Solution of 07
This commit is contained in:
+13
-1
@@ -17,7 +17,7 @@
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/posts">Posts</a>
|
||||
</li>
|
||||
@@ -28,6 +28,18 @@
|
||||
<a class="nav-link" href="https://www.google.com/">Google</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
{% if request.user.is_authenticated %}
|
||||
<span class="navbar-text"> Willkommen {{ request.user.username }}! </span>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'logout' %}?next=/posts">Abmelden</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'login' %}?next=/posts">Anmelden</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
{% block content %} {% endblock %}
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
<div class="jumbotron">
|
||||
<h1 class="display-6">{{ notice.notice_title }}</h1>
|
||||
<p class="lead">{{notice.notice_text}}</p>
|
||||
<p><a href="{% url 'delete' notice.id %}" class="btn btn-info" role="button">Nachricht löschen</a></p>
|
||||
{% if user.is_staff %}
|
||||
<p><a href="{% url 'delete' notice.id %}" class="btn btn-info" role="button">Nachricht löschen</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<p><a href="{% url 'new' %}" class="btn btn-info" role="button">Neue Nachricht</a></p>
|
||||
{% if user.is_authenticated %}
|
||||
<p><a href="{% url 'new' %}" class="btn btn-info" role="button">Neue Nachricht</a></p>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %} Login {% endblock %}
|
||||
{% block content %}
|
||||
<div class="container"><form method="post" action="{% url 'login' %}">
|
||||
{% csrf_token %}
|
||||
Benutzername: {{ form.username }}
|
||||
<br>Passwort: {{ form.password }} <br>
|
||||
<button type="submit" class="btn btn-default">Anmelden</button>
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user