Added agenda validation
This commit is contained in:
parent
6e91a2ef92
commit
bcf73897c8
|
|
@ -230,6 +230,13 @@ class NewsBackOfficeBaseSerializer(NewsBaseSerializer):
|
|||
for locale in locales:
|
||||
if not attrs[key].get(locale):
|
||||
attrs[key][locale] = getattr(instance, key).get(locale)
|
||||
|
||||
if 'agenda' in attrs:
|
||||
agenda = models.Agenda.objects.get(attrs['agenda'])
|
||||
|
||||
if agenda.event_name is None or agenda.content is None:
|
||||
raise serializers.ValidationError({'agenda': _('Agenda is empty')})
|
||||
|
||||
return attrs
|
||||
|
||||
def create(self, validated_data):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user