Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
9e062621
Commit
9e062621
authored
Aug 21, 2018
by
Florent Chehab
Browse files
County modules added
parent
3a2008a5
Changes
8
Hide whitespace changes
Inline
Side-by-side
docs/UML/CountryModules.pu
View file @
9e062621
...
...
@@ -5,30 +5,38 @@ package CountryModule{
abstract
class
BasicModuleCopyCountry
as
"BasicModule"
#
red
abstract
class
ScholarShipCopyCountry
as
"Scholarship"
#
red
class
C
ultureCountry
as
"Culture"
class
C
ountryCulture
as
"Culture"
class
VisaAdministrative
class
HealthAssurance
class
TransportCountry
class
PhotoCountry
class
HealthInsurance
class
OtherInsurance
class
CountryOtherStuff
class
CountryTransport
class
CountryPhoto
class
ScholarshipCountry
C
ultureCountry
-
up
-|>
BasicModuleCopyCountry
C
ountryCulture
-
up
-|>
BasicModuleCopyCountry
VisaAdministrative
-
up
-|>
BasicModuleCopyCountry
HealthAssurance
-
up
-|>
BasicModuleCopyCountry
TransportCountry
-
up
-|>
BasicModuleCopyCountry
OtherInsurance
-
up
-|>
BasicModuleCopyCountry
HealthInsurance
-
up
-|>
BasicModuleCopyCountry
CountryOtherStuff
-
up
-|>
BasicModuleCopyCountry
CountryTransport
-
up
-|>
BasicModuleCopyCountry
Photo
Country
-
up
-|>
PhotoCopyCountry
Country
Photo
-
up
-|>
PhotoCopyCountry
ScholarshipCountry
-
up
-|>
ScholarShipCopyCountry
class
CountryVirtualCopy
as
"Country"
<
copy
for
\
n
cleaner
UML
>
#
lightgrey
C
ultureCountry
"1"
-
down
[
bold
,#
green
]-
"1"
CountryVirtualCopy
C
ountryCulture
"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
}
...
...
rex/admin.py
View file @
9e062621
...
...
@@ -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
:
...
...
rex/migrations/0020_auto_20180821_1451.py
0 → 100644
View file @
9e062621
# 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'
)},
),
]
rex/models/location/__init__.py
View file @
9e062621
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
rex/models/location/countryBasicModules.py
0 → 100644
View file @
9e062621
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
rex/models/location/countryPhoto.py
0 → 100644
View file @
9e062621
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
rex/models/location/countryScholarship.py
0 → 100644
View file @
9e062621
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
rex/urls.py
View file @
9e062621
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment