Commit 60812c86 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont

Déplacement des applications et de leurs templates dans des dossiers séparés

parent 2cd78507
from django.conf.urls.defaults import patterns as patterns
import views
urlpatterns = patterns('',
('^$', 'intranet.dummy.views.bonjour')
('^$', views.bonjour)
)
......@@ -5,4 +5,4 @@ from login import require_droits
@require_droits()
def bonjour(request):
return django.shortcuts.render_to_response("bonjour.html", {"session" : request.session })
return django.shortcuts.render_to_response("dummy/bonjour.html", {"session" : request.session })
from django.conf.urls.defaults import patterns, url
import views
urlpatterns = patterns('',
url('^do_prises$', views.do_prises, name="prises/do_prises"),
url('^$', views.view, name="prises/view")
)
......@@ -124,7 +124,7 @@ def view(request):
chbres_by_etage = chbres.items()
chbres_by_etage.sort(lambda x,y: cmp (y[0], x[0]))
return django.shortcuts.render_to_response("prises.html", locals())
return django.shortcuts.render_to_response("prises/prises.html", locals())
@require_droits(['nounou', 'crous'])
def do_prises(request):
......@@ -137,4 +137,4 @@ def do_prises(request):
bat, chbre = name[pref], name[(pref + 1):]
modifs.append( (bat, chbre, val) )
update_chbre( bat, chbre, val )
return django.shortcuts.render_to_response("done_prises.html", { "modifs": modifs, "session": request.session} )
return django.shortcuts.render_to_response("prises/done_prises.html", { "modifs": modifs, "session": request.session} )
from django.conf.urls.defaults import patterns as patterns
urlpatterns = patterns('',
('^do_prises$', 'intranet.prises.views.do_prises'),
('^$', 'intranet.prises.views.view')
)
......@@ -84,7 +84,7 @@ TEMPLATE_DIRS = (
INTRANET_APPS = (
{'name':'dummy', 'category':'Beta'},
{'name':'prises', 'category': 'Administration'},
{'name':'prises', 'category':'Administration'},
)
INSTALLED_APPS = (
......@@ -92,4 +92,4 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
) + tuple( 'intranet.%s' % app['name'] for app in INTRANET_APPS )
) + tuple( 'intranet.apps.%s' % app['name'] for app in INTRANET_APPS )
......@@ -5,6 +5,6 @@
<p>
Bonjour {{ session.adherent }}, tu es authentifié.
</p>
<a href="/do_logout">Se déconnecter</a>
<a href="{% url logout %}">Se déconnecter</a>
{% endblock %}
......@@ -6,7 +6,7 @@
{% block content %}
<p>Voilà! les modifications ont été apportées&nbsp;:
{{ modifs }}
</p>
<p> Retourner à <a href="{% url intranet.prises.views.view %}"> la sélection des prises</a>.</p>
</p>
<p> Retourner à <a href="{% url prises/view %}"> la sélection des prises</a>.</p>
{% endblock %}
......@@ -6,7 +6,7 @@
{% for bat in batiments %}
<li>
{% ifnotequal bat cur_bat %}
<a href="{% url prises.views.view %}?bat={{bat}}"> Batiment {{ bat|upper }} </a>
<a href="{% url prises/view %}?bat={{bat}}"> Batiment {{ bat|upper }} </a>
{% endifnotequal %}
{% ifequal bat cur_bat %}
Batiment {{ bat|upper }}
......@@ -42,7 +42,7 @@ function maj(chbre) {
//-->
</script>
<form name="chambres" action="{% url prises.views.do_prises %}" method="post">
<form id="chambres" action="{% url prises/do_prises %}" method="post">
<ul>
{% for etage, chbres_e in chbres_by_etage %}
{% ifnotequal currentloop.first True %} <hr> {% endifnotequal %}
......
from django.conf.urls.defaults import *
from django.conf.urls.defaults import include, patterns, url
import settings
urlpatterns = patterns('',
# Les pages existantes
('^$', 'intranet.accueil.view'),
url('^$', 'intranet.accueil.view'),
# Pages de login
('^login', 'intranet.login.prompt_login'),
('^do_login', 'intranet.login.do_login'),
('^do_logout', 'intranet.login.do_logout'),
url('^login', 'intranet.login.prompt_login', name="login"),
url('^do_login', 'intranet.login.do_login'),
url('^do_logout', 'intranet.login.do_logout', name="logout"),
# Pour servir le static
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT + 'static/' }),
# on rajoute toutes les plugins
*(('^%s/' % app['name'], include('intranet.'+app['name']+'.urls')) for app in settings.INTRANET_APPS))
# )
)
for app in settings.INTRANET_APPS:
app = app["name"]
urlpatterns += patterns('', ('^%s/' % app, include('intranet.apps.%s.urls' % app)))
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