aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2017-01-18 19:13:54 +0100
committerAlban Gruin2017-01-18 19:13:54 +0100
commitf203597c7502a33134854f6f7df336a9347e16f3 (patch)
tree2b35ff029f473401c781f79ec749fa99fc3066e8
Validation initiale
-rw-r--r--.gitignore3
-rw-r--r--__init__.py0
-rw-r--r--admin.py21
-rw-r--r--apps.py5
-rw-r--r--models.py44
-rw-r--r--tests.py3
-rw-r--r--views.py3
7 files changed, 79 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9377785
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+__pycache__/
+migrations/
+
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/__init__.py
diff --git a/admin.py b/admin.py
new file mode 100644
index 0000000..99f3398
--- /dev/null
+++ b/admin.py
@@ -0,0 +1,21 @@
+from django.contrib import admin
+from edt.models import Group, Room, Course
+
+
+@admin.register(Group)
+class GroupAdmin(admin.ModelAdmin):
+ pass
+
+
+@admin.register(Room)
+class RoomAdmin(admin.ModelAdmin):
+ pass
+
+
+@admin.register(Course)
+class CourseAdmin(admin.ModelAdmin):
+ fieldsets = (
+ (None, {"fields": ("name", "type", "groups", "rooms",)}),
+ ("Horaires", {"fields": ("begin", "end",)}),)
+ list_display = ("name", "type", "begin", "end",)
+ list_filter = ("type", "groups",)
diff --git a/apps.py b/apps.py
new file mode 100644
index 0000000..be6e156
--- /dev/null
+++ b/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class EdtConfig(AppConfig):
+ name = 'edt'
diff --git a/models.py b/models.py
new file mode 100644
index 0000000..a70e15c
--- /dev/null
+++ b/models.py
@@ -0,0 +1,44 @@
+from django.db import models
+
+
+class Group(models.Model):
+ name = models.CharField(max_length=255, unique=True, verbose_name="nom")
+
+ def __str__(self):
+ return self.name
+
+
+ class Meta:
+ verbose_name = "groupe"
+ verbose_name_plural = "groupes"
+
+
+class Room(models.Model):
+ name = models.CharField(max_length=255, unique=True, verbose_name="nom")
+
+ def __str__(self):
+ return self.name
+
+
+ class Meta:
+ verbose_name = "salle"
+ verbose_name_plural = "salles"
+
+
+class Course(models.Model):
+ name = models.CharField(max_length=255, verbose_name="nom")
+ type_ = models.CharField(name="type", max_length=255, verbose_name="type de cours")
+
+ groups = models.ManyToManyField(Group, verbose_name="groupes")
+ rooms = models.ManyToManyField(Room, verbose_name="salles")
+
+ begin = models.DateTimeField(verbose_name="début du cours")
+ end = models.DateTimeField(verbose_name="fin du cours")
+
+ def __str__(self):
+ return self.name
+
+
+ class Meta:
+ verbose_name = "cours"
+ verbose_name_plural = "cours"
diff --git a/tests.py b/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/views.py b/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.