Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
c6118659
Commit
c6118659
authored
Mar 24, 2017
by
Daniel W Bond
Browse files
happy times are here again for serializers on drf 3.3+
parent
17379e27
Changes
1
Hide whitespace changes
Inline
Side-by-side
whats_open/website/serializers.py
View file @
c6118659
...
...
@@ -4,18 +4,18 @@ from website.models import Category, Facility, Schedule, OpenTime
class
CategorySerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
Category
#
fields = '__all__'
fields
=
'__all__'
class
OpenTimeSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
OpenTime
#
fields = '__all__'
fields
=
'__all__'
class
ScheduleSerializer
(
serializers
.
ModelSerializer
):
open_times
=
OpenTimeSerializer
(
many
=
True
,
read_only
=
True
)
class
Meta
:
model
=
Schedule
#
fields = ( 'id', 'open_times', '
last_
modified', 'name', 'valid_start', 'valid_end' )
fields
=
(
'id'
,
'open_times'
,
'modified'
,
'name'
,
'valid_start'
,
'valid_end'
)
class
FacilitySerializer
(
serializers
.
HyperlinkedModelSerializer
):
category
=
CategorySerializer
(
many
=
False
,
read_only
=
True
)
...
...
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