mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +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
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 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 machines.models import Interface, Machine
|
||||
from preferences.models import GeneralOption, OptionalMachine
|
||||
|
||||
|
||||
def context_user(request):
|
||||
general_options, created = GeneralOption.objects.get_or_create()
|
||||
machine_options, created = OptionalMachine.objects.get_or_create()
|
||||
"""Fonction de context lorsqu'un user est logué (ou non),
|
||||
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
|
||||
if user.is_authenticated():
|
||||
interfaces = user.user_interfaces()
|
||||
|
@ -52,8 +56,8 @@ def context_user(request):
|
|||
'is_bofh': is_bofh,
|
||||
'is_trez': is_trez,
|
||||
'is_infra': is_infra,
|
||||
'is_admin' : is_admin,
|
||||
'is_admin': is_admin,
|
||||
'interfaces': interfaces,
|
||||
'site_name': general_options.site_name,
|
||||
'ipv6_enabled' : machine_options.ipv6,
|
||||
'ipv6_enabled': machine_options.ipv6,
|
||||
}
|
||||
|
|
10
re2o/urls.py
10
re2o/urls.py
|
@ -49,10 +49,16 @@ urlpatterns = [
|
|||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^users/', include('users.urls', namespace='users')),
|
||||
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'^topologie/', include('topologie.urls', namespace='topologie')),
|
||||
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
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 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 django.shortcuts import render
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.template.context_processors import csrf
|
||||
from django.template import Context, RequestContext, loader
|
||||
from preferences.models import Service
|
||||
|
||||
|
||||
def form(ctx, template, request):
|
||||
"""Form générique, raccourci importé par les fonctions views du site"""
|
||||
context = ctx
|
||||
context.update(csrf(request))
|
||||
return render(request, template, context)
|
||||
|
||||
|
||||
def index(request):
|
||||
i = 0
|
||||
"""Affiche la liste des services sur la page d'accueil de re2o"""
|
||||
services = [[], [], []]
|
||||
for indice, serv in enumerate(Service.objects.all()):
|
||||
services[indice % 3].append(serv)
|
||||
|
||||
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
|
||||
|
||||
import os
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
from os.path import dirname
|
||||
import sys
|
||||
from os.path import dirname
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
|
||||
sys.path.append(dirname(dirname(__file__)))
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "re2o.settings")
|
||||
|
|
Loading…
Reference in a new issue