diff --git a/.idea/Palto-Server.iml b/.idea/Palto-Server.iml index 39864a8..e92e3f9 100644 --- a/.idea/Palto-Server.iml +++ b/.idea/Palto-Server.iml @@ -1,5 +1,17 @@ + + + + + + @@ -7,4 +19,11 @@ + + + + \ No newline at end of file diff --git a/Palto/Palto/admin.py b/Palto/Palto/admin.py index c64a972..57e6fb5 100644 --- a/Palto/Palto/admin.py +++ b/Palto/Palto/admin.py @@ -1,3 +1,9 @@ +""" +Admin for the Palto project. + +The admin is the admin page configuration, describing which model should be visible and which field in the admin page. +""" + from django.contrib import admin from .models import (Department, StudentGroup, TeachingUnit, StudentCard, TeachingSession, Attendance, Absence, @@ -14,14 +20,14 @@ class AdminUser(admin.ModelAdmin): @admin.register(Department) class AdminDepartment(admin.ModelAdmin): - list_display = ("id", "name") - search_fields = ("id", "name") + list_display = ("id", "name", "email") + search_fields = ("id", "name", "email") @admin.register(StudentGroup) class AdminStudentGroup(admin.ModelAdmin): - list_display = ("id", "name") - search_fields = ("id", "name") + list_display = ("id", "name", "owner", "department") + search_fields = ("id", "name", "owner", "department") @admin.register(TeachingUnit) diff --git a/Palto/Palto/api/urls.py b/Palto/Palto/api/urls.py index 89fa036..23f5062 100644 --- a/Palto/Palto/api/urls.py +++ b/Palto/Palto/api/urls.py @@ -1,3 +1,9 @@ +""" +Urls for the Palto project's API. + +This file list all the urls for the Palto API. +""" + from django.urls import path, include from rest_framework_simplejwt.views import TokenRefreshView, TokenObtainPairView, TokenVerifyView diff --git a/Palto/Palto/api/v1/permissions.py b/Palto/Palto/api/v1/permissions.py index 68cd269..b538656 100644 --- a/Palto/Palto/api/v1/permissions.py +++ b/Palto/Palto/api/v1/permissions.py @@ -1,3 +1,9 @@ +""" +Permissions for the Palto project's API v1. + +A permission describe which user is allowed to see and modify which objet with the API +""" + from rest_framework import permissions from Palto.Palto.models import (Department, TeachingUnit, StudentCard, StudentGroup, User, TeachingSession, Attendance, diff --git a/Palto/Palto/api/v1/serializers.py b/Palto/Palto/api/v1/serializers.py index 5c853f5..c2d8cc7 100644 --- a/Palto/Palto/api/v1/serializers.py +++ b/Palto/Palto/api/v1/serializers.py @@ -1,3 +1,9 @@ +""" +Serializers for the Palto project's API v1. + +A serializers tell the API how should a model should be serialized to be used by an external user. +""" + from rest_framework import serializers from Palto.Palto.models import (User, Department, TeachingUnit, StudentCard, TeachingSession, Attendance, Absence, diff --git a/Palto/Palto/api/v1/tests.py b/Palto/Palto/api/v1/tests.py new file mode 100644 index 0000000..7cb58de --- /dev/null +++ b/Palto/Palto/api/v1/tests.py @@ -0,0 +1,19 @@ +""" +Tests for the Palto project's API v1. + +Everything to test the API v1 is described here. +""" + +from django import test + +from Palto.Palto.models import User + + +class UserTestCase(test.TestCase): + def creation(self): + pass + + +class DepartmentTestCase(test.TestCase): + def creation(self): + pass diff --git a/Palto/Palto/api/v1/urls.py b/Palto/Palto/api/v1/urls.py index 0b397ae..48a7310 100644 --- a/Palto/Palto/api/v1/urls.py +++ b/Palto/Palto/api/v1/urls.py @@ -1,3 +1,10 @@ +""" +Urls for the Palto project's API v1. + +All the urls for every model of the API are described here. +""" + + from rest_framework import routers from .views import (UserViewSet, AbsenceAttachmentViewSet, AbsenceViewSet, AttendanceViewSet, TeachingSessionViewSet, diff --git a/Palto/Palto/api/v1/views.py b/Palto/Palto/api/v1/views.py index c1b4a1e..acdd217 100644 --- a/Palto/Palto/api/v1/views.py +++ b/Palto/Palto/api/v1/views.py @@ -1,3 +1,9 @@ +""" +Views for the Palto project's API v1. + +An API view describe which models should display which files to user with which permissions. +""" + from rest_framework import viewsets from rest_framework.permissions import IsAuthenticated diff --git a/Palto/Palto/apps.py b/Palto/Palto/apps.py index 93c779b..b1e7d4e 100644 --- a/Palto/Palto/apps.py +++ b/Palto/Palto/apps.py @@ -1,3 +1,9 @@ +""" +Apps for the Palto project. + +The app is the configuration for this part of the project. +""" + from django.apps import AppConfig diff --git a/Palto/Palto/factories.py b/Palto/Palto/factories.py new file mode 100644 index 0000000..bc9591f --- /dev/null +++ b/Palto/Palto/factories.py @@ -0,0 +1,5 @@ +""" +Factories for the Palto project. + +Factories are class that allow for the automatic creation of instances of our models, primarily for testing purpose. +""" diff --git a/Palto/Palto/models.py b/Palto/Palto/models.py index 62343c0..c115c80 100644 --- a/Palto/Palto/models.py +++ b/Palto/Palto/models.py @@ -1,3 +1,9 @@ +""" +Models for the Palto project. + +Models are the class that represent and abstract the database. +""" + import uuid from datetime import datetime, timedelta from typing import Iterable diff --git a/Palto/Palto/tests.py b/Palto/Palto/tests.py index 7ce503c..69f7fd6 100644 --- a/Palto/Palto/tests.py +++ b/Palto/Palto/tests.py @@ -1,3 +1,9 @@ +""" +Tests for the Palto project. + +Tests allow to easily check after modifying the logic behind a feature that everything still work as intended. +""" + from django.test import TestCase # Create your tests here. diff --git a/Palto/Palto/views.py b/Palto/Palto/views.py index 91ea44a..49785f0 100644 --- a/Palto/Palto/views.py +++ b/Palto/Palto/views.py @@ -1,3 +1,9 @@ +""" +Views for the Palto project. + +A view is what control the content of a page, prepare the correct data, react to a form, render the correct template. +""" + from django.shortcuts import render # Create your views here. diff --git a/requirements.txt b/requirements.txt index 9bbc21b..7207d04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +# Django libraries django djangorestframework django-debug-toolbar @@ -6,4 +7,9 @@ djangorestframework-simplejwt[crypto] django-cors-headers Werkzeug +# Tests libraries +faker +factory_boy + +# Other librairies markdown