From 17a375f89c20132b4019e24f0737016c62940c44 Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Thu, 16 May 2019 16:51:30 +0200 Subject: [PATCH] pedagogy: structure of the app --- pedagogy/__init__.py | 23 ++++++ pedagogy/admin.py | 27 +++++++ pedagogy/migrations/__init__.py | 0 pedagogy/models.py | 67 +++++++++++++++++ pedagogy/tests.py | 27 +++++++ pedagogy/urls.py | 62 ++++++++++++++++ pedagogy/views.py | 124 ++++++++++++++++++++++++++++++++ sith/settings.py | 1 + sith/urls.py | 4 ++ 9 files changed, 335 insertions(+) create mode 100644 pedagogy/__init__.py create mode 100644 pedagogy/admin.py create mode 100644 pedagogy/migrations/__init__.py create mode 100644 pedagogy/models.py create mode 100644 pedagogy/tests.py create mode 100644 pedagogy/urls.py create mode 100644 pedagogy/views.py diff --git a/pedagogy/__init__.py b/pedagogy/__init__.py new file mode 100644 index 00000000..7ea16950 --- /dev/null +++ b/pedagogy/__init__.py @@ -0,0 +1,23 @@ +# -*- coding:utf-8 -* +# +# Copyright 2019 +# - Sli +# +# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, +# http://ae.utbm.fr. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License a published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA. +# +# diff --git a/pedagogy/admin.py b/pedagogy/admin.py new file mode 100644 index 00000000..24eb52b8 --- /dev/null +++ b/pedagogy/admin.py @@ -0,0 +1,27 @@ +# -*- coding:utf-8 -* +# +# Copyright 2019 +# - Sli +# +# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, +# http://ae.utbm.fr. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License a published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA. +# +# + +from django.contrib import admin + +# Register your models here. diff --git a/pedagogy/migrations/__init__.py b/pedagogy/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pedagogy/models.py b/pedagogy/models.py new file mode 100644 index 00000000..57ee8576 --- /dev/null +++ b/pedagogy/models.py @@ -0,0 +1,67 @@ +# -*- coding:utf-8 -* +# +# Copyright 2019 +# - Sli +# +# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, +# http://ae.utbm.fr. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License a published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA. +# +# + +from django.db import models + +# Create your models here. + + +class UV(models.Model): + """ + Contains infos about an UV (course) + """ + + pass + + +class UVComment(models.Model): + """ + A comment about an UV + """ + + pass + + +class UVCommentReport(models.Model): + """ + Report an inapropriate comment + """ + + pass + + +class TeachingDepartment(models.Model): + """ + Teaching department of the school + """ + + pass + + +class Study(models.Model): + """ + Speciality inside a Teaching Department + """ + + pass diff --git a/pedagogy/tests.py b/pedagogy/tests.py new file mode 100644 index 00000000..02ee7ae5 --- /dev/null +++ b/pedagogy/tests.py @@ -0,0 +1,27 @@ +# -*- coding:utf-8 -* +# +# Copyright 2019 +# - Sli +# +# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, +# http://ae.utbm.fr. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License a published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA. +# +# + +from django.test import TestCase + +# Create your tests here. diff --git a/pedagogy/urls.py b/pedagogy/urls.py new file mode 100644 index 00000000..71a17a57 --- /dev/null +++ b/pedagogy/urls.py @@ -0,0 +1,62 @@ +# -*- coding:utf-8 -* +# +# Copyright 2019 +# - Sli +# +# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, +# http://ae.utbm.fr. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License a published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA. +# +# + +from django.conf.urls import url + +from pedagogy.views import * + +urlpatterns = [ + url(r"^$", UVListView.as_view(), name="guide"), + url(r"^uv/(?P[0-9]+)$", UVDetailFormView.as_view(), name="uv_detail"), + url( + r"^comment/(?P[0-9]+)$", + UVCommentDetailView.as_view(), + name="comment_detail", + ), + url( + r"^comment/(?P[0-9]+)/report$", + UVCommentReportCreateView.as_view(), + name="comment_report", + ), + url(r"^reported$", UVCommentReportListView.as_view(), name="comment_report_list"), + url(r"^moderation$", UVModerationFormView.as_view(), name="moderation"), + url(r"^uv/create$", UVCreateView.as_view(), name="uv_create"), + url(r"^uv/(?P[0-9]+)/delete$", UVDeleteView.as_view(), name="uv_delete"), + url( + r"^department/create$", + TeachingDepartmentCreateView.as_view(), + name="department_create", + ), + url( + r"^department/(?P[0-9]+)/delete$", + TeachingDepartmentDeleteView.as_view(), + name="department_delete", + ), + url(r"^study/create$", StudyCreateView.as_view(), name="study_create"), + url( + r"^study/(?P[0-9]+)/delete$", + StudyDeleteView.as_view(), + name="study_delete", + ), +] diff --git a/pedagogy/views.py b/pedagogy/views.py new file mode 100644 index 00000000..ed5a728e --- /dev/null +++ b/pedagogy/views.py @@ -0,0 +1,124 @@ +# -*- coding:utf-8 -* +# +# Copyright 2017 +# - Sli +# +# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, +# http://ae.utbm.fr. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License a published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA. +# +# + +from django.views.generic import CreateView, DeleteView, DetailView, ListView, FormView + +from core.views import DetailFormView + + +class UVDetailFormView(DetailFormView): + """ + Dispaly every comment of an UV and detailed infos about it + Allow to comment the UV + """ + + pass + + +class UVCommentDetailView(DetailView): + """ + Display a specified UVComment (for easy sharing of the comment) + """ + + pass + + +class UVListView(ListView): + """ + UV guide main page + """ + + pass + + +class UVCommentReportCreateView(CreateView): + """ + Create a new report for an inapropriate comment + """ + + pass + + +class UVCommentReportListView(ListView): + """ + List all UV reports for moderation (Privileged) + """ + + pass + + +class UVModerationFormView(FormView): + """ + List all UVs to moderate and allow to moderate them (Privileged) + """ + + pass + + +class UVCreateView(CreateView): + """ + Add a new UV (Privileged) + """ + + pass + + +class UVDeleteView(DeleteView): + """ + Allow to delete an UV (Privileged) + """ + + pass + + +class TeachingDepartmentCreateView(CreateView): + """ + Add a new TeachingDepartment (Privileged) + """ + + pass + + +class TeachingDepartmentDeleteView(DeleteView): + """ + Allow to delete an TeachingDepartment (Privileged) + """ + + pass + + +class StudyCreateView(CreateView): + """ + Add a new Study (Privileged) + """ + + pass + + +class StudyDeleteView(DeleteView): + """ + Allow to delete an Study (Privileged) + """ + + pass diff --git a/sith/settings.py b/sith/settings.py index 22acf99e..cd4af6da 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -93,6 +93,7 @@ INSTALLED_APPS = ( "stock", "trombi", "matmat", + "pedagogy", ) MIDDLEWARE_CLASSES = ( diff --git a/sith/urls.py b/sith/urls.py index 179724b8..23f82469 100644 --- a/sith/urls.py +++ b/sith/urls.py @@ -84,6 +84,10 @@ urlpatterns = [ url( r"^matmatronch/", include("matmat.urls", namespace="matmat", app_name="matmat") ), + url( + r"^pedagogy/", + include("pedagogy.urls", namespace="pedagogy", app_name="pedagogy"), + ), url(r"^admin/", include(admin.site.urls)), url(r"^ajax_select/", include(ajax_select_urls)), url(r"^i18n/", include("django.conf.urls.i18n")),