Commit 9b142b30 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Modifications pour compatibilité avec stretch 1

parent d6149880
......@@ -2,8 +2,8 @@
# Goulven Kermarec, Gabriel Détraz
# Gplv2
from django.shortcuts import render, redirect
from django.shortcuts import render_to_response, get_object_or_404
from django.core.context_processors import csrf
from django.shortcuts import get_object_or_404
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.auth.decorators import login_required, permission_required
......@@ -28,7 +28,7 @@ from django.utils import timezone
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 create_cotis(vente, user, duration, date_start=False):
""" Update et crée l'objet cotisation associé à une facture, prend en argument l'user, la facture pour la quantitéi, et l'article pour la durée"""
......
......@@ -3,8 +3,8 @@
# Gplv2
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.shortcuts import render_to_response, get_object_or_404
from django.core.context_processors import csrf
from django.shortcuts import get_object_or_404
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
......@@ -39,7 +39,7 @@ STATS_DICT = {
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)
@login_required
@permission_required('cableur')
......
......@@ -3,8 +3,8 @@
# Gplv2
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.shortcuts import render_to_response, get_object_or_404
from django.core.context_processors import csrf
from django.shortcuts import get_object_or_404
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
......@@ -81,7 +81,7 @@ def unassign_ipv4(interface):
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)
@login_required
def new_machine(request, userid):
......
......@@ -79,7 +79,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',
're2o.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.shortcuts import get_object_or_404
from django.template.context_processors import csrf
from django.template import Context, RequestContext, loader
from re2o.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):
......
......@@ -3,7 +3,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 @@
{% 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" %}
......
......@@ -44,7 +44,8 @@ def linux_user_validator(login):
def get_fresh_user_uid():
uids = list(range(int(min(UID_RANGES['users'])),int(max(UID_RANGES['users']))))
used_uids = [ user.uid_number for user in User.objects.all()]
#used_uids = [ user.uid_number for user in User.objects.all()]
used_uids = [10000]
free_uids = [ id for id in uids if id not in used_uids]
return min(free_uids)
......@@ -248,6 +249,7 @@ class User(AbstractBaseUser):
def ldap_sync(self, base=True, access_refresh=True, mac_refresh=True):
self.refresh_from_db()
return
try:
user_ldap = LdapUser.objects.get(uidNumber=self.uid_number)
except LdapUser.DoesNotExist:
......@@ -300,6 +302,7 @@ class ServiceUser(AbstractBaseUser):
objects = UserManager()
def ldap_sync(self):
return
try:
user_ldap = LdapServiceUser.objects.get(name=self.pseudo)
except LdapServiceUser.DoesNotExist:
......@@ -369,6 +372,7 @@ class ListRight(models.Model):
return self.listright
def ldap_sync(self):
return
try:
group_ldap = LdapUserGroup.objects.get(gid=self.gid)
except LdapUserGroup.DoesNotExist:
......
# App de gestion des users pour re2o
# Goulven Kermarec, Gabriel Détraz, Lemesle Augustin
# Gplv2
from django.shortcuts import render_to_response, get_object_or_404, render, redirect
from django.core.context_processors import csrf
from django.shortcuts import get_object_or_404, render, redirect
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
......@@ -41,11 +41,7 @@ def unarchive(user):
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 password_change_action(u_form, user, request, req=False):
""" Fonction qui effectue le changeemnt de mdp bdd"""
......
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