Skip to content

Commit

Permalink
Add log in/out message/links to example project.
Browse files Browse the repository at this point in the history
Fixes #222.
  • Loading branch information
dracos committed Dec 13, 2014
1 parent 88e78f8 commit dbd3ca2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions example_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),

url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'),

url(r'^', include('speeches.urls', app_name='speeches', namespace='speeches')),
)
13 changes: 12 additions & 1 deletion speeches/templates/speeches/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,22 @@
<div class="full-page__unit">
<h1><a href="{% url 'speeches:home' %}">SayIt</a></h1>

<ul class="inline-list">
<ul class="inline-list left">
<li><a href="{% url 'speeches:home' %}">{% trans 'Home' %}</a></li>
<li><a href="{% url 'speeches:speaker-list' %}">{% trans 'Speakers' %}</a></li>
<li><a href="{% url 'speeches:parentless-list' %}">{% trans 'Speeches' %}</a></li>
</ul>

<ul class="unstyled-list right">
{% if request.is_user_instance %}
<li>{% trans 'Welcome,' %} {% firstof user.get_short_name user.get_username %}.
<a href="{% url 'logout' %}">{% trans 'Log out' %}</a>
</li>
{% else %}
<li><a href="{% url 'login' %}">{% trans 'Log in' %}</a></li>
{% endif %}
</ul>

</div>
</div>
</header>
Expand Down

0 comments on commit dbd3ca2

Please sign in to comment.