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
Rex Dri
Rex Dri
Commits
e8065082
Commit
e8065082
authored
Aug 21, 2018
by
Florent Chehab
Browse files
CityModules added
parent
11a6fd82
Pipeline
#26372
passed with stages
in 1 minute and 27 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
docs/UML/Architecture.pu
View file @
e8065082
...
...
@@ -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
...
...
docs/UML/CityModules.pu
0 → 100644
View file @
e8065082
@
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
docs/UML/Makefile
View file @
e8065082
...
...
@@ -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
...
...
docs/architecture.md
View file @
e8065082
...
...
@@ -11,5 +11,6 @@ Vue plus précise :






\ No newline at end of file
rex/admin.py
View file @
e8065082
...
...
@@ -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
:
...
...
rex/migrations/0022_auto_20180821_1516.py
0 → 100644
View file @
e8065082
# 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'
)},
),
]
rex/models/location/__init__.py
View file @
e8065082
...
...
@@ -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
rex/models/location/cityBasicModules.py
0 → 100644
View file @
e8065082
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
rex/models/location/cityPhoto.py
0 → 100644
View file @
e8065082
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
rex/urls.py
View file @
e8065082
...
...
@@ -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/t
ransport
'
,
CountryTourismViewSet
)
router
.
register
(
r
'country_more/t
ourism
'
,
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
)
...
...
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