Commit 9e062621 authored by Florent Chehab's avatar Florent Chehab

County modules added

parent 3a2008a5
Pipeline #26370 passed with stages
in 1 minute and 30 seconds
......@@ -5,30 +5,38 @@ package CountryModule{
abstract class BasicModuleCopyCountry as "BasicModule" #red
abstract class ScholarShipCopyCountry as "Scholarship" #red
class CultureCountry as "Culture"
class CountryCulture as "Culture"
class VisaAdministrative
class HealthAssurance
class TransportCountry
class PhotoCountry
class HealthInsurance
class OtherInsurance
class CountryOtherStuff
class CountryTransport
class CountryPhoto
class ScholarshipCountry
CultureCountry -up-|> BasicModuleCopyCountry
CountryCulture -up-|> BasicModuleCopyCountry
VisaAdministrative -up-|> BasicModuleCopyCountry
HealthAssurance -up-|> BasicModuleCopyCountry
TransportCountry -up-|> BasicModuleCopyCountry
OtherInsurance -up-|> BasicModuleCopyCountry
HealthInsurance -up-|> BasicModuleCopyCountry
CountryOtherStuff -up-|> BasicModuleCopyCountry
CountryTransport -up-|> BasicModuleCopyCountry
PhotoCountry -up-|> PhotoCopyCountry
CountryPhoto -up-|> PhotoCopyCountry
ScholarshipCountry -up-|> ScholarShipCopyCountry
class CountryVirtualCopy as "Country" < copy for\n cleaner UML> #lightgrey
CultureCountry "1" -down[bold,#green]- "1" CountryVirtualCopy
CountryCulture "1" -down[bold,#green]- "1" CountryVirtualCopy
VisaAdministrative "1" -down[bold,#green]- "1" CountryVirtualCopy
HealthAssurance "1" -down[bold,#green]- "1" CountryVirtualCopy
TransportCountry "1" -down[bold,#green]- "1" CountryVirtualCopy
PhotoCountry "1" -down[bold,#green]- "1" CountryVirtualCopy
HealthInsurance "1" -down[bold,#green]- "1" CountryVirtualCopy
OtherInsurance "1" -down[bold,#green]- "1" CountryVirtualCopy
CountryOtherStuff "1" -down[bold,#green]- "1" CountryVirtualCopy
CountryTransport "1" -down[bold,#green]- "1" CountryVirtualCopy
CountryPhoto "1" -down[bold,#green]- "1" CountryVirtualCopy
ScholarshipCountry "*" -down- "*" CountryVirtualCopy
}
......
......@@ -3,6 +3,15 @@ from reversion_compare.admin import CompareVersionAdmin
from rex.models.location import Country, City
from rex.models.location import CountryCulture
from rex.models.location import CountryHealthInsurance
from rex.models.location import CountryOtherInsurance
from rex.models.location import CountryTransport
from rex.models.location import CountryOtherStuff
from rex.models.location import CountryVisaAdministrative
from rex.models.location import CountryPhoto
from rex.models.location import CountryScholarship
from rex.models.university import University, Campus, UniversityScholarship
from rex.models.university import UniversityInfo
......@@ -34,6 +43,14 @@ VERSIONNED_MODELS = [
UniversityOtherStuff,
UniversitySpecialOffer,
UniversityPhoto,
CountryCulture,
CountryHealthInsurance,
CountryOtherInsurance,
CountryTransport,
CountryOtherStuff,
CountryVisaAdministrative,
CountryPhoto,
CountryScholarship,
]
for model in CLASSIC_MODELS:
......
# Generated by Django 2.0.3 on 2018-08-21 12:51
import django.core.validators
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', '0019_auto_20180821_1422'),
]
operations = [
migrations.CreateModel(
name='CountryCulture',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('country', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='country_culture', serialize=False, to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CountryHealthInsurance',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('country', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='country_health_insurances', serialize=False, to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CountryOtherInsurance',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('country', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='country_other_insurances', serialize=False, to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CountryOtherStuff',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('country', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='country_other_stuff', serialize=False, to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CountryPhoto',
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='CountryScholarship',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('type', models.CharField(max_length=200)),
('amount_min', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])),
('amount_max', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CountryTransport',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('country', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='country_transport', serialize=False, to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CountryVisaAdministrative',
fields=[
('comment', models.TextField(blank=True)),
('usefull_links', rex.models.tools.usefullLinksField.UsefullLinksField(blank=True, default=[], validators=[rex.models.tools.usefullLinksField.validate_usefull_links])),
('country', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='country_visa_administrative', serialize=False, to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='countryscholarship',
name='country',
field=models.ManyToManyField(related_name='country_scholarhip', to='rex.Country'),
),
migrations.AddField(
model_name='countryscholarship',
name='currency',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rex.Currency'),
),
migrations.AddField(
model_name='countryphoto',
name='country',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='country_photos', to='rex.Country'),
),
migrations.AlterUniqueTogether(
name='countryphoto',
unique_together={('country', 'photo')},
),
]
from .country import Country, CountrySerializer, CountryViewSet # noqa: F401
from .city import City, CitySerializer, CityViewSet # noqa: F401
from .countryBasicModules import CountryCulture, CountryCultureViewSet # noqa: F401
from .countryBasicModules import CountryVisaAdministrative, CountryVisaAdministrativeViewSet # noqa: F401
from .countryBasicModules import CountryHealthInsurance, CountryHealthInsuranceViewSet # noqa: F401
from .countryBasicModules import CountryOtherInsurance, CountryOtherInsuranceViewSet # noqa: F401
from .countryBasicModules import CountryTransport, CountryTransportViewSet # noqa: F401
from .countryBasicModules import CountryOtherStuff, CountryOtherStuffViewSet # noqa: F401
from .countryPhoto import CountryPhoto, CountryPhotoViewSet # noqa: F401
from .countryScholarship import CountryScholarship, CountryScholarshipViewSet # noqa: F401
from django.db import models
from rex.models.module import BasicModule
from rex.models.location import Country
from rest_framework import viewsets, permissions
from rex.models.module import BasicModuleSerializer
####################
# CountryVisaAdministrative
###################
class CountryVisaAdministrative(BasicModule):
country = models.OneToOneField(
Country, on_delete=models.CASCADE, related_name='country_visa_administrative', primary_key=True)
class CountryVisaAdministrativeSerializer(BasicModuleSerializer):
class Meta:
model = CountryVisaAdministrative
fields = '__all__'
# TODO switch to dict
class CountryVisaAdministrativeViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryVisaAdministrative.objects.all() # pylint: disable=E1101
serializer_class = CountryVisaAdministrativeSerializer
#####################
#####################
####################
# CountryHealthInsurance
###################
class CountryHealthInsurance(BasicModule):
country = models.OneToOneField(
Country, on_delete=models.CASCADE, related_name='country_health_insurances', primary_key=True)
class CountryHealthInsuranceSerializer(BasicModuleSerializer):
class Meta:
model = CountryHealthInsurance
fields = '__all__'
# TODO switch to dict
class CountryHealthInsuranceViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryHealthInsurance.objects.all() # pylint: disable=E1101
serializer_class = CountryHealthInsuranceSerializer
#####################
#####################
####################
# Other Insurance
###################
class CountryOtherInsurance(BasicModule):
country = models.OneToOneField(
Country, on_delete=models.CASCADE, related_name='country_other_insurances', primary_key=True)
class CountryOtherInsuranceSerializer(BasicModuleSerializer):
class Meta:
model = CountryOtherInsurance
fields = '__all__'
# TODO switch to dict
class CountryOtherInsuranceViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryOtherInsurance.objects.all() # pylint: disable=E1101
serializer_class = CountryOtherInsuranceSerializer
#####################
#####################
####################
# CountryCulture
###################
class CountryCulture(BasicModule):
country = models.OneToOneField(
Country, on_delete=models.CASCADE, related_name='country_culture', primary_key=True)
class CountryCultureSerializer(BasicModuleSerializer):
class Meta:
model = CountryCulture
fields = '__all__'
class CountryCultureViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryCulture.objects.all() # pylint: disable=E1101
serializer_class = CountryCultureSerializer
#####################
#####################
####################
# CountryTransport
###################
class CountryTransport(BasicModule):
country = models.OneToOneField(
Country, on_delete=models.CASCADE, related_name='country_transport', primary_key=True)
class CountryTransportSerializer(BasicModuleSerializer):
class Meta:
model = CountryTransport
fields = '__all__'
class CountryTransportViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryTransport.objects.all() # pylint: disable=E1101
serializer_class = CountryTransportSerializer
#####################
#####################
####################
# CountryOtherStuff
###################
class CountryOtherStuff(BasicModule):
country = models.OneToOneField(
Country, on_delete=models.CASCADE, related_name='country_other_stuff', primary_key=True)
class CountryOtherStuffSerializer(BasicModuleSerializer):
class Meta:
model = CountryOtherStuff
fields = '__all__'
# TODO switch to dict
class CountryOtherStuffViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryOtherStuff.objects.all() # pylint: disable=E1101
serializer_class = CountryOtherStuffSerializer
from django.db import models
from rex.models.location import Country
from rex.models.module import VersionnedModuleSerializer
from rex.models.module import Photo
from rest_framework import viewsets, permissions
class CountryPhoto(Photo):
country = models.OneToOneField(
Country,
on_delete=models.CASCADE,
related_name='country_photos')
class Meta:
unique_together = ('country', 'photo')
class CountryPhotoSerializer(VersionnedModuleSerializer):
class Meta:
model = CountryPhoto
fields = '__all__'
class CountryPhotoViewSet(viewsets.ModelViewSet): # TODO switch to dict
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryPhoto.objects.all() # pylint: disable=E1101
serializer_class = CountryPhotoSerializer
from django.db import models
from rex.models.location import Country
from rex.models.module import Scholarship, BasicModuleSerializer
from rest_framework import viewsets, permissions
class CountryScholarship(Scholarship):
country = models.ManyToManyField(
Country, related_name="country_scholarhip")
class CountryScholarshipSerializer(BasicModuleSerializer):
class Meta:
model = CountryScholarship
fields = '__all__'
class CountryScholarshipViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryScholarship.objects.all() # pylint: disable=E1101
serializer_class = CountryScholarshipSerializer
......@@ -3,6 +3,16 @@ from rex import views
from rest_framework import routers
from rex.models.location import CountryViewSet
from rex.models.location import CityViewSet
from rex.models.location import CountryCultureViewSet
from rex.models.location import CountryHealthInsuranceViewSet
from rex.models.location import CountryOtherInsuranceViewSet
from rex.models.location import CountryTransportViewSet
from rex.models.location import CountryOtherStuffViewSet
from rex.models.location import CountryVisaAdministrativeViewSet
from rex.models.location import CountryPhotoViewSet
from rex.models.location import CountryScholarshipViewSet
from rex.models.university import UniversityViewSet
from rex.models.university import CampusViewSet
from rex.models.university import UniversityScholarshipViewSet
......@@ -32,10 +42,24 @@ router.register(r'city', CityViewSet)
router.register(r'campus', CampusViewSet)
router.register(r'university', UniversityViewSet)
router.register(r'country_more/culture', CountryCultureViewSet)
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/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'university_more/scholarship', UniversityScholarshipViewSet)
router.register(r'university_more/info', UniversityInfoViewSet)
router.register(r'university_more/insurance', UniversityInsuranceViewSet)
router.register(r'university_more/semesters_dates', UniversitySemestersDatesViewSet)
router.register(r'university_more/semesters_dates',
UniversitySemestersDatesViewSet)
router.register(r'university_more/courses', UniversityCoursesViewSet)
router.register(r'university_more/culture', UniversityCultureViewSet)
router.register(r'university_more/other_stuff', UniversityOtherStuffViewSet)
......
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