Basic user permissions for user editing

This commit is contained in:
Skia
2015-11-19 16:28:49 +01:00
parent d3896ad676
commit 7a65215bb5
6 changed files with 89 additions and 8 deletions

View File

@ -8,11 +8,12 @@
<body>
<header>
{% block header %}
{% if user %}Hello, {{ user.username }}!{% endif %}
{% if user.is_authenticated %}Hello, {{ user.username }}!{% endif %}
<ul>
<li><a href="{% url 'core:register' %}">Register</a></li>
<li><a href="{% url 'core:login' %}">Login</a></li>
<li><a href="{% url 'core:logout' %}">Logout</a></li>
<li><a href="{% url 'core:user_list' %}">Users</a></li>
</ul>
{% endblock %}
</header>

View File

@ -0,0 +1,15 @@
{% extends "core/base.html" %}
{% block title %}
{% if profile %}
Edit {{ profile.get_display_name }}
{% endif %}
{% endblock %}
{% block content %}
{% if profile %}
<h3>Edit user</h3>
<p><a href="{% url 'core:user_profile' profile.id %}">Back to profile</a></p>
<p>You're editing the profile of <strong>{{ profile.get_display_name }}</strong></p>
{% endif %}
{% endblock %}

View File

@ -13,6 +13,9 @@ User list
{% if profile %}
<h3>User Profile</h3>
<p><a href="{% url 'core:user_list' %}">Back to list</a></p>
{% if user.is_superuser or user.id == profile.id %}
<p><a href="{% url 'core:user_edit' profile.id %}">Edit</a></p>
{% endif %}
<p>You're seeing the profile of <strong>{{ profile.get_display_name }}</strong></p>
{% endif %}