Commit 766e16e1 authored by Florent Chehab's avatar Florent Chehab

Campus modules added

parent e8065082
Pipeline #26375 passed with stages
in 1 minute and 26 seconds
......@@ -5,7 +5,7 @@
!include CountryModules.pu
!include CityModules.pu
!include UniversityModules.pu
!include Campus.pu
!include CampusAndModules.pu
!include IndiFunctions.pu
@enduml
......@@ -21,14 +21,17 @@ package Campus {
class CultureAndStudentLife
class Accomodation
class Transport
class OtherStuff
CultureAndStudentLife -up-|> BasicModuleCopyCampusExtra
Accomodation -up-|> BasicModuleCopyCampusExtra
Transport -up-|> BasicModuleCopyCampusExtra
OtherStuff -up-|> BasicModuleCopyCampusExtra
CultureAndStudentLife -- Campus
Accomodation -- Campus
Transport -- Campus
CultureAndStudentLife "1" -down[bold,#green]- "1" Campus
Accomodation "1" -down[bold,#green]- "1" Campus
Transport "1" -down[bold,#green]- "1" Campus
OtherStuff "1" -down[bold,#green]- "1" Campus
}
Campus "1..n" -- "1" University
......
......@@ -5,7 +5,7 @@ TARGET=\
generated/CountryModules.svg \
generated/CityModules.svg \
generated/AbstractModules.svg \
generated/Campus.svg \
generated/CampusAndModules.svg \
generated/IndiFunctions.svg
......
......@@ -9,7 +9,7 @@ Vue complète :
Vue plus précise :
![Core](UML/generated/Core.svg)
![AbstractModules](UML/generated/UniversityModules.svg)
![Architecture](UML/generated/Campus.svg)
![Architecture](UML/generated/CampusAndModules.svg)
![Architecture](UML/generated/CountryModules.svg)
![Architecture](UML/generated/CityModules.svg)
![Architecture](UML/generated/AbstractModules.svg)
......
......@@ -28,6 +28,11 @@ from rex.models.university import UniversityOtherStuff
from rex.models.university import UniversitySpecialOffer
from rex.models.university import UniversityPhoto
from rex.models.university import CampusTransport
from rex.models.university import CampusAccommodation
from rex.models.university import CampusCultureAndStudentLife
from rex.models.university import CampusOtherStuff
from rex.models.tools import Currency
CLASSIC_MODELS = [
......@@ -60,6 +65,10 @@ VERSIONNED_MODELS = [
CityTransport,
CityTourism,
CityOtherStuff,
CampusTransport,
CampusAccommodation,
CampusCultureAndStudentLife,
CampusOtherStuff,
]
for model in CLASSIC_MODELS:
......
# Generated by Django 2.0.3 on 2018-08-21 13:34
from django.db import migrations, models
import django.db.models.deletion
import rex.models.tools.usefullLinksField
class Migration(migrations.Migration):
dependencies = [
('rex', '0022_auto_20180821_1516'),
]
operations = [
migrations.CreateModel(
name='CampusAccommodation',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('campus', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='campus_accomodation', serialize=False, to='rex.Campus')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CampusCultureAndStudentLife',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('campus', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='campus_culture_and_sl', serialize=False, to='rex.Campus')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CampusOtherStuff',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('campus', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='campus_other_stuff', serialize=False, to='rex.Campus')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CampusTransport',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('campus', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='campus_transport', serialize=False, to='rex.Campus')),
],
options={
'abstract': False,
},
),
]
from .university import University # noqa: F401
from .campus import Campus, CampusViewSet, CampusSerializer # noqa: F401
from .universityAPI import UniversitySerializer, UniversityViewSet # noqa: F401
from .universityScholarship import UniversityScholarship, UniversityScholarshipViewSet # noqa: F401
from .universityInfo import UniversityInfo, UniversityInfoViewSet # noqa: F401
......@@ -10,4 +11,9 @@ from .universityBasicModules import UniversityCulture, UniversityCultureViewSet
from .universityBasicModules import UniversityOtherStuff, UniversityOtherStuffViewSet # noqa: F401
from .universityBasicModules import UniversitySpecialOffer, UniversitySpecialOfferViewSet # noqa: F401
from .campusBasicModules import CampusAccommodation, CampusAccommodationViewSet # noqa: F401
from .campusBasicModules import CampusTransport, CampusTransportViewSet # noqa: F401
from .campusBasicModules import CampusCultureAndStudentLife, CampusCultureAndStudentLifeViewSet # noqa: F401
from .campusBasicModules import CampusOtherStuff, CampusOtherStuffViewSet # noqa: F401
from .universityPhoto import UniversityPhoto, UniversityPhotoViewSet # noqa: F401
from django.db import models
from rex.models.module import BasicModule
from rex.models.university import Campus
from rest_framework import viewsets, permissions
from rex.models.module import BasicModuleSerializer
####################
# CultureAndStudentLife
###################
class CampusCultureAndStudentLife(BasicModule):
campus = models.OneToOneField(
Campus, on_delete=models.CASCADE, related_name='campus_culture_and_sl', primary_key=True)
class CampusCultureAndStudentLifeSerializer(BasicModuleSerializer):
class Meta:
model = CampusCultureAndStudentLife
fields = '__all__'
# TODO switch to dict
class CampusCultureAndStudentLifeViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CampusCultureAndStudentLife.objects.all() # pylint: disable=E1101
serializer_class = CampusCultureAndStudentLifeSerializer
#####################
#####################
####################
# CampusAccommodation
###################
class CampusAccommodation(BasicModule):
campus = models.OneToOneField(
Campus, on_delete=models.CASCADE, related_name='campus_accomodation', primary_key=True)
class CampusAccommodationSerializer(BasicModuleSerializer):
class Meta:
model = CampusAccommodation
fields = '__all__'
class CampusAccommodationViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CampusAccommodation.objects.all() # pylint: disable=E1101
serializer_class = CampusAccommodationSerializer
#####################
#####################
####################
# Transport
###################
class CampusTransport(BasicModule):
campus = models.OneToOneField(
Campus, on_delete=models.CASCADE, related_name='campus_transport', primary_key=True)
class CampusTransportSerializer(BasicModuleSerializer):
class Meta:
model = CampusTransport
fields = '__all__'
class CampusTransportViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CampusTransport.objects.all() # pylint: disable=E1101
serializer_class = CampusTransportSerializer
#####################
#####################
####################
# OtherStuff
###################
class CampusOtherStuff(BasicModule):
campus = models.OneToOneField(
Campus, on_delete=models.CASCADE, related_name='campus_other_stuff', primary_key=True)
class CampusOtherStuffSerializer(BasicModuleSerializer):
class Meta:
model = CampusOtherStuff
fields = '__all__'
# TODO switch to dict
class CampusOtherStuffViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CampusOtherStuff.objects.all() # pylint: disable=E1101
serializer_class = CampusOtherStuffSerializer
......@@ -31,6 +31,11 @@ from rex.models.university import UniversityOtherStuffViewSet
from rex.models.university import UniversitySpecialOfferViewSet
from rex.models.university import UniversityPhotoViewSet
from rex.models.university import CampusTransportViewSet
from rex.models.university import CampusAccommodationViewSet
from rex.models.university import CampusCultureAndStudentLifeViewSet
from rex.models.university import CampusOtherStuffViewSet
from rex.models.tools import CurrencyViewSet
from rest_framework.documentation import include_docs_urls
......@@ -79,6 +84,13 @@ router.register(r'university_more/photos', UniversityPhotoViewSet)
router.register(r'university_more/special_offer',
UniversitySpecialOfferViewSet)
router.register(r'campus_more/culture_and_sl',
CampusCultureAndStudentLifeViewSet)
router.register(r'campus_more/accomodation', CampusAccommodationViewSet)
router.register(r'campus_more/transport', CampusTransportViewSet)
router.register(r'campus_more/other_tuff', CampusOtherStuffViewSet)
router.register(r'currency', CurrencyViewSet)
urlpatterns += [url(r'^api/', include(router.urls))]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment