diff options
author | Alban Gruin | 2019-01-03 01:11:23 +0100 |
---|---|---|
committer | Alban Gruin | 2019-06-08 21:12:44 +0200 |
commit | b2eaa3be85b30732c4e6c083c6f0413c02dbaec4 (patch) | |
tree | 1194d80396d3e156055547acd39f7e2cee1a21d7 | |
parent | d4060a8336554b6f7e154785a1f51f802ee90492 (diff) |
UPS2018: ajout du champ celcat_id
Les cours dans celcat ont un champ id. Ce changement permet de le
stocker dans la base de données (sous la forme d’un entier) et de
l’afficher dans l’interface d’administration.
Pour l’instant, on ne sait pas si cette valeur est unique ou non. Il
n’y a donc pas de contraintes sur ce champ pour le moment.
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
-rw-r--r-- | admin.py | 10 | ||||
-rw-r--r-- | management/parsers/ups2018.py | 5 | ||||
-rw-r--r-- | models.py | 4 |
3 files changed, 12 insertions, 7 deletions
@@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 Alban Gruin +# Copyright (C) 2017-2019 Alban Gruin # # celcatsanitizer is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -72,10 +72,12 @@ class RoomAdmin(admin.ModelAdmin): @admin.register(Course) class CourseAdmin(admin.ModelAdmin): fieldsets = ( - (None, {"fields": ("name", "type", "source", "groups", "rooms", - "last_update",)}), + (None, {"fields": ("name", "type", "source", "groups", "rooms",)}), ("Horaires", {"fields": ("begin", "end",)}), - ("Remarques", {"fields": ("notes",)}),) + ("Remarques", {"fields": ("notes",)}), + ("Avancé", {"fields": ("celcat_id", "last_update",), + "classes": ("collapse",)}),) list_display = ("name", "type", "source", "begin", "end",) list_filter = ("type", "source__timetables", "groups",) ordering = ("begin",) + readonly_fields = ("celcat_id", "last_update",) diff --git a/management/parsers/ups2018.py b/management/parsers/ups2018.py index f1da5bf..e3afbe5 100644 --- a/management/parsers/ups2018.py +++ b/management/parsers/ups2018.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Alban Gruin +# Copyright (C) 2018-2019 Alban Gruin # # celcatsanitizer is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -114,7 +114,8 @@ class Parser(AbstractParser): return course = Course.objects.create( - source=self.source, begin=begin, end=end + source=self.source, begin=begin, end=end, + celcat_id=int(event["id"]) ) min_i = 0 @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 Alban Gruin +# Copyright (C) 2017-2019 Alban Gruin # # celcatsanitizer is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -246,6 +246,8 @@ class Course(models.Model): last_update = models.DateTimeField(verbose_name="dernière mise à jour", default=timezone.now) + celcat_id = models.IntegerField(verbose_name="ID Celcat", null=True) + def __str__(self): return self.name |