Commit 4144377d authored by Amap's avatar Amap

Adapte django 1.10

parent 162e3fc2
<Files "settings_local.py">
order deny,allow
deny from all
allow from 127.0.0.1
</Files>
......@@ -25,7 +25,7 @@ PASSWORD_HASHERS = (
)
AUTH_USER_MODEL = 'users.User'
LOGIN_URL = '/login'
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
......@@ -72,7 +72,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'django.template.context_processors.request',
'amap.context_processors.context_user',
],
},
......
from django.shortcuts import render
from django.shortcuts import render_to_response, get_object_or_404
from django.core.context_processors import csrf
from django.template.context_processors import csrf
from django.template import Context, RequestContext, loader
from amap.settings import services_urls
def form(ctx, template, request):
c = ctx
c.update(csrf(request))
return render_to_response(template, c, context_instance=RequestContext(request))
return render(request, template, c)
def index(request):
......
......@@ -4,7 +4,7 @@
# Gplv2
from django.shortcuts import render_to_response, get_object_or_404, render, redirect
from django.core.context_processors import csrf
from django.template.context_processors import csrf
from django.template import Context, RequestContext, loader
from django.contrib import messages
from django.db import IntegrityError
......@@ -19,6 +19,8 @@ from .models import Panier, Paiement, Commande, Credit, Livraison
from .forms import PaiementForm, CreditForm, CreditFullForm, DelPaiementForm, LivraisonForm, SelectOneLivraisonForm, SelectLivraisonForm
from .forms import PanierForm, DelPanierForm, SelectArticleForm, FullEditCommandeForm, BaseEditCommandeForm, NewCommandeForm
from django.forms import modelformset_factory, formset_factory
from reversion.models import Version
from users.views import User
from django.utils import timezone
......@@ -28,10 +30,10 @@ from amap.settings import MINIMUM_LEVEL, PAGINATION_LARGE_NUMBER, PAGINATION_NUM
def form(ctx, template, request):
c = ctx
c.update(csrf(request))
return render_to_response(
return render(
request,
template,
c,
context_instance=RequestContext(request)
c
)
@login_required
......@@ -425,7 +427,7 @@ def history(request, object, id):
else:
messages.error(request, "Objet inconnu")
return redirect("/panier/")
reversions = reversion.get_for_object(object_instance)
reversions = Version.objects.get_for_object(object_instance)
paginator = Paginator(reversions, PAGINATION_NUMBER)
page = request.GET.get('page')
try:
......
......@@ -4,7 +4,7 @@
# Gplv2
from django.shortcuts import render
from django.shortcuts import render_to_response, get_object_or_404
from django.core.context_processors import csrf
from django.template.context_processors import csrf
from django.template import Context, RequestContext, loader
from django.contrib.auth.decorators import login_required
......@@ -19,7 +19,7 @@ from amap.settings import SEARCH_RESULT
def form(ctx, template, request):
c = ctx
c.update(csrf(request))
return render_to_response(template, c, context_instance=RequestContext(request))
return render(request, template, c)
def search_result(search, type, request):
date_deb = None
......
......@@ -8,7 +8,7 @@
<head>
{# Load CSS and JavaScript #}
{% bootstrap_css %}
<link rel="stylesheet" href="{% static "/static/css/base.css" %}">
<link rel="stylesheet" href="{% static "/css/base.css" %}">
{% bootstrap_javascript %}
<meta name="viewport" content="width=device-width, initial-scale=1">
......
......@@ -19,7 +19,7 @@
{% endif %}
{% endif %}
<p><form method="post" action="{% url 'django.contrib.auth.views.login' %}">
<p><form method="post" action="{% url 'login' %}">
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button "Login" button_type="submit" icon="log-in" %}
......
......@@ -3,7 +3,7 @@
# Goulven Kermarec, Gabriel Détraz
# Gplv2
from django.shortcuts import render_to_response, get_object_or_404, render, redirect
from django.core.context_processors import csrf
from django.template.context_processors import csrf
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template import Context, RequestContext, loader
from django.contrib import messages
......@@ -20,6 +20,8 @@ from users.models import User, Right, ListRight, Request
from users.models import DelRightForm, DelListRightForm, NewListRightForm
from users.models import EditInfoForm, BaseInfoForm, StateForm, RightForm, ListRightForm
from users.forms import PassForm, ResetPasswordForm
from reversion.models import Version
from panier.models import Commande, Credit
......@@ -29,10 +31,10 @@ from amap.settings import REQ_EXPIRE_STR, EMAIL_FROM, ASSO_NAME, ASSO_EMAIL, SIT
def form(ctx, template, request):
c = ctx
c.update(csrf(request))
return render_to_response(
return render(
request,
template,
c,
context_instance=RequestContext(request)
c
)
def password_change_action(u_form, user, request, req=False):
......@@ -268,7 +270,7 @@ def history(request, object, id):
else:
messages.error(request, "Objet inconnu")
return redirect("/users/")
reversions = reversion.get_for_object(object_instance)
reversions = Version.objects.get_for_object(object_instance)
paginator = Paginator(reversions, PAGINATION_NUMBER)
page = request.GET.get('page')
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment