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 %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% 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 %}
|
||||
{% if profile %}
|
||||
|
@ -1,11 +1,11 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% 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>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ csrf_input }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="Update" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
Group list
|
||||
@ -8,7 +8,7 @@ Group list
|
||||
<h3>Group list</h3>
|
||||
<ul>
|
||||
{% 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 %}
|
||||
</ul>
|
||||
{% 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 %}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
{% if user.is_authenticated() %}
|
||||
<p>Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.</p>
|
||||
{% else %}
|
||||
@ -15,15 +15,15 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url 'core:login' %}">
|
||||
<form method="post" action="{{ url('core:login') }}">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<tr>
|
||||
<td>{{ form.username.label_tag }}</td>
|
||||
<td>{{ form.username.label_tag() }}</td>
|
||||
<td>{{ form.username }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ form.password.label_tag }}</td>
|
||||
<td>{{ form.password.label_tag() }}</td>
|
||||
<td>{{ form.password }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -33,6 +33,6 @@
|
||||
</form>
|
||||
|
||||
{# 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 %}
|
@ -1,8 +1,8 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% if page %}
|
||||
{{ page.get_display_name }}
|
||||
{{ page.get_display_name() }}
|
||||
{% elif page_list %}
|
||||
Page list
|
||||
{% else %}
|
||||
@ -16,6 +16,6 @@
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
<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 %}
|
||||
{% 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 %}
|
||||
Page list
|
||||
@ -9,7 +9,7 @@
|
||||
<h3>Page list</h3>
|
||||
<ul>
|
||||
{% 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 %}
|
||||
</ul>
|
||||
{% else %}
|
@ -1,10 +1,10 @@
|
||||
{% extends "core/page.html" %}
|
||||
{% extends "core/page.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Page properties</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="Save!" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,11 +1,11 @@
|
||||
{% extends "core/page.html" %}
|
||||
{% extends "core/page.jinja" %}
|
||||
|
||||
{% block head %}
|
||||
{{ block.super }}
|
||||
{{ super() }}
|
||||
<script>
|
||||
function make_preview() {
|
||||
$.ajax({
|
||||
url: "{% url 'core:api_markdown' %}",
|
||||
url: "{{ url('core:api_markdown') }}",
|
||||
method: "GET",
|
||||
data: { text: $("#id_content").val() }
|
||||
}).done(function (msg) {
|
||||
@ -17,9 +17,9 @@ function make_preview() {
|
||||
|
||||
{% block page %}
|
||||
<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 %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="button" value="Preview" onclick="javascript:make_preview();" /></p>
|
||||
<p><input type="submit" value="Save!" /></p>
|
||||
</form>
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<p>You successfully reset your password!</p>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post" action="">
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Password reset sent</h2>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% 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 %}
|
||||
<h2>Edit user profile</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="Update" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
User list
|
||||
@ -8,7 +8,7 @@ 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>
|
||||
<li><a href="{{ url('core:user_profile', user_id=u.id) }}">{{ u.get_display_name() }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
@ -1,10 +1,10 @@
|
||||
{% extends "core/base.html" %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Edit user groups</h2>
|
||||
<h2>Edit user groups for {{ profile.get_full_name() }}</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="Update" /></p>
|
||||
</form>
|
||||
{% 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
|
||||
|
||||
def forbidden(request):
|
||||
return render(request, "core/403.html")
|
||||
return render(request, "core/403.jinja")
|
||||
|
||||
def not_found(request):
|
||||
return render(request, "core/404.html")
|
||||
return render(request, "core/404.jinja")
|
||||
|
||||
|
||||
class CanEditPropMixin(View):
|
||||
|
@ -11,6 +11,7 @@ from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
||||
|
||||
class PageListView(ListView):
|
||||
model = Page
|
||||
template_name = 'core/page_list.jinja'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(PageListView, self).get_context_data(**kwargs)
|
||||
@ -18,6 +19,7 @@ class PageListView(ListView):
|
||||
|
||||
class PageView(CanViewMixin, DetailView):
|
||||
model = Page
|
||||
template_name = 'core/page_detail.jinja'
|
||||
|
||||
def get_object(self):
|
||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||
@ -36,7 +38,7 @@ class PageView(CanViewMixin, DetailView):
|
||||
|
||||
class PageHistView(CanViewMixin, DetailView):
|
||||
model = Page
|
||||
template_name_suffix = '_hist'
|
||||
template_name = 'core/page_hist.jinja'
|
||||
|
||||
def get_object(self):
|
||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||
@ -44,7 +46,7 @@ class PageHistView(CanViewMixin, DetailView):
|
||||
|
||||
class PageRevView(CanViewMixin, DetailView):
|
||||
model = Page
|
||||
template_name = 'core/page_detail.html'
|
||||
template_name = 'core/page_detail.jinja'
|
||||
|
||||
def get_object(self):
|
||||
self.page = Page.get_page_by_full_name(self.kwargs['page_name'])
|
||||
@ -67,7 +69,7 @@ class PageRevView(CanViewMixin, DetailView):
|
||||
class PagePropView(CanEditPropMixin, UpdateView):
|
||||
model = Page
|
||||
form_class = PagePropForm
|
||||
template_name_suffix = '_prop'
|
||||
template_name = 'core/page_prop.jinja'
|
||||
|
||||
def get_object(self):
|
||||
page_name = self.kwargs['page_name']
|
||||
@ -97,7 +99,7 @@ class PagePropView(CanEditPropMixin, UpdateView):
|
||||
class PageEditView(CanEditMixin, UpdateView):
|
||||
model = PageRev
|
||||
fields = ['title', 'content',]
|
||||
template_name_suffix = '_edit'
|
||||
template_name = 'core/pagerev_edit.jinja'
|
||||
|
||||
def get_object(self):
|
||||
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):
|
||||
if context == None:
|
||||
return render(request, "core/index.html", {'title': 'Bienvenue!'})
|
||||
return render(request, "core/index.jinja", {'title': 'Bienvenue!'})
|
||||
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
|
||||
"""
|
||||
return views.login(request, template_name="core/login.html")
|
||||
return views.login(request, template_name="core/login.jinja")
|
||||
|
||||
def logout(request):
|
||||
"""
|
||||
@ -28,21 +28,21 @@ def password_change(request):
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
Allows someone to enter an email adresse for resetting password
|
||||
"""
|
||||
return views.password_reset(request,
|
||||
template_name="core/password_reset.html",
|
||||
email_template_name="core/password_reset_email.html",
|
||||
template_name="core/password_reset.jinja",
|
||||
email_template_name="core/password_reset_email.jinja",
|
||||
post_reset_redirect="core:password_reset_done",
|
||||
)
|
||||
|
||||
@ -50,7 +50,7 @@ def password_reset_done(request):
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
@ -58,7 +58,7 @@ def password_reset_confirm(request, uidb64=None, token=None):
|
||||
"""
|
||||
return views.password_reset_confirm(request, uidb64=uidb64, token=token,
|
||||
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):
|
||||
@ -66,7 +66,7 @@ def password_reset_complete(request):
|
||||
Confirm the password has sucessfully been reset
|
||||
"""
|
||||
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:
|
||||
form = RegisteringForm()
|
||||
context['form'] = form.as_p()
|
||||
return render(request, "core/register.html", context)
|
||||
return render(request, "core/register.jinja", context)
|
||||
|
||||
class UserView(CanViewMixin, DetailView):
|
||||
"""
|
||||
@ -95,12 +95,14 @@ class UserView(CanViewMixin, DetailView):
|
||||
model = User
|
||||
pk_url_kwarg = "user_id"
|
||||
context_object_name = "profile"
|
||||
template_name = "core/user_detail.jinja"
|
||||
|
||||
class UserListView(ListView):
|
||||
"""
|
||||
Displays the user list
|
||||
"""
|
||||
model = User
|
||||
template_name = "core/user_list.jinja"
|
||||
|
||||
class UserUpdateProfileView(CanEditMixin, UpdateView):
|
||||
"""
|
||||
@ -108,7 +110,7 @@ class UserUpdateProfileView(CanEditMixin, UpdateView):
|
||||
"""
|
||||
model = User
|
||||
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', )
|
||||
|
||||
class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
||||
@ -117,11 +119,12 @@ class UserUpdatePropView(CanEditPropMixin, UpdateView):
|
||||
"""
|
||||
model = User
|
||||
pk_url_kwarg = "user_id"
|
||||
template_name = "core/user_prop.html"
|
||||
template_name = "core/user_prop.jinja"
|
||||
form_class = UserPropForm
|
||||
context_object_name = "profile"
|
||||
|
||||
class UserToolsView(TemplateView):
|
||||
"""
|
||||
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,<1.9
|
||||
Pillow
|
||||
django-jinja
|
||||
|
@ -37,6 +37,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django_jinja',
|
||||
'core',
|
||||
'club',
|
||||
'subscription',
|
||||
@ -58,6 +59,50 @@ MIDDLEWARE_CLASSES = (
|
||||
ROOT_URLCONF = 'sith.urls'
|
||||
|
||||
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',
|
||||
'DIRS': [],
|
||||
|
Loading…
Reference in New Issue
Block a user