mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +00:00
Pylintage again
This commit is contained in:
parent
54fad989b3
commit
6cac4b20a2
4 changed files with 27 additions and 13 deletions
|
@ -19,15 +19,19 @@
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
"""Fonction de context, variables renvoyées à toutes les vues"""
|
||||||
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from machines.models import Interface, Machine
|
|
||||||
from preferences.models import GeneralOption, OptionalMachine
|
from preferences.models import GeneralOption, OptionalMachine
|
||||||
|
|
||||||
|
|
||||||
def context_user(request):
|
def context_user(request):
|
||||||
general_options, created = GeneralOption.objects.get_or_create()
|
"""Fonction de context lorsqu'un user est logué (ou non),
|
||||||
machine_options, created = OptionalMachine.objects.get_or_create()
|
renvoie les infos sur l'user, la liste de ses droits, ses machines"""
|
||||||
|
general_options, _created = GeneralOption.objects.get_or_create()
|
||||||
|
machine_options, _created = OptionalMachine.objects.get_or_create()
|
||||||
user = request.user
|
user = request.user
|
||||||
if user.is_authenticated():
|
if user.is_authenticated():
|
||||||
interfaces = user.user_interfaces()
|
interfaces = user.user_interfaces()
|
||||||
|
|
10
re2o/urls.py
10
re2o/urls.py
|
@ -49,10 +49,16 @@ urlpatterns = [
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
url(r'^users/', include('users.urls', namespace='users')),
|
url(r'^users/', include('users.urls', namespace='users')),
|
||||||
url(r'^search/', include('search.urls', namespace='search')),
|
url(r'^search/', include('search.urls', namespace='search')),
|
||||||
url(r'^cotisations/', include('cotisations.urls', namespace='cotisations')),
|
url(
|
||||||
|
r'^cotisations/',
|
||||||
|
include('cotisations.urls', namespace='cotisations')
|
||||||
|
),
|
||||||
url(r'^machines/', include('machines.urls', namespace='machines')),
|
url(r'^machines/', include('machines.urls', namespace='machines')),
|
||||||
url(r'^topologie/', include('topologie.urls', namespace='topologie')),
|
url(r'^topologie/', include('topologie.urls', namespace='topologie')),
|
||||||
url(r'^logs/', include('logs.urls', namespace='logs')),
|
url(r'^logs/', include('logs.urls', namespace='logs')),
|
||||||
url(r'^preferences/', include('preferences.urls', namespace='preferences')),
|
url(
|
||||||
|
r'^preferences/',
|
||||||
|
include('preferences.urls', namespace='preferences')
|
||||||
|
),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -19,25 +19,28 @@
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
"""
|
||||||
|
Fonctions de la page d'accueil et diverses fonctions utiles pour tous
|
||||||
|
les views
|
||||||
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.shortcuts import get_object_or_404
|
|
||||||
from django.template.context_processors import csrf
|
from django.template.context_processors import csrf
|
||||||
from django.template import Context, RequestContext, loader
|
|
||||||
from preferences.models import Service
|
from preferences.models import Service
|
||||||
|
|
||||||
|
|
||||||
def form(ctx, template, request):
|
def form(ctx, template, request):
|
||||||
|
"""Form générique, raccourci importé par les fonctions views du site"""
|
||||||
context = ctx
|
context = ctx
|
||||||
context.update(csrf(request))
|
context.update(csrf(request))
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
i = 0
|
"""Affiche la liste des services sur la page d'accueil de re2o"""
|
||||||
services = [[], [], []]
|
services = [[], [], []]
|
||||||
for indice, serv in enumerate(Service.objects.all()):
|
for indice, serv in enumerate(Service.objects.all()):
|
||||||
services[indice % 3].append(serv)
|
services[indice % 3].append(serv)
|
||||||
|
|
||||||
return form({'services_urls': services}, 're2o/index.html', request)
|
return form({'services_urls': services}, 're2o/index.html', request)
|
||||||
|
|
|
@ -32,9 +32,10 @@ https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from django.core.wsgi import get_wsgi_application
|
|
||||||
from os.path import dirname
|
|
||||||
import sys
|
import sys
|
||||||
|
from os.path import dirname
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(dirname(dirname(__file__)))
|
sys.path.append(dirname(dirname(__file__)))
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "re2o.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "re2o.settings")
|
||||||
|
|
Loading…
Reference in a new issue