Commit d9087853 authored by Florent Chehab's avatar Florent Chehab

DRI restricted modules added

parent 766e16e1
Pipeline #26384 passed with stages
in 1 minute and 29 seconds
......@@ -2,47 +2,47 @@
package Core {
' note as notePackageCore
' <b>Write access is restricted to site admins and the members of the DRI group.</b>
' On some models, users can make requests for modifications (for this a copy of the model is used for storing).
' end note
' note as notePackageCore
' <b>Write access is restricted to site admins and the members of the DRI group.</b>
' On some models, users can make requests for modifications (for this a copy of the model is used for storing).
' end note
class City #white {
+ name : string
+ local_name : string
+ area : string
}
class City #white {
+ name : string
+ local_name : string
+ area : string
}
class Country #white {
# iso_alpha2_code : string{2}
+ name : string
+ region_code : string{3}
+ region_name : string
+ sub_region_code : string{3}
+ sub_region_name : string
+ intermediate_region_code : string{3}
+ intermediate_region_name : string
}
class Country #white {
# iso_alpha2_code : string{2}
+ name : string
+ region_code : string{3}
+ region_name : string
+ sub_region_code : string{3}
+ sub_region_name : string
+ intermediate_region_code : string{3}
+ intermediate_region_name : string
}
City "*" -left-* Country
City "*" -left-* Country
note "Countries are intially \n hardcoded in the db." as N2
N2 .up. Country
note "Countries are intially \n hardcoded in the db." as N2
N2 .up. Country
class University #wheat {
+ name : string
+ accronyme : string
+ logo : image
+ website : url
}
class University #wheat {
+ name : string
+ accronyme : string
+ logo : image
+ website : url
}
University "1" .right. "1" City
note on link #white
This link is acheived
through the campus module
(where is_main = true)
University "1" .right. "1" City
note on link #white
This link is acheived
through the campus module
(where is_main = true)
end note
Class Offer {
......@@ -81,7 +81,24 @@ note on link #white
+ content : MD
}
note left of UsefullLinks: It will be a dynamic page \n on the website
note right of UsefullLinks: It will be a dynamic page \n on the website
abstract class BasicModuleCopyCore as "BasicModule" #red
class UniversityDri
class CountryDri
UniversityDri -down-|> BasicModuleCopyCore
CountryDri -down-|> BasicModuleCopyCore
Country "*"-down-"*" CountryDri
University "*"-down-"*" UniversityDri
note "Edit right reserved\n to DRI members." as N4
N4 .. UniversityDri
N4 .. CountryDri
}
' End of Core block
......
......@@ -12,6 +12,7 @@ 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.location import CountryDri
from rex.models.location import CityTransport
from rex.models.location import CityTourism
......@@ -27,6 +28,7 @@ from rex.models.university import UniversityCulture
from rex.models.university import UniversityOtherStuff
from rex.models.university import UniversitySpecialOffer
from rex.models.university import UniversityPhoto
from rex.models.university import UniversityDri
from rex.models.university import CampusTransport
from rex.models.university import CampusAccommodation
......@@ -69,6 +71,8 @@ VERSIONNED_MODELS = [
CampusAccommodation,
CampusCultureAndStudentLife,
CampusOtherStuff,
CountryDri,
UniversityDri,
]
for model in CLASSIC_MODELS:
......
# Generated by Django 2.0.3 on 2018-08-21 14:08
from django.db import migrations, models
import rex.models.tools.usefullLinksField
class Migration(migrations.Migration):
dependencies = [
('rex', '0023_campusaccommodation_campuscultureandstudentlife_campusotherstuff_campustransport'),
]
operations = [
migrations.CreateModel(
name='CountryDri',
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])),
('country', models.ManyToManyField(related_name='country_dri', to='rex.Country')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='UniversityDri',
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])),
('university', models.ManyToManyField(related_name='university_dri', to='rex.University')),
],
options={
'abstract': False,
},
),
]
......@@ -10,6 +10,7 @@ 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 .countryDri import CountryDri, CountryDriViewSet # noqa: F401
from .cityBasicModules import CityTransport, CityTransportViewSet # noqa: F401
from .cityBasicModules import CityOtherStuff, CityOtherStuffViewSet # noqa: F401
......
from django.db import models
from rex.models.location import Country
from rex.models.module import DriRestrictedModule, DriRestrictedModuleSerializer
from rest_framework import viewsets, permissions
class CountryDri(DriRestrictedModule):
country = models.ManyToManyField(
Country, related_name="country_dri")
class CountryDriSerializer(DriRestrictedModuleSerializer):
class Meta:
model = CountryDri
fields = '__all__'
class CountryDriViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = CountryDri.objects.all() # pylint: disable=E1101
serializer_class = CountryDriSerializer
......@@ -2,3 +2,4 @@ from .versionnedModule import VersionnedModule, VersionnedModuleSerializer # no
from .basicModule import BasicModule, BasicModuleSerializer # noqa: F401
from .scholarship import Scholarship # noqa: F401
from .photo import Photo # noqa: F401
from .driRestrictedModule import DriRestrictedModule, DriRestrictedModuleSerializer # noqa: F401
from rex.models.module import BasicModule, BasicModuleSerializer
class DriRestrictedModule(BasicModule):
class Meta:
abstract = True
class DriRestrictedModuleSerializer(BasicModuleSerializer):
# TODO Check edit restrictions
pass
......@@ -3,6 +3,7 @@ from .campus import Campus, CampusViewSet, CampusSerializer # noqa: F401
from .universityAPI import UniversitySerializer, UniversityViewSet # noqa: F401
from .universityScholarship import UniversityScholarship, UniversityScholarshipViewSet # noqa: F401
from .universityDri import UniversityDri, UniversityDriViewSet # noqa: F401
from .universityInfo import UniversityInfo, UniversityInfoViewSet # noqa: F401
from .universitySemestersDates import UniversitySemestersDates, UniversitySemestersDatesViewSet # noqa: F401
from .universityBasicModules import UniversityInsurance, UniversityInsuranceViewSet # noqa: F401
......
from django.db import models
from rex.models.university import University
from rex.models.module import DriRestrictedModule, DriRestrictedModuleSerializer
from rest_framework import viewsets, permissions
class UniversityDri(DriRestrictedModule):
university = models.ManyToManyField(
University, related_name="university_dri")
class UniversityDriSerializer(DriRestrictedModuleSerializer):
class Meta:
model = UniversityDri
fields = '__all__'
class UniversityDriViewSet(viewsets.ModelViewSet):
permission_classes = (permissions.DjangoModelPermissions,)
queryset = UniversityDri.objects.all() # pylint: disable=E1101
serializer_class = UniversityDriSerializer
......@@ -13,6 +13,7 @@ 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.location import CountryDriViewSet
from rex.models.location import CityTransportViewSet
from rex.models.location import CityTourismViewSet
......@@ -30,6 +31,7 @@ from rex.models.university import UniversityCultureViewSet
from rex.models.university import UniversityOtherStuffViewSet
from rex.models.university import UniversitySpecialOfferViewSet
from rex.models.university import UniversityPhotoViewSet
from rex.models.university import UniversityDriViewSet
from rex.models.university import CampusTransportViewSet
from rex.models.university import CampusAccommodationViewSet
......@@ -65,6 +67,7 @@ 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'country_more/dri', CountryDriViewSet)
router.register(r'city_more/transport', CityTransportViewSet)
router.register(r'city_more/tourism', CityTourismViewSet)
......@@ -83,6 +86,7 @@ router.register(r'university_more/other_stuff', UniversityOtherStuffViewSet)
router.register(r'university_more/photos', UniversityPhotoViewSet)
router.register(r'university_more/special_offer',
UniversitySpecialOfferViewSet)
router.register(r'university_more/dri', UniversityDriViewSet)
router.register(r'campus_more/culture_and_sl',
CampusCultureAndStudentLifeViewSet)
......
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