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
thalia
concrexit
Commits
6ecb419f
Commit
6ecb419f
authored
Oct 03, 2018
by
Gijs Hendriksen
Browse files
Add the Google Maps url to the events api
parent
60a089c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/events/api/serializers.py
View file @
6ecb419f
...
...
@@ -13,6 +13,7 @@ from events.exceptions import RegistrationError
from
events.models
import
Event
,
Registration
,
RegistrationInformationField
from
pizzas.models
import
PizzaEvent
from
thaliawebsite.templatetags.bleach_tags
import
bleach
from
utils.snippets
import
create_google_maps_url
class
CalenderJSSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -114,7 +115,8 @@ class EventRetrieveSerializer(serializers.ModelSerializer):
'cancel_deadline'
,
'location'
,
'map_location'
,
'price'
,
'fine'
,
'max_participants'
,
'num_participants'
,
'status'
,
'user_registration'
,
'registration_allowed'
,
'no_registration_message'
,
'has_fields'
,
'is_pizza_event'
)
'no_registration_message'
,
'has_fields'
,
'is_pizza_event'
,
'google_maps_url'
)
description
=
serializers
.
SerializerMethodField
(
'_description'
)
user_registration
=
serializers
.
SerializerMethodField
(
'_user_registration'
)
...
...
@@ -123,6 +125,7 @@ class EventRetrieveSerializer(serializers.ModelSerializer):
'_registration_allowed'
)
has_fields
=
serializers
.
SerializerMethodField
(
'_has_fields'
)
is_pizza_event
=
serializers
.
SerializerMethodField
(
'_is_pizza_event'
)
google_maps_url
=
serializers
.
SerializerMethodField
(
'_google_maps_url'
)
status
=
serializers
.
SerializerMethodField
(
'_status'
)
# DEPRECATED
REGISTRATION_NOT_NEEDED
=
-
1
...
...
@@ -181,6 +184,9 @@ class EventRetrieveSerializer(serializers.ModelSerializer):
def
_is_pizza_event
(
self
,
instance
):
return
instance
.
is_pizza_event
()
def
_google_maps_url
(
self
,
instance
):
return
create_google_maps_url
(
instance
.
map_location
,
zoom
=
13
,
size
=
'450x250'
)
class
EventListSerializer
(
serializers
.
ModelSerializer
):
"""Custom list serializer for events"""
...
...
Sébastiaan Versteeg
@sversteeg
mentioned in commit
301c4ed9
·
Oct 03, 2018
mentioned in commit
301c4ed9
mentioned in commit 301c4ed963215a93e9437ace8deeb2d2d16157f2
Toggle commit list
Sébastiaan Versteeg
@sversteeg
mentioned in commit
22f24725
·
Oct 03, 2018
mentioned in commit
22f24725
mentioned in commit 22f247252baef6d7d960da17b75e85ecfbda01fe
Toggle commit list
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