Commit e8065082 authored by Florent Chehab's avatar Florent Chehab

CityModules added

parent 11a6fd82
Pipeline #26372 passed with stages
in 1 minute and 27 seconds
......@@ -2,8 +2,9 @@
!include AbstractModules.pu
!include Core.pu
!include UniversityModules.pu
!include CountryModules.pu
!include CityModules.pu
!include UniversityModules.pu
!include Campus.pu
!include IndiFunctions.pu
......
@startuml
package CityModule{
abstract class PhotoCopyCity as "Photo" #red
abstract class BasicModuleCopyCity as "BasicModule" #red
class CityOtherStuff
class CityTransport
class CityTourism
class CityPhoto
CityOtherStuff -up-|> BasicModuleCopyCity
CityTransport -up-|> BasicModuleCopyCity
CityTourism -up-|> BasicModuleCopyCity
CityPhoto -up-|> PhotoCopyCity
class CityVirtualCopy as "City" < copy for\n cleaner UML> #lightgrey
CityOtherStuff "1" -down[bold,#green]- "1" CityVirtualCopy
CityTransport "1" -down[bold,#green]- "1" CityVirtualCopy
CityTourism "1" -down[bold,#green]- "1" CityVirtualCopy
CityPhoto "1" -down[bold,#green]- "1" CityVirtualCopy
}
CityVirtualCopy -down[bold,#green]- City
@enduml
\ No newline at end of file
......@@ -3,6 +3,7 @@ TARGET=\
generated/Core.svg \
generated/UniversityModules.svg \
generated/CountryModules.svg \
generated/CityModules.svg \
generated/AbstractModules.svg \
generated/Campus.svg \
generated/IndiFunctions.svg
......
......@@ -11,5 +11,6 @@ Vue plus précise :
![AbstractModules](UML/generated/UniversityModules.svg)
![Architecture](UML/generated/Campus.svg)
![Architecture](UML/generated/CountryModules.svg)
![Architecture](UML/generated/CityModules.svg)
![Architecture](UML/generated/AbstractModules.svg)
![Architecture](UML/generated/IndiFunctions.svg)
\ No newline at end of file
......@@ -13,6 +13,10 @@ from rex.models.location import CountryVisaAdministrative
from rex.models.location import CountryPhoto
from rex.models.location import CountryScholarship
from rex.models.location import CityTransport
from rex.models.location import CityTourism
from rex.models.location import CityOtherStuff
from rex.models.university import University, Campus, UniversityScholarship
from rex.models.university import UniversityInfo
......@@ -53,6 +57,9 @@ VERSIONNED_MODELS = [
CountryVisaAdministrative,
CountryPhoto,
CountryScholarship,
CityTransport,
CityTourism,
CityOtherStuff,
]
for model in CLASSIC_MODELS:
......
# Generated by Django 2.0.3 on 2018-08-21 13:16
from django.db import migrations, models
import django.db.models.deletion
import rex.models.tools.usefullLinksField
import rex.utils.friendly_path
class Migration(migrations.Migration):
dependencies = [
('rex', '0021_countrytourism'),
]
operations = [
migrations.CreateModel(
name='CityOtherStuff',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('city', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='city_other_stuff', serialize=False, to='rex.City')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CityPhoto',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('photo', models.ImageField(default='path/to/my/default/image.jpg', max_length=250, upload_to=rex.utils.friendly_path.friendly_path('uploads/universities/photos/', 'title'))),
('title', models.CharField(max_length=200)),
('description', models.TextField(blank=True, null=True)),
],
),
migrations.CreateModel(
name='CityTourism',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('city', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='city_tourism', serialize=False, to='rex.City')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CityTransport',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('city', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='city_transport', serialize=False, to='rex.City')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='cityphoto',
name='city',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='city_photos', to='rex.City'),
),
migrations.AlterUniqueTogether(
name='cityphoto',
unique_together={('city', 'photo')},
),
]
......@@ -10,3 +10,8 @@ from .countryBasicModules import CountryTourism, CountryTourismViewSet # noqa:
from .countryBasicModules import CountryOtherStuff, CountryOtherStuffViewSet # noqa: F401
from .countryPhoto import CountryPhoto, CountryPhotoViewSet # noqa: F401
from .countryScholarship import CountryScholarship, CountryScholarshipViewSet # noqa: F401
from .cityBasicModules import CityTransport, CityTransportViewSet # noqa: F401
from .cityBasicModules import CityOtherStuff, CityOtherStuffViewSet # noqa: F401
from .cityBasicModules import CityTourism, CityTourismViewSet # noqa: F401
from .cityPhoto import CityPhoto, CityPhotoViewSet # noqa: F401
from django.db import models
from rex.models.module import BasicModule
from rex.models.location import City
from rest_framework import viewsets, permissions
from rex.models.module import BasicModuleSerializer
####################
# CityTransport
###################
class CityTransport(BasicModule):
city = models.OneToOneField(
City, on_delete=models.CASCADE, related_name='city_transport', primary_key=True)
class CityTransportSerializer(BasicModuleSerializer):
class Meta:
model = CityTransport
fields = '__all__'
class CityTransportViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CityTransport.objects.all() # pylint: disable=E1101
serializer_class = CityTransportSerializer
#####################
#####################
####################
# CityTourism
###################
class CityTourism(BasicModule):
city = models.OneToOneField(
City, on_delete=models.CASCADE, related_name='city_tourism', primary_key=True)
class CityTourismSerializer(BasicModuleSerializer):
class Meta:
model = CityTourism
fields = '__all__'
class CityTourismViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CityTourism.objects.all() # pylint: disable=E1101
serializer_class = CityTourismSerializer
#####################
#####################
####################
# CityOtherStuff
###################
class CityOtherStuff(BasicModule):
city = models.OneToOneField(
City, on_delete=models.CASCADE, related_name='city_other_stuff', primary_key=True)
class CityOtherStuffSerializer(BasicModuleSerializer):
class Meta:
model = CityOtherStuff
fields = '__all__'
# TODO switch to dict
class CityOtherStuffViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CityOtherStuff.objects.all() # pylint: disable=E1101
serializer_class = CityOtherStuffSerializer
from django.db import models
from rex.models.location import City
from rex.models.module import VersionnedModuleSerializer
from rex.models.module import Photo
from rest_framework import viewsets, permissions
class CityPhoto(Photo):
city = models.OneToOneField(
City,
on_delete=models.CASCADE,
related_name='city_photos')
class Meta:
unique_together = ('city', 'photo')
class CityPhotoSerializer(VersionnedModuleSerializer):
class Meta:
model = CityPhoto
fields = '__all__'
class CityPhotoViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CityPhoto.objects.all() # pylint: disable=E1101
serializer_class = CityPhotoSerializer
......@@ -14,6 +14,11 @@ from rex.models.location import CountryVisaAdministrativeViewSet
from rex.models.location import CountryPhotoViewSet
from rex.models.location import CountryScholarshipViewSet
from rex.models.location import CityTransportViewSet
from rex.models.location import CityTourismViewSet
from rex.models.location import CityOtherStuffViewSet
from rex.models.location import CityPhotoViewSet
from rex.models.university import UniversityViewSet
from rex.models.university import CampusViewSet
from rex.models.university import UniversityScholarshipViewSet
......@@ -49,13 +54,18 @@ router.register(r'country_more/health_insurance',
CountryHealthInsuranceViewSet)
router.register(r'country_more/other_insurance', CountryOtherInsuranceViewSet)
router.register(r'country_more/transport', CountryTransportViewSet)
router.register(r'country_more/transport', CountryTourismViewSet)
router.register(r'country_more/tourism', CountryTourismViewSet)
router.register(r'country_more/other_stuff', CountryOtherStuffViewSet)
router.register(r'country_more/visa_administrative',
CountryVisaAdministrativeViewSet)
router.register(r'country_more/photos', CountryPhotoViewSet)
router.register(r'country_more/scholarship', CountryScholarshipViewSet)
router.register(r'city_more/transport', CityTransportViewSet)
router.register(r'city_more/tourism', CityTourismViewSet)
router.register(r'city_more/other_stuff', CityOtherStuffViewSet)
router.register(r'city_more/photos', CityPhotoViewSet)
router.register(r'university_more/scholarship', UniversityScholarshipViewSet)
router.register(r'university_more/info', UniversityInfoViewSet)
......
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