Skip to content
GitLab
Menu
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
9e4abdc1
Commit
9e4abdc1
authored
Sep 15, 2018
by
Florent Chehab
Browse files
Migrations cleaned and changed some models
parent
d7857613
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
backend/migrations/0001_initial.py
View file @
9e4abdc1
This diff is collapsed.
Click to expand it.
backend/migrations/0002_auto_20180910_1700.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-10 15:00
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'campustaggeditem'
,
name
=
'title'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
150
),
),
migrations
.
AddField
(
model_name
=
'citytaggeditem'
,
name
=
'title'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
150
),
),
migrations
.
AddField
(
model_name
=
'countrytaggeditem'
,
name
=
'title'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
150
),
),
migrations
.
AddField
(
model_name
=
'universitytaggeditem'
,
name
=
'title'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
150
),
),
]
backend/migrations/0003_auto_20180910_1731.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-10 15:31
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0002_auto_20180910_1700'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'campustaggeditem'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'citytaggeditem'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'countrydri'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'countryscholarship'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'countrytaggeditem'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'universitydri'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'universityinfo'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'universityscholarship'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'universitysemestersdates'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
migrations
.
AlterField
(
model_name
=
'universitytaggeditem'
,
name
=
'comment'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
),
),
]
backend/migrations/0004_auto_20180910_1834.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-10 16:34
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0003_auto_20180910_1731'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'universityinfo'
,
name
=
'costs_currency'
,
field
=
models
.
ForeignKey
(
default
=
'EUR'
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'backend.Currency'
),
),
]
backend/migrations/0005_auto_20180910_1846.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-10 16:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0004_auto_20180910_1834'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'countryscholarship'
,
name
=
'frequency'
,
field
=
models
.
CharField
(
choices
=
[(
'w'
,
'week'
),
(
'm'
,
'month'
),
(
's'
,
'semester'
),
(
'y'
,
'year'
),
(
'o'
,
'one_shot'
)],
default
=
'm'
,
max_length
=
1
),
),
migrations
.
AddField
(
model_name
=
'universityscholarship'
,
name
=
'frequency'
,
field
=
models
.
CharField
(
choices
=
[(
'w'
,
'week'
),
(
'm'
,
'month'
),
(
's'
,
'semester'
),
(
'y'
,
'year'
),
(
'o'
,
'one_shot'
)],
default
=
'm'
,
max_length
=
1
),
),
]
backend/migrations/0006_auto_20180910_2144.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-10 19:44
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0005_auto_20180910_1846'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'countrydri'
,
old_name
=
'country'
,
new_name
=
'countries'
,
),
migrations
.
RenameField
(
model_name
=
'countryscholarship'
,
old_name
=
'country'
,
new_name
=
'countries'
,
),
migrations
.
RenameField
(
model_name
=
'offer'
,
old_name
=
'specialty'
,
new_name
=
'specialties'
,
),
migrations
.
RenameField
(
model_name
=
'universitydri'
,
old_name
=
'university'
,
new_name
=
'universities'
,
),
migrations
.
RenameField
(
model_name
=
'universityscholarship'
,
old_name
=
'university'
,
new_name
=
'universities'
,
),
]
backend/migrations/0007_auto_20180911_1114.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-11 09:14
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0006_auto_20180910_2144'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'userdata'
,
name
=
'id'
,
),
migrations
.
AlterField
(
model_name
=
'userdata'
,
name
=
'owner'
,
field
=
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
primary_key
=
True
,
serialize
=
False
,
to
=
settings
.
AUTH_USER_MODEL
),
),
]
backend/migrations/0008_auto_20180911_1147.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-11 09:47
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0007_auto_20180911_1114'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'universityinfo'
,
name
=
'costs_currency'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'backend.Currency'
),
),
]
backend/migrations/0009_auto_20180911_1622.py
deleted
100644 → 0
View file @
d7857613
# Generated by Django 2.0.3 on 2018-09-11 14:22
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0008_auto_20180911_1147'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'campus'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'campustaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'citytaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'countrydri'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'countryscholarship'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'countrytaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universitydri'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universityinfo'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universityscholarship'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universitysemestersdates'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
migrations
.
RenameField
(
model_name
=
'universitytaggeditem'
,
old_name
=
'usefull_links'
,
new_name
=
'useful_links'
,
),
]
backend/models/abstract/basic_module/basicModule.py
View file @
9e4abdc1
...
@@ -12,7 +12,7 @@ IMPORTANCE_LEVEL = (
...
@@ -12,7 +12,7 @@ IMPORTANCE_LEVEL = (
class
BasicModule
(
MyModelVersionned
):
class
BasicModule
(
MyModelVersionned
):
title
=
models
.
CharField
(
default
=
""
,
max_length
=
150
)
comment
=
models
.
TextField
(
blank
=
True
,
default
=
""
)
comment
=
models
.
TextField
(
blank
=
True
,
default
=
""
)
useful_links
=
JSONField
(
default
=
list
)
useful_links
=
JSONField
(
default
=
list
)
importance_level
=
models
.
CharField
(
importance_level
=
models
.
CharField
(
...
...
backend/models/abstract/taggedItem/taggedItem.py
View file @
9e4abdc1
...
@@ -7,7 +7,6 @@ from backend.fields import JSONField
...
@@ -7,7 +7,6 @@ from backend.fields import JSONField
class
TaggedItem
(
BasicModule
):
class
TaggedItem
(
BasicModule
):
tag
=
models
.
ForeignKey
(
Tag
,
related_name
=
'+'
,
on_delete
=
models
.
PROTECT
)
tag
=
models
.
ForeignKey
(
Tag
,
related_name
=
'+'
,
on_delete
=
models
.
PROTECT
)
title
=
models
.
CharField
(
default
=
""
,
max_length
=
150
)
custom_content
=
JSONField
(
default
=
dict
)
custom_content
=
JSONField
(
default
=
dict
)
class
Meta
:
class
Meta
:
...
...
backend/models/campus/campus.py
View file @
9e4abdc1
from
django.db
import
models
from
django.db
import
models
from
backend.models.abstract.
basic
_mod
ul
e
import
BasicModule
,
BasicModuleSerializer
,
BasicModule
ViewSet
from
backend.models.abstract.
my
_mode
l
import
MyModelVersionned
,
MyModelVersionnedSerializer
,
MyModelVersionned
ViewSet
from
backend.models.city
import
City
from
backend.models.city
import
City
from
backend.models.university
import
University
from
backend.models.university
import
University
from
django.core.validators
import
MinValueValidator
,
MaxValueValidator
from
django.core.validators
import
MinValueValidator
,
MaxValueValidator
from
backend.utils
import
get_model_config
,
get_viewset_permissions
from
backend.utils
import
get_model_config
,
get_viewset_permissions
class
Campus
(
BasicModule
):
class
Campus
(
MyModelVersionned
):
model_config
=
get_model_config
(
"Campus"
)
model_config
=
get_model_config
(
"Campus"
)
is_main_campus
=
models
.
BooleanField
(
null
=
False
)
is_main_campus
=
models
.
BooleanField
(
null
=
False
)
...
@@ -41,20 +41,20 @@ class Campus(BasicModule):
...
@@ -41,20 +41,20 @@ class Campus(BasicModule):
unique_together
=
(
'is_main_campus'
,
'university'
)
unique_together
=
(
'is_main_campus'
,
'university'
)
class
CampusSerializer
(
BasicModule
Serializer
):
class
CampusSerializer
(
MyModelVersionned
Serializer
):
class
Meta
:
class
Meta
:
model
=
Campus
model
=
Campus
fields
=
'__all__'
fields
=
'__all__'
class
CampusViewSet
(
BasicModule
ViewSet
):
class
CampusViewSet
(
MyModelVersionned
ViewSet
):
permission_classes
=
get_viewset_permissions
(
"CampusViewSet"
)
permission_classes
=
get_viewset_permissions
(
"CampusViewSet"
)
queryset
=
Campus
.
objects
.
all
()
# pylint: disable=E1101
queryset
=
Campus
.
objects
.
all
()
# pylint: disable=E1101
serializer_class
=
CampusSerializer
serializer_class
=
CampusSerializer
class
MainCampusViewSet
(
BasicModule
ViewSet
):
class
MainCampusViewSet
(
MyModelVersionned
ViewSet
):
permission_classes
=
get_viewset_permissions
(
"MainCampusViewSet"
)
permission_classes
=
get_viewset_permissions
(
"MainCampusViewSet"
)
queryset
=
Campus
.
objects
.
filter
(
is_main_campus
=
True
)
queryset
=
Campus
.
objects
.
filter
(
is_main_campus
=
True
)
serializer_class
=
CampusSerializer
serializer_class
=
CampusSerializer
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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