diff options
Diffstat (limited to 'patchwork/api/event.py')
-rw-r--r-- | patchwork/api/event.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/patchwork/api/event.py b/patchwork/api/event.py index 75bf870..71f9593 100644 --- a/patchwork/api/event.py +++ b/patchwork/api/event.py @@ -33,10 +33,8 @@ class EventSerializer(ModelSerializer): current_delegate = UserSerializer() created_check = SerializerMethodField() created_check = CheckSerializer() - previous_relation = PatchSerializer( - source='previous_relation.patches', many=True, default=None) - current_relation = PatchSerializer( - source='current_relation.patches', many=True, default=None) + previous_relation = SerializerMethodField() + current_relation = SerializerMethodField() _category_map = { Event.CATEGORY_COVER_CREATED: ['cover'], @@ -53,6 +51,12 @@ class EventSerializer(ModelSerializer): Event.CATEGORY_SERIES_COMPLETED: ['series'], } + def get_previous_relation(self, instance): + return None + + def get_current_relation(self, instance): + return None + def to_representation(self, instance): data = super(EventSerializer, self).to_representation(instance) payload = OrderedDict() @@ -72,10 +76,12 @@ class EventSerializer(ModelSerializer): class Meta: model = Event - fields = ('id', 'category', 'project', 'date', 'actor', 'patch', - 'series', 'cover', 'previous_state', 'current_state', - 'previous_delegate', 'current_delegate', 'created_check', - 'previous_relation', 'current_relation',) + fields = ( + 'id', 'category', 'project', 'date', 'actor', 'patch', + 'series', 'cover', 'previous_state', 'current_state', + 'previous_delegate', 'current_delegate', 'created_check', + 'previous_relation', 'current_relation', + ) read_only_fields = fields versioned_fields = { '1.2': ('actor', ), |