Verified Commit 11ada359 authored by Luuk Scholten's avatar Luuk Scholten Committed by Sébastiaan Versteeg
Browse files

Move strip_tags event description to serializers

parent a75bd9a6
......@@ -91,20 +91,24 @@ class UnpublishedEventSerializer(CalenderJSSerializer):
class EventRetrieveSerializer(serializers.ModelSerializer):
description = serializers.CharField(source='stripped_description')
class Meta:
model = Event
fields = ('title', 'description', 'start', 'end', 'organiser',
'location', 'price', 'fine')
description = serializers.SerializerMethodField('_description')
class EventListSerializer(serializers.ModelSerializer):
def _description(self, instance):
return strip_tags(instance.description)
description = serializers.CharField(source='stripped_description')
class EventListSerializer(serializers.ModelSerializer):
class Meta:
model = Event
fields = ('title', 'description', 'start',
'location', 'price', 'id')
description = serializers.SerializerMethodField('_description')
def _description(self, instance):
return strip_tags(instance.description)
......@@ -6,7 +6,6 @@ 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
......@@ -177,10 +176,6 @@ 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