Verified Commit c7507415 authored by Gijs Hendriksen's avatar Gijs Hendriksen Committed by Sébastiaan Versteeg
Browse files

Stripped tags from event descriptions

parent 2abd6307
......@@ -91,6 +91,9 @@ class UnpublishedEventSerializer(CalenderJSSerializer):
class EventDataSerializer(serializers.ModelSerializer):
description = serializers.CharField(source='stripped_description')
class Meta:
model = Event
fields = ('title', 'description', 'start', 'end', 'organiser',
......@@ -98,6 +101,9 @@ class EventDataSerializer(serializers.ModelSerializer):
class EventDataForEventListSerializer(serializers.ModelSerializer):
description = serializers.CharField(source='stripped_description')
class Meta:
model = Event
fields = ('title', 'description', 'start',
......
......@@ -6,6 +6,7 @@ from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.text import format_lazy
from django.utils.html import strip_tags
from tinymce.models import HTMLField
from thaliawebsite.settings import settings
......@@ -176,6 +177,10 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
else:
return Event.REGISTRATION_NOT_NEEDED
@property
def stripped_description(self):
return strip_tags(self.description)
def clean(self):
super().clean()
errors = {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment