]> git.parisson.com Git - teleforma.git/commitdiff
add CourseType dict methods
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 7 Mar 2023 14:43:01 +0000 (15:43 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 7 Mar 2023 14:43:01 +0000 (15:43 +0100)
teleforma/models/core.py

index 52adaf1de1946282be52a2b5af0fc3f03e28ed0a..2ee1be68d06945ce31f9cede34882afd41e16762 100755 (executable)
@@ -189,6 +189,18 @@ class CourseType(Model):
         verbose_name = _('course type')
 
 
+    def to_dict(self):
+        dict = {'name': self.name,
+                'description': self.description,
+                }
+        return dict
+
+    def from_dict(self, data):
+        self.name = data['name']
+        self.description = data['description']
+        self.save()
+
+
 class Course(Model):
 
     department = models.ForeignKey('Department', related_name='course',