mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 02:24:26 +00:00
WIP: Move to Jinja2
This commit is contained in:
parent
abb8dc0c5e
commit
03bc0973fe
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
{% load staticfiles %}
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
{% block head %}
|
|
||||||
<title>{% block title %}Bienvenue sur le Sith de l'AE!{% endblock %}</title>
|
|
||||||
<link rel="stylesheet" href="{% static 'core/style.css' %}">
|
|
||||||
<script src="{% static 'core/script.js' %}"></script>
|
|
||||||
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
|
|
||||||
{% endblock %}
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
{% block header %}
|
|
||||||
{% if user.is_authenticated %}Hello, {{ user.username }}!{% endif %}
|
|
||||||
<ul>
|
|
||||||
{% if not user.is_authenticated %}
|
|
||||||
<li><a href="{% url 'core:register' %}">Register</a></li>
|
|
||||||
<li><a href="{% url 'core:login' %}">Login</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li><a href="{% url 'core:logout' %}">Logout</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% if user.is_authenticated %}
|
|
||||||
<ul>
|
|
||||||
<li><a href="{% url 'core:user_profile' user.id %}">Profile</a></li>
|
|
||||||
<li><a href="{% url 'core:user_list' %}">Users</a></li>
|
|
||||||
<li><a href="{% url 'core:page_list' %}">Pages</a></li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div id="content">
|
|
||||||
{% if error %}
|
|
||||||
{{ error }}
|
|
||||||
{% endif %}
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
{% block footer %}
|
|
||||||
Site réalisé par des gens biens
|
|
||||||
{% endblock %}
|
|
||||||
</footer>
|
|
||||||
<!--
|
|
||||||
{% block tests %}
|
|
||||||
{{ tests }}
|
|
||||||
{% endblock %}
|
|
||||||
-->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
47
core/templates/core/base.jinja
Normal file
47
core/templates/core/base.jinja
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
{% block head %}
|
||||||
|
<title>{% block title %}Bienvenue sur le Sith de l'AE!{% endblock %}</title>
|
||||||
|
<link rel="stylesheet" href="{{ static('core/style.css') }}">
|
||||||
|
<script src="{{ static('core/script.js') }}"></script>
|
||||||
|
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
{% block header %}
|
||||||
|
{% if user.is_authenticated() %}Hello, {{ user.username }}!{% endif %}
|
||||||
|
<ul>
|
||||||
|
{% if not user.is_authenticated() %}
|
||||||
|
<li><a href="{{ url('core:register') }}">Register</a></li>
|
||||||
|
<li><a href="{{ url('core:login') }}">Login</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li><a href="{{ url('core:logout') }}">Logout</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% if user.is_authenticated() %}
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ url('core:user_profile', user_id=user.id) }}">Profile</a></li>
|
||||||
|
<li><a href="{{ url('core:user_list') }}">Users</a></li>
|
||||||
|
<li><a href="{{ url('core:page_list') }}">Pages</a></li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
{% if error %}
|
||||||
|
{{ error }}
|
||||||
|
{% endif %}
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
{% block footer %}
|
||||||
|
Site réalisé par des gens biens
|
||||||
|
{% endblock %}
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if profile %}
|
{% if profile %}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p><a href="{% url 'core:group_list' %}">Back to list</a></p>
|
<p><a href="{{ url('core:group_list') }}">Back to list</a></p>
|
||||||
<h2>Edit group</h2>
|
<h2>Edit group</h2>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{{ csrf_input }}
|
||||||
{{ form.as_p }}
|
{{ form.as_p() }}
|
||||||
<p><input type="submit" value="Update" /></p>
|
<p><input type="submit" value="Update" /></p>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Group list
|
Group list
|
||||||
@ -8,7 +8,7 @@ Group list
|
|||||||
<h3>Group list</h3>
|
<h3>Group list</h3>
|
||||||
<ul>
|
<ul>
|
||||||
{% for g in group_list %}
|
{% for g in group_list %}
|
||||||
<li><a href="{% url 'core:group_edit' g.id %}">{{ g.name }}</a></li>
|
<li><a href="{{ url('core:group_edit', kwargs={'group_id': g.id} }}">{{ g.name }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
{% extends "core/base.html" %}
|
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
Hello, world. You're at the core index.
|
|
||||||
{% endblock %}
|
|
7
core/templates/core/index.jinja
Normal file
7
core/templates/core/index.jinja
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
Hello, world. You're at the core index using Jinja2.
|
||||||
|
{% endblock %}
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if next %}
|
{% if next %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated() %}
|
||||||
<p>Your account doesn't have access to this page. To proceed,
|
<p>Your account doesn't have access to this page. To proceed,
|
||||||
please login with an account that has access.</p>
|
please login with an account that has access.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -15,15 +15,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form method="post" action="{% url 'core:login' %}">
|
<form method="post" action="{{ url('core:login') }}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ form.username.label_tag }}</td>
|
<td>{{ form.username.label_tag() }}</td>
|
||||||
<td>{{ form.username }}</td>
|
<td>{{ form.username }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ form.password.label_tag }}</td>
|
<td>{{ form.password.label_tag() }}</td>
|
||||||
<td>{{ form.password }}</td>
|
<td>{{ form.password }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -33,6 +33,6 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
{# Assumes you setup the password_reset view in your URLconf #}
|
{# Assumes you setup the password_reset view in your URLconf #}
|
||||||
<p><a href="{% url 'core:password_reset' %}">Lost password?</a></p>
|
<p><a href="{{ url('core:password_reset') }}">Lost password?</a></p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,8 +1,8 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if page %}
|
{% if page %}
|
||||||
{{ page.get_display_name }}
|
{{ page.get_display_name() }}
|
||||||
{% elif page_list %}
|
{% elif page_list %}
|
||||||
Page list
|
Page list
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -16,6 +16,6 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2>Page does not exist</h2>
|
<h2>Page does not exist</h2>
|
||||||
<p><a href="{% url 'core:page_prop' new_page %}">Create it?</a></p>
|
<p><a href="{{ url('core:page_prop', page_name=new_page) }}">Create it?</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,26 +0,0 @@
|
|||||||
{% extends "core/page.html" %}
|
|
||||||
{% load renderer %}
|
|
||||||
|
|
||||||
{% block page %}
|
|
||||||
<h3>Page</h3>
|
|
||||||
<p><a href="{% url 'core:page_list' %}">Back to list</a></p>
|
|
||||||
{% if can_edit %}
|
|
||||||
<p><a href="{% url 'core:page_edit' page.get_full_name %}">Edit</a></p>
|
|
||||||
{% endif %}
|
|
||||||
{% if can_edit_prop %}
|
|
||||||
<p><a href="{% url 'core:page_prop' page.get_full_name %}">Prop</a></p>
|
|
||||||
{% endif %}
|
|
||||||
<p>You're seeing the page <strong>{{ page.get_display_name }}</strong> -
|
|
||||||
<a href="{% url 'core:page_hist' page.get_full_name %}">History</a></p>
|
|
||||||
{% if rev %}
|
|
||||||
<h4>This may not be the last update, you are seeing revision {{ rev.id }}!</h4>
|
|
||||||
<h3>{{ rev.title }}</h3>
|
|
||||||
<p>{{ rev.content|markdown }}</p>
|
|
||||||
{% else %}
|
|
||||||
<h3>{{ page.revisions.last.title }}</h3>
|
|
||||||
<p>{{ page.revisions.last.content|markdown }}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
25
core/templates/core/page_detail.jinja
Normal file
25
core/templates/core/page_detail.jinja
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "core/page.jinja" %}
|
||||||
|
|
||||||
|
{% block page %}
|
||||||
|
<h3>Page</h3>
|
||||||
|
<p><a href="{{ url('core:page_list') }}">Back to list</a></p>
|
||||||
|
{% if can_edit %}
|
||||||
|
<p><a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">Edit</a></p>
|
||||||
|
{% endif %}
|
||||||
|
{% if can_edit_prop %}
|
||||||
|
<p><a href="{{ url('core:page_prop', page_name=page.get_full_name()) }}">Prop</a></p>
|
||||||
|
{% endif %}
|
||||||
|
<p>You're seeing the page <strong>{{ page.get_display_name() }}</strong> -
|
||||||
|
<a href="{{ url('core:page_hist', page_name=page.get_full_name()) }}">History</a></p>
|
||||||
|
{% if rev %}
|
||||||
|
<h4>This may not be the last update, you are seeing revision {{ rev.id }}!</h4>
|
||||||
|
<h3>{{ rev.title }}</h3>
|
||||||
|
<p>{{ rev.content|markdown }}</p>
|
||||||
|
{% else %}
|
||||||
|
<h3>{{ page.revisions.last().title }}</h3>
|
||||||
|
<p>{{ page.revisions.last().content|markdown }}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
{% extends "core/page.html" %}
|
|
||||||
|
|
||||||
{% block page %}
|
|
||||||
<h3>Page history</h3>
|
|
||||||
<p><a href="{% url 'core:page' page.get_full_name %}">Back to page</a></p>
|
|
||||||
<p>You're seeing the history of page <strong>{{ page.get_display_name }}</strong></p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="{% url 'core:page' page_name=page.get_full_name %}">
|
|
||||||
last - {{ page.revisions.last.author }} - {{ page.revisions.last.date }}</a></li>
|
|
||||||
{% for r in page.revisions.all|dictsortreversed:'date'|slice:'1:' %}
|
|
||||||
<li><a href="{% url 'core:page_rev' page_name=page.get_full_name rev=r.id %}">
|
|
||||||
{{ r.author }} - {{ r.date }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
19
core/templates/core/page_hist.jinja
Normal file
19
core/templates/core/page_hist.jinja
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{% extends "core/page.jinja" %}
|
||||||
|
|
||||||
|
{% block page %}
|
||||||
|
<h3>Page history</h3>
|
||||||
|
<p><a href="{{ url('core:page', page.get_full_name()) }}">Back to page</a></p>
|
||||||
|
<p>You're seeing the history of page <strong>{{ page.get_display_name() }}</strong></p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ url('core:page', page_name=page.get_full_name()) }}">
|
||||||
|
last - {{ page.revisions.last().author }} - {{ page.revisions.last().date|date('Y-m-d H:i') }}</a></li>
|
||||||
|
{% for r in (page.revisions.all()|sort(attribute='date', reverse=True))[1:] %}
|
||||||
|
<li><a href="{{ url('core:page_rev', page_name=page.get_full_name(), rev=r['id']) }}">
|
||||||
|
{{ r['author'] }} - {{ r['date']|date('Y-m-d H:i') }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Page list
|
Page list
|
||||||
@ -9,7 +9,7 @@
|
|||||||
<h3>Page list</h3>
|
<h3>Page list</h3>
|
||||||
<ul>
|
<ul>
|
||||||
{% for p in page_list %}
|
{% for p in page_list %}
|
||||||
<li><a href="{% url 'core:page' p.get_full_name %}">{{ p.get_display_name }}</a></li>
|
<li><a href="{{ url('core:page', page_name=p.get_full_name()) }}">{{ p.get_display_name() }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
@ -1,10 +1,10 @@
|
|||||||
{% extends "core/page.html" %}
|
{% extends "core/page.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Page properties</h2>
|
<h2>Page properties</h2>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p() }}
|
||||||
<p><input type="submit" value="Save!" /></p>
|
<p><input type="submit" value="Save!" /></p>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,11 +1,11 @@
|
|||||||
{% extends "core/page.html" %}
|
{% extends "core/page.jinja" %}
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ block.super }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
function make_preview() {
|
function make_preview() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'core:api_markdown' %}",
|
url: "{{ url('core:api_markdown') }}",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
data: { text: $("#id_content").val() }
|
data: { text: $("#id_content").val() }
|
||||||
}).done(function (msg) {
|
}).done(function (msg) {
|
||||||
@ -17,9 +17,9 @@ function make_preview() {
|
|||||||
|
|
||||||
{% block page %}
|
{% block page %}
|
||||||
<h2>Edit page</h2>
|
<h2>Edit page</h2>
|
||||||
<form action="{% url 'core:page_edit' page_name=page.get_full_name %}" method="post">
|
<form action="{{ url('core:page_edit', page_name=page.get_full_name()) }}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p() }}
|
||||||
<p><input type="button" value="Preview" onclick="javascript:make_preview();" /></p>
|
<p><input type="button" value="Preview" onclick="javascript:make_preview();" /></p>
|
||||||
<p><input type="submit" value="Save!" /></p>
|
<p><input type="submit" value="Save!" /></p>
|
||||||
</form>
|
</form>
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>You successfully reset your password!</p>
|
<p>You successfully reset your password!</p>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Password reset sent</h2>
|
<h2>Password reset sent</h2>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
{% 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>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
{% if user.id == profile.id %}
|
|
||||||
<li><a href="{% url 'core:user_tools' %}">Tools</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if perms.core.change_user or user.id == profile.id %}
|
|
||||||
<li><a href="{% url 'core:user_edit' profile.id %}">Edit</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if perms.core.change_prop_user %}
|
|
||||||
<li><a href="{% url 'core:user_prop' profile.id %}">Props</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<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 %}
|
|
||||||
|
|
||||||
|
|
31
core/templates/core/user_detail.jinja
Normal file
31
core/templates/core/user_detail.jinja
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% 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>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{% if request.user.id == profile.id %}
|
||||||
|
<li><a href="{{ url('core:user_tools') }}">Tools</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if user.has_perms('core.change_user') or user.id == profile.id %}
|
||||||
|
<li><a href="{{ url('core:user_edit', user_id=profile.id) }}">Edit</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if user.has_perms('core.change_prop_user') %}
|
||||||
|
<li><a href="{{ url('core:user_prop', user_id=profile.id) }}">Props</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<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 %}
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Edit user profile</h2>
|
<h2>Edit user profile</h2>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p() }}
|
||||||
<p><input type="submit" value="Update" /></p>
|
<p><input type="submit" value="Update" /></p>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
User list
|
User list
|
||||||
@ -8,7 +8,7 @@ User list
|
|||||||
<h3>User list</h3>
|
<h3>User list</h3>
|
||||||
<ul>
|
<ul>
|
||||||
{% for u in user_list %}
|
{% for u in user_list %}
|
||||||
<li><a href="{% url 'core:user_profile' u.id %}">{{ u.get_display_name }}</a></li>
|
<li><a href="{{ url('core:user_profile', user_id=u.id) }}">{{ u.get_display_name() }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,10 +1,10 @@
|
|||||||
{% extends "core/base.html" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Edit user groups</h2>
|
<h2>Edit user groups for {{ profile.get_full_name() }}</h2>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p() }}
|
||||||
<p><input type="submit" value="Update" /></p>
|
<p><input type="submit" value="Update" /></p>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,20 +0,0 @@
|
|||||||
{% extends "core/base.html" %}
|
|
||||||
|
|
||||||
{% block title %}
|
|
||||||
{{ user.get_display_name }}'s tools
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<h3>User Tools</h3>
|
|
||||||
<p><a href="{% url 'core:user_profile' user.id %}">Back to profile</a></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
{% if perms.core.add_group %}
|
|
||||||
<li><a href="{% url 'core:group_list' %}">Groups</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
core/templates/core/user_tools.jinja
Normal file
20
core/templates/core/user_tools.jinja
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ user.get_display_name() }}'s tools
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h3>User Tools</h3>
|
||||||
|
<p><a href="{{ url('core:user_profile', user_id=request.user.id) }}">Back to profile</a></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{% if user.has_perms('core.add_group') %}
|
||||||
|
<li><a href="{{ url('core:group_list') }}">Groups</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7,10 +7,10 @@ from django.views.generic.base import View
|
|||||||
from core.models import Group
|
from core.models import Group
|
||||||
|
|
||||||
def forbidden(request):
|
def forbidden(request):
|
||||||
return render(request, "core/403.html")
|
return render(request, "core/403.jinja")
|
||||||
|
|
||||||
def not_found(request):
|
def not_found(request):
|
||||||
return render(request, "core/404.html")
|
return render(request, "core/404.jinja")
|
||||||
|
|
||||||
|
|
||||||
class CanEditPropMixin(View):
|
class CanEditPropMixin(View):
|
||||||
|
@ -11,6 +11,7 @@ from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
|||||||
|
|
||||||
class PageListView(ListView):
|
class PageListView(ListView):
|
||||||
model = Page
|
model = Page
|
||||||
|
template_name = 'core/page_list.jinja'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(PageListView, self).get_context_data(**kwargs)
|
context = super(PageListView, self).get_context_data(**kwargs)
|
||||||
@ -18,6 +19,7 @@ class PageListView(ListView):
|
|||||||
|
|
||||||
class PageView(CanViewMixin, DetailView):
|
class PageView(CanViewMixin, DetailView):
|
||||||
model = Page
|
model = Page
|
||||||
|
template_name = 'core/page_detail.jinja'
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||||
@ -36,7 +38,7 @@ class PageView(CanViewMixin, DetailView):
|
|||||||
|
|
||||||
class PageHistView(CanViewMixin, DetailView):
|
class PageHistView(CanViewMixin, DetailView):
|
||||||
model = Page
|
model = Page
|
||||||
template_name_suffix = '_hist'
|
template_name = 'core/page_hist.jinja'
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||||
@ -44,7 +46,7 @@ class PageHistView(CanViewMixin, DetailView):
|
|||||||
|
|
||||||
class PageRevView(CanViewMixin, DetailView):
|
class PageRevView(CanViewMixin, DetailView):
|
||||||
model = Page
|
model = Page
|
||||||
template_name = 'core/page_detail.html'
|
template_name = 'core/page_detail.jinja'
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||||
@ -67,7 +69,7 @@ class PageRevView(CanViewMixin, DetailView):
|
|||||||
class PagePropView(CanEditPropMixin, UpdateView):
|
class PagePropView(CanEditPropMixin, UpdateView):
|
||||||
model = Page
|
model = Page
|
||||||
form_class = PagePropForm
|
form_class = PagePropForm
|
||||||
template_name_suffix = '_prop'
|
template_name = 'core/page_prop.jinja'
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
page_name = self.kwargs['page_name']
|
page_name = self.kwargs['page_name']
|
||||||
@ -97,7 +99,7 @@ class PagePropView(CanEditPropMixin, UpdateView):
|
|||||||
class PageEditView(CanEditMixin, UpdateView):
|
class PageEditView(CanEditMixin, UpdateView):
|
||||||
model = PageRev
|
model = PageRev
|
||||||
fields = ['title', 'content',]
|
fields = ['title', 'content',]
|
||||||
template_name_suffix = '_edit'
|
template_name = 'core/pagerev_edit.jinja'
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||||
|
@ -4,7 +4,7 @@ from django.db import models
|
|||||||
|
|
||||||
def index(request, context=None):
|
def index(request, context=None):
|
||||||
if context == None:
|
if context == None:
|
||||||
return render(request, "core/index.html", {'title': 'Bienvenue!'})
|
return render(request, "core/index.jinja", {'title': 'Bienvenue!'})
|
||||||
else:
|
else:
|
||||||
return render(request, "core/index.html", context)
|
return render(request, "core/index.jinja", context)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ def login(request):
|
|||||||
|
|
||||||
Needs to be improve with correct handling of form exceptions
|
Needs to be improve with correct handling of form exceptions
|
||||||
"""
|
"""
|
||||||
return views.login(request, template_name="core/login.html")
|
return views.login(request, template_name="core/login.jinja")
|
||||||
|
|
||||||
def logout(request):
|
def logout(request):
|
||||||
"""
|
"""
|
||||||
@ -28,21 +28,21 @@ def password_change(request):
|
|||||||
"""
|
"""
|
||||||
Allows a user to change its password
|
Allows a user to change its password
|
||||||
"""
|
"""
|
||||||
return views.password_change(request, template_name="core/password_change.html", post_change_redirect=reverse("core:password_change_done"))
|
return views.password_change(request, template_name="core/password_change.jinja", post_change_redirect=reverse("core:password_change_done"))
|
||||||
|
|
||||||
def password_change_done(request):
|
def password_change_done(request):
|
||||||
"""
|
"""
|
||||||
Allows a user to change its password
|
Allows a user to change its password
|
||||||
"""
|
"""
|
||||||
return views.password_change_done(request, template_name="core/password_change_done.html")
|
return views.password_change_done(request, template_name="core/password_change_done.jinja")
|
||||||
|
|
||||||
def password_reset(request):
|
def password_reset(request):
|
||||||
"""
|
"""
|
||||||
Allows someone to enter an email adresse for resetting password
|
Allows someone to enter an email adresse for resetting password
|
||||||
"""
|
"""
|
||||||
return views.password_reset(request,
|
return views.password_reset(request,
|
||||||
template_name="core/password_reset.html",
|
template_name="core/password_reset.jinja",
|
||||||
email_template_name="core/password_reset_email.html",
|
email_template_name="core/password_reset_email.jinja",
|
||||||
post_reset_redirect="core:password_reset_done",
|
post_reset_redirect="core:password_reset_done",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def password_reset_done(request):
|
|||||||
"""
|
"""
|
||||||
Confirm that the reset email has been sent
|
Confirm that the reset email has been sent
|
||||||
"""
|
"""
|
||||||
return views.password_reset_done(request, template_name="core/password_reset_done.html")
|
return views.password_reset_done(request, template_name="core/password_reset_done.jinja")
|
||||||
|
|
||||||
def password_reset_confirm(request, uidb64=None, token=None):
|
def password_reset_confirm(request, uidb64=None, token=None):
|
||||||
"""
|
"""
|
||||||
@ -58,7 +58,7 @@ def password_reset_confirm(request, uidb64=None, token=None):
|
|||||||
"""
|
"""
|
||||||
return views.password_reset_confirm(request, uidb64=uidb64, token=token,
|
return views.password_reset_confirm(request, uidb64=uidb64, token=token,
|
||||||
post_reset_redirect="core:password_reset_complete",
|
post_reset_redirect="core:password_reset_complete",
|
||||||
template_name="core/password_reset_confirm.html",
|
template_name="core/password_reset_confirm.jinja",
|
||||||
)
|
)
|
||||||
|
|
||||||
def password_reset_complete(request):
|
def password_reset_complete(request):
|
||||||
@ -66,7 +66,7 @@ def password_reset_complete(request):
|
|||||||
Confirm the password has sucessfully been reset
|
Confirm the password has sucessfully been reset
|
||||||
"""
|
"""
|
||||||
return views.password_reset_complete(request,
|
return views.password_reset_complete(request,
|
||||||
template_name="core/password_reset_complete.html",
|
template_name="core/password_reset_complete.jinja",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ def register(request):
|
|||||||
else:
|
else:
|
||||||
form = RegisteringForm()
|
form = RegisteringForm()
|
||||||
context['form'] = form.as_p()
|
context['form'] = form.as_p()
|
||||||
return render(request, "core/register.html", context)
|
return render(request, "core/register.jinja", context)
|
||||||
|
|
||||||
class UserView(CanViewMixin, DetailView):
|
class UserView(CanViewMixin, DetailView):
|
||||||
"""
|
"""
|
||||||
@ -95,12 +95,14 @@ class UserView(CanViewMixin, DetailView):
|
|||||||
model = User
|
model = User
|
||||||
pk_url_kwarg = "user_id"
|
pk_url_kwarg = "user_id"
|
||||||
context_object_name = "profile"
|
context_object_name = "profile"
|
||||||
|
template_name = "core/user_detail.jinja"
|
||||||
|
|
||||||
class UserListView(ListView):
|
class UserListView(ListView):
|
||||||
"""
|
"""
|
||||||
Displays the user list
|
Displays the user list
|
||||||
"""
|
"""
|
||||||
model = User
|
model = User
|
||||||
|
template_name = "core/user_list.jinja"
|
||||||
|
|
||||||
class UserUpdateProfileView(CanEditMixin, UpdateView):
|
class UserUpdateProfileView(CanEditMixin, UpdateView):
|
||||||
"""
|
"""
|
||||||
@ -108,7 +110,7 @@ class UserUpdateProfileView(CanEditMixin, UpdateView):
|
|||||||
"""
|
"""
|
||||||
model = User
|
model = User
|
||||||
pk_url_kwarg = "user_id"
|
pk_url_kwarg = "user_id"
|
||||||
template_name = "core/user_edit.html"
|
template_name = "core/user_edit.jinja"
|
||||||
fields = ('first_name', 'last_name', 'nick_name', 'email', 'date_of_birth', )
|
fields = ('first_name', 'last_name', 'nick_name', 'email', 'date_of_birth', )
|
||||||
|
|
||||||
class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
||||||
@ -117,11 +119,12 @@ class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
|||||||
"""
|
"""
|
||||||
model = User
|
model = User
|
||||||
pk_url_kwarg = "user_id"
|
pk_url_kwarg = "user_id"
|
||||||
template_name = "core/user_prop.html"
|
template_name = "core/user_prop.jinja"
|
||||||
form_class = UserPropForm
|
form_class = UserPropForm
|
||||||
|
context_object_name = "profile"
|
||||||
|
|
||||||
class UserToolsView(TemplateView):
|
class UserToolsView(TemplateView):
|
||||||
"""
|
"""
|
||||||
Displays the logged user's tools
|
Displays the logged user's tools
|
||||||
"""
|
"""
|
||||||
template_name = "core/user_tools.html"
|
template_name = "core/user_tools.jinja"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
# Django 1.8 LTS is required, version 1.9 is not supported
|
# Django 1.8 LTS is required, version 1.9 is not supported
|
||||||
Django >=1.8,<1.9
|
Django >=1.8,<1.9
|
||||||
Pillow
|
Pillow
|
||||||
|
django-jinja
|
||||||
|
@ -37,6 +37,7 @@ INSTALLED_APPS = (
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
'django_jinja',
|
||||||
'core',
|
'core',
|
||||||
'club',
|
'club',
|
||||||
'subscription',
|
'subscription',
|
||||||
@ -58,6 +59,50 @@ MIDDLEWARE_CLASSES = (
|
|||||||
ROOT_URLCONF = 'sith.urls'
|
ROOT_URLCONF = 'sith.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
"NAME": "jinja2",
|
||||||
|
"BACKEND": "django_jinja.backend.Jinja2",
|
||||||
|
"APP_DIRS": True,
|
||||||
|
"OPTIONS": {
|
||||||
|
# Match the template names ending in .html but not the ones in the admin folder.
|
||||||
|
"match_extension": ".jinja",
|
||||||
|
"app_dirname": "templates",
|
||||||
|
"newstyle_gettext": True,
|
||||||
|
"context_processors": [
|
||||||
|
"django.contrib.auth.context_processors.auth",
|
||||||
|
"django.template.context_processors.debug",
|
||||||
|
"django.template.context_processors.i18n",
|
||||||
|
"django.template.context_processors.media",
|
||||||
|
"django.template.context_processors.static",
|
||||||
|
"django.template.context_processors.tz",
|
||||||
|
"django.contrib.messages.context_processors.messages",
|
||||||
|
],
|
||||||
|
"extensions": [
|
||||||
|
"jinja2.ext.do",
|
||||||
|
"jinja2.ext.loopcontrols",
|
||||||
|
"jinja2.ext.with_",
|
||||||
|
"jinja2.ext.i18n",
|
||||||
|
"jinja2.ext.autoescape",
|
||||||
|
"django_jinja.builtins.extensions.CsrfExtension",
|
||||||
|
"django_jinja.builtins.extensions.CacheExtension",
|
||||||
|
"django_jinja.builtins.extensions.TimezoneExtension",
|
||||||
|
"django_jinja.builtins.extensions.UrlsExtension",
|
||||||
|
"django_jinja.builtins.extensions.StaticFilesExtension",
|
||||||
|
"django_jinja.builtins.extensions.DjangoFiltersExtension",
|
||||||
|
],
|
||||||
|
"filters": {
|
||||||
|
"markdown": "core.templatetags.renderer.markdown",
|
||||||
|
},
|
||||||
|
"bytecode_cache": {
|
||||||
|
"name": "default",
|
||||||
|
"backend": "django_jinja.cache.BytecodeCache",
|
||||||
|
"enabled": False,
|
||||||
|
},
|
||||||
|
"autoescape": True,
|
||||||
|
"auto_reload": DEBUG,
|
||||||
|
"translation_engine": "django.utils.translation",
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [],
|
'DIRS': [],
|
||||||
|
Loading…
Reference in New Issue
Block a user