Merge branch 'Aufinal/urls' into 'master'
Améliore les URLs de gestiocof Closes #265 See merge request klub-dev-ens/gestioCOF!439
This commit is contained in:
commit
2aae281120
5 changed files with 180 additions and 160 deletions
159
cof/urls.py
159
cof/urls.py
|
@ -5,148 +5,43 @@ from django.conf import settings
|
|||
from django.conf.urls.i18n import i18n_patterns
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import views as django_auth_views
|
||||
from django.urls import include, path
|
||||
from django.views.generic.base import TemplateView
|
||||
from django_cas_ng import views as django_cas_views
|
||||
|
||||
# Website administration (independent from installed apps)
|
||||
admin.autodiscover()
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
|
||||
if "gestioncof" in settings.INSTALLED_APPS:
|
||||
# App-specific urls
|
||||
|
||||
bds_is_alone = (
|
||||
"bds" in settings.INSTALLED_APPS and "gestioncof" not in settings.INSTALLED_APPS
|
||||
)
|
||||
|
||||
app_dict = {
|
||||
"bds": "" if bds_is_alone else "bds/",
|
||||
"gestioncof": "",
|
||||
"bda": "bda/",
|
||||
"petitscours": "petitcours/",
|
||||
"kfet": "k-fet/",
|
||||
# events module is still experimental !
|
||||
"events": "event_v2/",
|
||||
"authens": "authens/",
|
||||
}
|
||||
for (app_name, url_prefix) in app_dict.items():
|
||||
if app_name in settings.INSTALLED_APPS:
|
||||
urlpatterns += [path(url_prefix, include("{}.urls".format(app_name)))]
|
||||
|
||||
|
||||
if "django_js_reverse" in settings.INSTALLED_APPS:
|
||||
from django_js_reverse.views import urls_js
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
|
||||
from gestioncof import csv_views, views as gestioncof_views
|
||||
from gestioncof.urls import (
|
||||
calendar_patterns,
|
||||
clubs_patterns,
|
||||
events_patterns,
|
||||
export_patterns,
|
||||
surveys_patterns,
|
||||
)
|
||||
|
||||
# Also includes BdA, K-Fêt, etc.
|
||||
urlpatterns += [
|
||||
path("admin/logout/", gestioncof_views.logout),
|
||||
path(
|
||||
"admin/<slug:app_label>/<slug:model_name>/csv/",
|
||||
csv_views.admin_list_export,
|
||||
{"fields": ["username"]},
|
||||
),
|
||||
# Page d'accueil
|
||||
path("", gestioncof_views.HomeView.as_view(), name="home"),
|
||||
# Le BdA
|
||||
path("bda/", include("bda.urls")),
|
||||
# Les exports
|
||||
path("export/", include(export_patterns)),
|
||||
# Les petits cours
|
||||
path("petitcours/", include("petitscours.urls")),
|
||||
# Les sondages
|
||||
path("survey/", include(surveys_patterns)),
|
||||
# Evenements
|
||||
path("event/", include(events_patterns)),
|
||||
# Calendrier
|
||||
path("calendar/", include(calendar_patterns)),
|
||||
# Clubs
|
||||
path("clubs/", include(clubs_patterns)),
|
||||
# Authentification
|
||||
path(
|
||||
"cof/denied",
|
||||
TemplateView.as_view(template_name="cof-denied.html"),
|
||||
name="cof-denied",
|
||||
),
|
||||
path("cas/login", django_cas_views.LoginView.as_view(), name="cas_login_view"),
|
||||
path("cas/logout", django_cas_views.LogoutView.as_view()),
|
||||
path(
|
||||
"outsider/login",
|
||||
gestioncof_views.LoginExtView.as_view(),
|
||||
name="ext_login_view",
|
||||
),
|
||||
path(
|
||||
"outsider/logout",
|
||||
django_auth_views.LogoutView.as_view(),
|
||||
{"next_page": "home"},
|
||||
),
|
||||
path("login", gestioncof_views.login, name="cof-login"),
|
||||
path("logout", gestioncof_views.logout, name="cof-logout"),
|
||||
# Infos persos
|
||||
path("profile", gestioncof_views.profile, name="profile"),
|
||||
path(
|
||||
"outsider/password-change",
|
||||
django_auth_views.PasswordChangeView.as_view(),
|
||||
name="password_change",
|
||||
),
|
||||
path(
|
||||
"outsider/password-change-done",
|
||||
django_auth_views.PasswordChangeDoneView.as_view(),
|
||||
name="password_change_done",
|
||||
),
|
||||
# Inscription d'un nouveau membre
|
||||
path("registration", gestioncof_views.registration, name="registration"),
|
||||
path(
|
||||
"registration/clipper/<slug:login_clipper>/<fullname>",
|
||||
gestioncof_views.registration_form2,
|
||||
name="clipper-registration",
|
||||
),
|
||||
path(
|
||||
"registration/user/<username>",
|
||||
gestioncof_views.registration_form2,
|
||||
name="user-registration",
|
||||
),
|
||||
path(
|
||||
"registration/empty",
|
||||
gestioncof_views.registration_form2,
|
||||
name="empty-registration",
|
||||
),
|
||||
# Autocompletion
|
||||
path(
|
||||
"autocomplete/registration",
|
||||
gestioncof_views.RegistrationAutocompleteView.as_view(),
|
||||
name="cof.registration.autocomplete",
|
||||
),
|
||||
path(
|
||||
"user/autocomplete",
|
||||
gestioncof_views.UserAutocompleteView.as_view(),
|
||||
name="cof-user-autocomplete",
|
||||
),
|
||||
# Liens utiles du COF et du BdA
|
||||
path("utile_cof", gestioncof_views.utile_cof, name="utile_cof"),
|
||||
path("utile_bda", gestioncof_views.utile_bda, name="utile_bda"),
|
||||
path("utile_bda/bda_diff", gestioncof_views.liste_bdadiff, name="ml_diffbda"),
|
||||
path("utile_cof/diff_cof", gestioncof_views.liste_diffcof, name="ml_diffcof"),
|
||||
path(
|
||||
"utile_bda/bda_revente",
|
||||
gestioncof_views.liste_bdarevente,
|
||||
name="ml_bda_revente",
|
||||
),
|
||||
path("k-fet/", include("kfet.urls")),
|
||||
path("cms/", include(wagtailadmin_urls)),
|
||||
path("documents/", include(wagtaildocs_urls)),
|
||||
# djconfig
|
||||
path("config", gestioncof_views.ConfigUpdate.as_view(), name="config.edit"),
|
||||
# js-reverse
|
||||
path("jsreverse/", urls_js, name="js_reverse"),
|
||||
]
|
||||
|
||||
if "bds" in settings.INSTALLED_APPS:
|
||||
urlpatterns.append(path("bds/", include("bds.urls")))
|
||||
|
||||
if "events" in settings.INSTALLED_APPS:
|
||||
# The new event application is still in development
|
||||
# → for now it is namespaced below events_v2
|
||||
# → rename this when the old events system is out
|
||||
urlpatterns += [path("event_v2/", include("events.urls"))]
|
||||
|
||||
if "authens" in settings.INSTALLED_APPS:
|
||||
urlpatterns.append(path("authens/", include("authens.urls")))
|
||||
|
||||
if "debug_toolbar" in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
|
||||
|
@ -157,10 +52,16 @@ if settings.DEBUG:
|
|||
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
# Wagtail for uncatched
|
||||
# Wagtail URLs (wagtail.core urls must be last, as catch-all)
|
||||
if "wagtail.core" in settings.INSTALLED_APPS:
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
|
||||
urlpatterns += [
|
||||
path("cms/", include(wagtailadmin_urls)),
|
||||
path("documents/", include(wagtaildocs_urls)),
|
||||
]
|
||||
urlpatterns += i18n_patterns(
|
||||
path("", include(wagtail_urls)), prefix_default_language=False
|
||||
)
|
||||
|
|
|
@ -4,21 +4,21 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h2>Liens utiles du COF</h2>
|
||||
<h3>COF</h3>
|
||||
<ul>
|
||||
<li><a href="{% url 'cof.membres_export' %}">Export des membres du COF</a></li>
|
||||
<li><a href="{% url 'ml_diffcof' %}">Diffusion COF</a></li>
|
||||
</ul>
|
||||
<h2>Liens utiles du COF</h2>
|
||||
<h3>COF</h3>
|
||||
<ul>
|
||||
<li><a href="{% url 'export.members' %}">Export des membres du COF</a></li>
|
||||
<li><a href="{% url 'ml_diffcof' %}">Diffusion COF</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>Mega</h3>
|
||||
<ul>
|
||||
<li><a href="{% url 'cof.mega_export_participants' %}">Export des non-orgas uniquement</a></li>
|
||||
<li><a href="{% url 'cof.mega_export_orgas' %}">Export des orgas uniquement</a></li>
|
||||
<li><a href="{% url 'cof.mega_export' %}">Export de tout le monde</a></li>
|
||||
</ul>
|
||||
<h3>Mega</h3>
|
||||
<ul>
|
||||
<li><a href="{% url 'export.mega.participants' %}">Export des non-orgas uniquement</a></li>
|
||||
<li><a href="{% url 'export.mega.orgas' %}">Export des orgas uniquement</a></li>
|
||||
<li><a href="{% url 'export.mega.all' %}">Export de tout le monde</a></li>
|
||||
</ul>
|
||||
|
||||
<p>Note : pour ouvrir les fichiers .csv avec Excel, il faut
|
||||
passer par <tt>Fichier > Importer</tt> et sélectionner la
|
||||
virgule comme séparateur.</p>
|
||||
<p>Note : pour ouvrir les fichiers .csv avec Excel, il faut
|
||||
passer par <tt>Fichier > Importer</tt> et sélectionner la
|
||||
virgule comme séparateur.</p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -26,7 +26,7 @@ User = get_user_model()
|
|||
|
||||
class RegistrationViewTests(ViewTestCaseMixin, TestCase):
|
||||
url_name = "registration"
|
||||
url_expected = "/registration"
|
||||
url_expected = "/registration/"
|
||||
|
||||
http_methods = ["GET", "POST"]
|
||||
|
||||
|
@ -269,7 +269,7 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
|
|||
@override_settings(LDAP_SERVER_URL="ldap_url")
|
||||
class RegistrationAutocompleteViewTests(MockLDAPMixin, ViewTestCaseMixin, TestCase):
|
||||
url_name = "cof.registration.autocomplete"
|
||||
url_expected = "/autocomplete/registration"
|
||||
url_expected = "/registration/autocomplete"
|
||||
|
||||
auth_user = "staff"
|
||||
auth_forbidden = [None, "user", "member"]
|
||||
|
@ -480,7 +480,7 @@ class UserAutocompleteViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
|
||||
class ExportMembersViewTests(CSVResponseMixin, ViewTestCaseMixin, TestCase):
|
||||
url_name = "cof.membres_export"
|
||||
url_name = "export.members"
|
||||
url_expected = "/export/members"
|
||||
|
||||
auth_user = "staff"
|
||||
|
@ -520,8 +520,8 @@ class ExportMembersViewTests(CSVResponseMixin, ViewTestCaseMixin, TestCase):
|
|||
|
||||
|
||||
class ExportMegaViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
||||
url_name = "cof.mega_export"
|
||||
url_expected = "/export/mega"
|
||||
url_name = "export.mega.all"
|
||||
url_expected = "/export/mega/all"
|
||||
|
||||
auth_user = "staff"
|
||||
auth_forbidden = [None, "user", "member"]
|
||||
|
@ -549,7 +549,7 @@ class ExportMegaViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
|||
|
||||
|
||||
class ExportMegaOrgasViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
||||
url_name = "cof.mega_export_orgas"
|
||||
url_name = "export.mega.orgas"
|
||||
url_expected = "/export/mega/orgas"
|
||||
|
||||
auth_user = "staff"
|
||||
|
@ -578,7 +578,7 @@ class ExportMegaOrgasViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
|||
|
||||
|
||||
class ExportMegaParticipantsViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
||||
url_name = "cof.mega_export_participants"
|
||||
url_name = "export.mega.participants"
|
||||
url_expected = "/export/mega/participants"
|
||||
|
||||
auth_user = "staff"
|
||||
|
@ -595,7 +595,7 @@ class ExportMegaParticipantsViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCa
|
|||
|
||||
|
||||
class ExportMegaRemarksViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCase):
|
||||
url_name = "cof.mega_export_remarks"
|
||||
url_name = "export.mega.remarks"
|
||||
url_expected = "/export/mega/avecremarques"
|
||||
|
||||
auth_user = "staff"
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
from django.urls import path
|
||||
from django.contrib.auth import views as django_auth_views
|
||||
from django.urls import include, path
|
||||
from django.views.generic.base import TemplateView
|
||||
from django_cas_ng import views as django_cas_views
|
||||
|
||||
from gestioncof import views
|
||||
from gestioncof import csv_views, views
|
||||
|
||||
export_patterns = [
|
||||
path("members", views.export_members, name="cof.membres_export"),
|
||||
path("members", views.export_members, name="export.members"),
|
||||
path(
|
||||
"mega/avecremarques",
|
||||
views.export_mega_remarksonly,
|
||||
name="cof.mega_export_remarks",
|
||||
name="export.mega.remarks",
|
||||
),
|
||||
path(
|
||||
"mega/participants",
|
||||
views.export_mega_participants,
|
||||
name="cof.mega_export_participants",
|
||||
name="export.mega.participants",
|
||||
),
|
||||
path("mega/orgas", views.export_mega_orgas, name="cof.mega_export_orgas"),
|
||||
path("mega", views.export_mega, name="cof.mega_export"),
|
||||
path("mega/orgas", views.export_mega_orgas, name="export.mega.orgas"),
|
||||
path("mega/all", views.export_mega, name="export.mega.all"),
|
||||
]
|
||||
|
||||
surveys_patterns = [
|
||||
|
@ -42,3 +45,120 @@ clubs_patterns = [
|
|||
name="change-respo",
|
||||
),
|
||||
]
|
||||
|
||||
registration_patterns = [
|
||||
# Inscription d'un nouveau membre
|
||||
path("", views.registration, name="registration"),
|
||||
path(
|
||||
"clipper/<slug:login_clipper>/<fullname>",
|
||||
views.registration_form2,
|
||||
name="clipper-registration",
|
||||
),
|
||||
path(
|
||||
"user/<username>",
|
||||
views.registration_form2,
|
||||
name="user-registration",
|
||||
),
|
||||
path(
|
||||
"empty",
|
||||
views.registration_form2,
|
||||
name="empty-registration",
|
||||
),
|
||||
# Autocompletion
|
||||
path(
|
||||
"autocomplete",
|
||||
views.RegistrationAutocompleteView.as_view(),
|
||||
name="cof.registration.autocomplete",
|
||||
),
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
"admin/<slug:app_label>/<slug:model_name>/csv/",
|
||||
csv_views.admin_list_export,
|
||||
{"fields": ["username"]},
|
||||
),
|
||||
# -----
|
||||
# Misc
|
||||
# -----
|
||||
path("", views.HomeView.as_view(), name="home"),
|
||||
path(
|
||||
"user/autocomplete",
|
||||
views.UserAutocompleteView.as_view(),
|
||||
name="cof-user-autocomplete",
|
||||
),
|
||||
path("config", views.ConfigUpdate.as_view(), name="config.edit"),
|
||||
# -----
|
||||
# Authentification
|
||||
# -----
|
||||
path(
|
||||
"cof/denied",
|
||||
TemplateView.as_view(template_name="cof-denied.html"),
|
||||
name="cof-denied",
|
||||
),
|
||||
path("cas/login", django_cas_views.LoginView.as_view(), name="cas_login_view"),
|
||||
path("cas/logout", django_cas_views.LogoutView.as_view()),
|
||||
path(
|
||||
"outsider/login",
|
||||
views.LoginExtView.as_view(),
|
||||
name="ext_login_view",
|
||||
),
|
||||
path(
|
||||
"outsider/logout",
|
||||
django_auth_views.LogoutView.as_view(),
|
||||
{"next_page": "home"},
|
||||
),
|
||||
path("login", views.login, name="cof-login"),
|
||||
path("logout", views.logout, name="cof-logout"),
|
||||
path("admin/logout/", views.logout),
|
||||
# -----
|
||||
# Infos persos
|
||||
# -----
|
||||
path("profile", views.profile, name="profile"),
|
||||
path(
|
||||
"outsider/password-change",
|
||||
django_auth_views.PasswordChangeView.as_view(),
|
||||
name="password_change",
|
||||
),
|
||||
path(
|
||||
"outsider/password-change-done",
|
||||
django_auth_views.PasswordChangeDoneView.as_view(),
|
||||
name="password_change_done",
|
||||
),
|
||||
# -----
|
||||
# Liens utiles du COF et du BdA
|
||||
# -----
|
||||
path("utile_cof", views.utile_cof, name="utile_cof"),
|
||||
path("utile_bda", views.utile_bda, name="utile_bda"),
|
||||
path("utile_bda/bda_diff", views.liste_bdadiff, name="ml_diffbda"),
|
||||
path("utile_cof/diff_cof", views.liste_diffcof, name="ml_diffcof"),
|
||||
path(
|
||||
"utile_bda/bda_revente",
|
||||
views.liste_bdarevente,
|
||||
name="ml_bda_revente",
|
||||
),
|
||||
# -----
|
||||
# Inscription d'un nouveau membre
|
||||
# -----
|
||||
path("registration/", include(registration_patterns)),
|
||||
# -----
|
||||
# Les exports
|
||||
# -----
|
||||
path("export/", include(export_patterns)),
|
||||
# -----
|
||||
# Les sondages
|
||||
# -----
|
||||
path("survey/", include(surveys_patterns)),
|
||||
# -----
|
||||
# Evenements
|
||||
# -----
|
||||
path("event/", include(events_patterns)),
|
||||
# -----
|
||||
# Calendrier
|
||||
# -----
|
||||
path("calendar/", include(calendar_patterns)),
|
||||
# -----
|
||||
# Clubs
|
||||
# -----
|
||||
path("clubs/", include(clubs_patterns)),
|
||||
]
|
||||
|
|
|
@ -35,7 +35,6 @@ combine_as_imports = true
|
|||
default_section = THIRDPARTY
|
||||
force_grid_wrap = 0
|
||||
include_trailing_comma = true
|
||||
known_django = django
|
||||
known_first_party = bda,bds,clubs,cof,events,gestioncof,kfet,petitscours,shared
|
||||
line_length = 88
|
||||
multi_line_output = 3
|
||||
|
|
Loading…
Reference in a new issue