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
thalia
concrexit
Commits
f09761fe
Commit
f09761fe
authored
Feb 22, 2018
by
Gijs Hendriksen
Browse files
Remove HTML escaping in the event description API
parent
a42b0e4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/events/api/serializers.py
View file @
f09761fe
from
django.templatetags.static
import
static
from
django.urls
import
reverse
from
django.utils
import
timezone
from
django.utils.html
import
strip_tags
from
django.utils.html
import
strip_tags
,
strip_spaces_between_tags
from
html
import
unescape
from
rest_framework
import
serializers
from
rest_framework.fields
import
empty
...
...
@@ -12,6 +12,7 @@ from events.exceptions import RegistrationError
from
events.models
import
Event
,
Registration
,
RegistrationInformationField
from
pizzas.models
import
PizzaEvent
from
thaliawebsite.settings
import
settings
from
thaliawebsite.templatetags.bleach_tags
import
bleach
class
CalenderJSSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -147,7 +148,7 @@ class EventRetrieveSerializer(serializers.ModelSerializer):
return
self
.
REGISTRATION_NOT_NEEDED
def
_description
(
self
,
instance
):
return
unescape
(
strip_tags
(
instance
.
description
))
return
strip_spaces_between_tags
(
bleach
(
instance
.
description
))
def
_num_participants
(
self
,
instance
):
if
(
instance
.
max_participants
and
...
...
Write
Preview
Supports
Markdown
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