added documentation
This commit is contained in:
parent
0a39a9a1b9
commit
e7559446a7
14 changed files with 114 additions and 4 deletions
|
@ -1,5 +1,17 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="django" name="Django">
|
||||||
|
<configuration>
|
||||||
|
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||||
|
<option name="settingsModule" value="Palto/settings.py" />
|
||||||
|
<option name="manageScript" value="manage.py" />
|
||||||
|
<option name="environment" value="<map/>" />
|
||||||
|
<option name="doNotUseTestRunner" value="false" />
|
||||||
|
<option name="trackFilePattern" value="" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
@ -7,4 +19,11 @@
|
||||||
<orderEntry type="jdk" jdkName="Python 3.11 (Palto-Server)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.11 (Palto-Server)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PyDocumentationSettings">
|
||||||
|
<option name="format" value="PLAIN" />
|
||||||
|
<option name="myDocStringFormat" value="Plain" />
|
||||||
|
</component>
|
||||||
|
<component name="TemplatesService">
|
||||||
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -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 django.contrib import admin
|
||||||
|
|
||||||
from .models import (Department, StudentGroup, TeachingUnit, StudentCard, TeachingSession, Attendance, Absence,
|
from .models import (Department, StudentGroup, TeachingUnit, StudentCard, TeachingSession, Attendance, Absence,
|
||||||
|
@ -14,14 +20,14 @@ class AdminUser(admin.ModelAdmin):
|
||||||
|
|
||||||
@admin.register(Department)
|
@admin.register(Department)
|
||||||
class AdminDepartment(admin.ModelAdmin):
|
class AdminDepartment(admin.ModelAdmin):
|
||||||
list_display = ("id", "name")
|
list_display = ("id", "name", "email")
|
||||||
search_fields = ("id", "name")
|
search_fields = ("id", "name", "email")
|
||||||
|
|
||||||
|
|
||||||
@admin.register(StudentGroup)
|
@admin.register(StudentGroup)
|
||||||
class AdminStudentGroup(admin.ModelAdmin):
|
class AdminStudentGroup(admin.ModelAdmin):
|
||||||
list_display = ("id", "name")
|
list_display = ("id", "name", "owner", "department")
|
||||||
search_fields = ("id", "name")
|
search_fields = ("id", "name", "owner", "department")
|
||||||
|
|
||||||
|
|
||||||
@admin.register(TeachingUnit)
|
@admin.register(TeachingUnit)
|
||||||
|
|
|
@ -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 django.urls import path, include
|
||||||
from rest_framework_simplejwt.views import TokenRefreshView, TokenObtainPairView, TokenVerifyView
|
from rest_framework_simplejwt.views import TokenRefreshView, TokenObtainPairView, TokenVerifyView
|
||||||
|
|
||||||
|
|
|
@ -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 rest_framework import permissions
|
||||||
|
|
||||||
from Palto.Palto.models import (Department, TeachingUnit, StudentCard, StudentGroup, User, TeachingSession, Attendance,
|
from Palto.Palto.models import (Department, TeachingUnit, StudentCard, StudentGroup, User, TeachingSession, Attendance,
|
||||||
|
|
|
@ -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 rest_framework import serializers
|
||||||
|
|
||||||
from Palto.Palto.models import (User, Department, TeachingUnit, StudentCard, TeachingSession, Attendance, Absence,
|
from Palto.Palto.models import (User, Department, TeachingUnit, StudentCard, TeachingSession, Attendance, Absence,
|
||||||
|
|
19
Palto/Palto/api/v1/tests.py
Normal file
19
Palto/Palto/api/v1/tests.py
Normal file
|
@ -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
|
|
@ -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 rest_framework import routers
|
||||||
|
|
||||||
from .views import (UserViewSet, AbsenceAttachmentViewSet, AbsenceViewSet, AttendanceViewSet, TeachingSessionViewSet,
|
from .views import (UserViewSet, AbsenceAttachmentViewSet, AbsenceViewSet, AttendanceViewSet, TeachingSessionViewSet,
|
||||||
|
|
|
@ -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 import viewsets
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
|
||||||
|
|
|
@ -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
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
5
Palto/Palto/factories.py
Normal file
5
Palto/Palto/factories.py
Normal file
|
@ -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.
|
||||||
|
"""
|
|
@ -1,3 +1,9 @@
|
||||||
|
"""
|
||||||
|
Models for the Palto project.
|
||||||
|
|
||||||
|
Models are the class that represent and abstract the database.
|
||||||
|
"""
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
|
@ -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
|
from django.test import TestCase
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
|
@ -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
|
from django.shortcuts import render
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Django libraries
|
||||||
django
|
django
|
||||||
djangorestframework
|
djangorestframework
|
||||||
django-debug-toolbar
|
django-debug-toolbar
|
||||||
|
@ -6,4 +7,9 @@ djangorestframework-simplejwt[crypto]
|
||||||
django-cors-headers
|
django-cors-headers
|
||||||
Werkzeug
|
Werkzeug
|
||||||
|
|
||||||
|
# Tests libraries
|
||||||
|
faker
|
||||||
|
factory_boy
|
||||||
|
|
||||||
|
# Other librairies
|
||||||
markdown
|
markdown
|
||||||
|
|
Loading…
Reference in a new issue