diff options
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | urls.py | 32 | ||||
-rw-r--r-- | views.py | 5 |
3 files changed, 26 insertions, 23 deletions
@@ -10,7 +10,7 @@ d’informations affichées. ## Comment faire tourner celcatsanitizer chez moi ? celcatsanitizer est écrit en Python 3. Il dépend des bibliothèques suivantes : - * [Django 1.11](https://www.djangoproject.com/) + * [Django 2.0](https://www.djangoproject.com/) * [requests](http://docs.python-requests.org/en/master/) * [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) * [icalendar](https://icalendar.readthedocs.io/en/latest/) @@ -92,19 +92,19 @@ plusieurs informations. ##### Configuration des administrateurs [Vous pouvez retrouver la documentation de la variable ADMIN sur le site de -Django.](https://docs.djangoproject.com/fr/1.11/ref/settings/#admins) +Django.](https://docs.djangoproject.com/fr/2.0/ref/settings/#admins) Cette variable est obligatoire. ##### Configuration de l’internationalisation Ce passage n’est pas obligatoire. [Vous pouvez retrouver la documentation de l’internationalisation sur le site de -Django.](https://docs.djangoproject.com/fr/1.11/topics/i18n/) +Django.](https://docs.djangoproject.com/fr/2.0/topics/i18n/) ##### Configuration de la base de données [Vous pouvez retrouver la documentation de la base de données sur le site de -Django.](https://docs.djangoproject.com/fr/1.11/ref/settings/#databases) +Django.](https://docs.djangoproject.com/fr/2.0/ref/settings/#databases) ##### Configuration du mode de Django Si jamais vous utiliser Django en production, vous **devez** mettre la @@ -118,7 +118,7 @@ INSTALLED_APPS. celcatsanitizer utilise les flatpages pour rendre les pages « contact » et « à propos ». Vous pouvez retrouver le guide d’installation sur [le site de -Django](https://docs.djangoproject.com/fr/1.11/ref/contrib/flatpages/#installation). Effectuez +Django](https://docs.djangoproject.com/fr/2.0/ref/contrib/flatpages/#installation). Effectuez uniquement les deux premières étapes, celcatsanitizer enregistre déjà une route pour les pages statiques, et la commande de l’étape 4 sera effectuée plus loin. @@ -145,7 +145,7 @@ $ ./manage.py migrate ##### Gestion des fichiers statiques Si vous êtes en production, vous devez renseigner l’emplacement de vos fichiers statiques dans la variable -[STATIC_ROOT](https://docs.djangoproject.com/fr/1.11/ref/settings/#std:setting-STATIC_ROOT) +[STATIC_ROOT](https://docs.djangoproject.com/fr/2.0/ref/settings/#std:setting-STATIC_ROOT) de la configuration de Django, puis exécuter la commande suivante : ```bash @@ -13,23 +13,23 @@ # You should have received a copy of the GNU Affero General Public License # along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>. -from django.conf.urls import include, url +from django.urls import include, path from . import feeds, views urlpatterns = [ - url(r"^$", views.index, name="index"), - url(r"^pages/", include("django.contrib.flatpages.urls")), - url(r"^salles/$", views.rooms, name="rooms"), - url(r"^salles/qsjps$", views.qsjps, name="qsjps"), - url(r"^salles/(?P<room_slug>[-\w]+)/$", views.room_timetable, name="room-timetable"), - url(r"^salles/(?P<room_slug>[-\w]+)/(?P<year>[0-9]{4})/(?P<week>[0-4]?[0-9]|5[0-3])$", views.room_timetable, name="room-timetable"), - url(r"^(?P<year_slug>[-\w]+)/$", views.mention_list, name="mentions"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/$", views.group_list, name="groups"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/$", views.timetable, name="timetable"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/calendars", views.calendars, name="calendars"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/calendar.ics$", feeds.IcalFeed(), name="ics"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/calendar-group.ics$", feeds.IcalOnlyOneFeed(), name="ics-group"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/feed.atom$", feeds.AtomFeed(), name="atom"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/feed.rss$", feeds.RSSFeed(), name="rss"), - url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/(?P<year>[0-9]{4})/(?P<week>[0-4]?[0-9]|5[0-3])/$", views.timetable, name="timetable"), + path("", views.index, name="index"), + path("pages/", include("django.contrib.flatpages.urls")), + path("salles/", views.rooms, name="rooms"), + path("salles/qsjps", views.qsjps, name="qsjps"), + path("salles/<slug:room_slug>/", views.room_timetable, name="room-timetable"), + path("salles/<slug:room_slug>/<int:year>/<int:week>", views.room_timetable, name="room-timetable"), + path("<slug:year_slug>/", views.mention_list, name="mentions"), + path("<slug:year_slug>/<slug:timetable_slug>/", views.group_list, name="groups"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/", views.timetable, name="timetable"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/calendars", views.calendars, name="calendars"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/calendar.ics", feeds.IcalFeed(), name="ics"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/calendar-group.ics", feeds.IcalOnlyOneFeed(), name="ics-group"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/feed.atom", feeds.AtomFeed(), name="atom"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/feed.rss", feeds.RSSFeed(), name="rss"), + path("<slug:year_slug>/<slug:timetable_slug>/<slug:group_slug>/<int:year>/<int:week>/", views.timetable, name="timetable"), ] @@ -86,7 +86,10 @@ def timetable_common(request, obj, year=None, week=None, timetable=None): elif (int(year), int(week)) < (current_year, current_week): is_old_timetable = True - start, end = get_week(year, week) + try: + start, end = get_week(year, week) + except ValueError: + raise Http404 courses = Course.objects.get_courses(obj, begin__gte=start, begin__lt=end) if not courses.exists() and provided_week: |