Improve user views

This commit is contained in:
Skia
2015-11-26 16:32:56 +01:00
parent 385f91a9db
commit 48e3f88b87
10 changed files with 117 additions and 98 deletions

View File

@ -10,7 +10,7 @@
{% block header %}
{% if user.is_authenticated %}Hello, {{ user.username }}!{% endif %}
<ul>
<li><a href="">Register</a></li>
<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>

View File

@ -1,32 +0,0 @@
{% extends "core/base.html" %}
{% block title %}
{% if profile %}
{{ profile.get_display_name }}'s profile
{% endif %}
{% if user_list %}
User list
{% endif %}
{% endblock %}
{% block content %}
{% 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>
<p>{{ profile.nick_name }}</p>
{% endif %}
{% if user_list %}
<h3>User list</h3>
<ul>
{% for u in user_list %}
<li><a href="{% url 'core:user_profile' u.id %}">{{ u.get_display_name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends "core/base.html" %}
{% block title %}
{{ profile.get_display_name }}'s profile
{% endblock %}
{% block content %}
<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 %}
<ul>
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
<li><a href="{% url 'core:user_groups' profile.id %}">Groups</a></li>
</ul>
{% endif %}
<p>
You're seeing the profile of <strong>{{ profile.get_full_name }}</strong><br/>
<strong>{{ profile.nick_name }}</strong><br/>
<em>{{ profile.date_of_birth|date:"d/m/Y" }}</em>
</p>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% extends "core/base.html" %}
{% block content %}
<h2>Edit user profile</h2>
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
<p><input type="submit" value="Update" /></p>
</form>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% extends "core/base.html" %}
{% block content %}
<h2>Edit user groups</h2>
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
<p><input type="submit" value="Update" /></p>
</form>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends "core/base.html" %}
{% block title %}
User list
{% endblock %}
{% block content %}
<h3>User list</h3>
<ul>
{% for u in user_list %}
<li><a href="{% url 'core:user_profile' u.id %}">{{ u.get_display_name }}</a></li>
{% endfor %}
</ul>
{% endblock %}