8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-26 06:32:26 +00:00

Modifications pour compatibilité avec stretch 1

This commit is contained in:
Gabriel Detraz 2016-12-12 13:32:18 +01:00 committed by root
parent c1c5863d05
commit 76f9deafe2
9 changed files with 23 additions and 23 deletions

View file

@ -2,8 +2,8 @@
# Goulven Kermarec, Gabriel Détraz # Goulven Kermarec, Gabriel Détraz
# Gplv2 # Gplv2
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import get_object_or_404
from django.core.context_processors import csrf from django.template.context_processors import csrf
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template import Context, RequestContext, loader from django.template import Context, RequestContext, loader
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
@ -28,7 +28,7 @@ from django.utils import timezone
def form(ctx, template, request): def form(ctx, template, request):
c = ctx c = ctx
c.update(csrf(request)) 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): 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""" """ 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"""

View file

@ -3,8 +3,8 @@
# Gplv2 # Gplv2
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import get_object_or_404
from django.core.context_processors import csrf from django.template.context_processors import csrf
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template import Context, RequestContext, loader from django.template import Context, RequestContext, loader
from django.contrib import messages from django.contrib import messages
@ -39,7 +39,7 @@ STATS_DICT = {
def form(ctx, template, request): def form(ctx, template, request):
c = ctx c = ctx
c.update(csrf(request)) c.update(csrf(request))
return render_to_response(template, c, context_instance=RequestContext(request)) return render(request, template, c)
@login_required @login_required
@permission_required('cableur') @permission_required('cableur')

View file

@ -3,8 +3,8 @@
# Gplv2 # Gplv2
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import get_object_or_404
from django.core.context_processors import csrf from django.template.context_processors import csrf
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template import Context, RequestContext, loader from django.template import Context, RequestContext, loader
from django.contrib import messages from django.contrib import messages
@ -81,7 +81,7 @@ def unassign_ipv4(interface):
def form(ctx, template, request): def form(ctx, template, request):
c = ctx c = ctx
c.update(csrf(request)) c.update(csrf(request))
return render_to_response(template, c, context_instance=RequestContext(request)) return render(request, template, c)
@login_required @login_required
def new_machine(request, userid): def new_machine(request, userid):

View file

@ -79,7 +79,7 @@ TEMPLATES = [
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request', 'django.template.context_processors.request',
're2o.context_processors.context_user', 're2o.context_processors.context_user',
], ],
}, },

View file

@ -1,13 +1,13 @@
from django.shortcuts import render from django.shortcuts import render
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import 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.template import Context, RequestContext, loader
from re2o.settings import services_urls from re2o.settings import services_urls
def form(ctx, template, request): def form(ctx, template, request):
c = ctx c = ctx
c.update(csrf(request)) c.update(csrf(request))
return render_to_response(template, c, context_instance=RequestContext(request)) return render(request, template, c)
def index(request): def index(request):

View file

@ -3,7 +3,7 @@
# Gplv2 # Gplv2
from django.shortcuts import render from django.shortcuts import render
from django.shortcuts import render_to_response, get_object_or_404 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.template import Context, RequestContext, loader
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required

View file

@ -19,7 +19,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<p><form method="post" action="{% url 'django.contrib.auth.views.login' %}"> <p><form method="post" action="{% url 'login' %}">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% bootstrap_form form %}
{% bootstrap_button "Login" button_type="submit" icon="log-in" %} {% bootstrap_button "Login" button_type="submit" icon="log-in" %}

View file

@ -44,7 +44,8 @@ def linux_user_validator(login):
def get_fresh_user_uid(): def get_fresh_user_uid():
uids = list(range(int(min(UID_RANGES['users'])),int(max(UID_RANGES['users'])))) 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] free_uids = [ id for id in uids if id not in used_uids]
return min(free_uids) return min(free_uids)
@ -248,6 +249,7 @@ class User(AbstractBaseUser):
def ldap_sync(self, base=True, access_refresh=True, mac_refresh=True): def ldap_sync(self, base=True, access_refresh=True, mac_refresh=True):
self.refresh_from_db() self.refresh_from_db()
return
try: try:
user_ldap = LdapUser.objects.get(uidNumber=self.uid_number) user_ldap = LdapUser.objects.get(uidNumber=self.uid_number)
except LdapUser.DoesNotExist: except LdapUser.DoesNotExist:
@ -300,6 +302,7 @@ class ServiceUser(AbstractBaseUser):
objects = UserManager() objects = UserManager()
def ldap_sync(self): def ldap_sync(self):
return
try: try:
user_ldap = LdapServiceUser.objects.get(name=self.pseudo) user_ldap = LdapServiceUser.objects.get(name=self.pseudo)
except LdapServiceUser.DoesNotExist: except LdapServiceUser.DoesNotExist:
@ -369,6 +372,7 @@ class ListRight(models.Model):
return self.listright return self.listright
def ldap_sync(self): def ldap_sync(self):
return
try: try:
group_ldap = LdapUserGroup.objects.get(gid=self.gid) group_ldap = LdapUserGroup.objects.get(gid=self.gid)
except LdapUserGroup.DoesNotExist: except LdapUserGroup.DoesNotExist:

View file

@ -1,8 +1,8 @@
# App de gestion des users pour re2o # App de gestion des users pour re2o
# Goulven Kermarec, Gabriel Détraz, Lemesle Augustin # Goulven Kermarec, Gabriel Détraz, Lemesle Augustin
# Gplv2 # Gplv2
from django.shortcuts import render_to_response, get_object_or_404, render, redirect from django.shortcuts import 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.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template import Context, RequestContext, loader from django.template import Context, RequestContext, loader
from django.contrib import messages from django.contrib import messages
@ -41,11 +41,7 @@ def unarchive(user):
def form(ctx, template, request): def form(ctx, template, request):
c = ctx c = ctx
c.update(csrf(request)) c.update(csrf(request))
return render_to_response( return render(request, template, c)
template,
c,
context_instance=RequestContext(request)
)
def password_change_action(u_form, user, request, req=False): def password_change_action(u_form, user, request, req=False):
""" Fonction qui effectue le changeemnt de mdp bdd""" """ Fonction qui effectue le changeemnt de mdp bdd"""