diff options
author | Stephen Finucane <stephen@that.guru> | 2020-10-01 14:38:31 +0100 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2020-12-13 18:22:12 +0000 |
commit | fe07f30df6fe263938b1f898ffffc354c4ff470c (patch) | |
tree | d28268964255a3957db464a366ddc923b61acf5e /patchwork/api/event.py | |
parent | 8092f8f4f59ea5581180a13994eb090d24394206 (diff) | |
download | patchwork-fe07f30df6fe263938b1f898ffffc354c4ff470c.tar patchwork-fe07f30df6fe263938b1f898ffffc354c4ff470c.tar.gz |
Remove 'PatchRelationSerializer'
This wasn't writeable for reasons I haven't been able to figure out.
However, it's not actually needed: the 'PatchSerializer' can do the job
just fine, given enough information. This exposes a bug in DRF, which
has been reported upstream [1]. While we wait for that fix, or some
variant of it, to be merged, we must monkey patch the library.
[1] https://github.com/encode/django-rest-framework/issues/7550
[2] https://github.com/encode/django-rest-framework/pull/7574
Signed-off-by: Stephen Finucane <stephen@that.guru>
Reported-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Closes: #379
Cc: Daniel Axtens <dja@axtens.net>
Cc: Rohit Sarkar <rohitsarkar5398@gmail.com>
Diffstat (limited to 'patchwork/api/event.py')
-rw-r--r-- | patchwork/api/event.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/patchwork/api/event.py b/patchwork/api/event.py index 7ed9efb..75bf870 100644 --- a/patchwork/api/event.py +++ b/patchwork/api/event.py @@ -13,7 +13,6 @@ from rest_framework.serializers import SlugRelatedField from patchwork.api.embedded import CheckSerializer from patchwork.api.embedded import CoverSerializer from patchwork.api.embedded import PatchSerializer -from patchwork.api.embedded import PatchRelationSerializer from patchwork.api.embedded import ProjectSerializer from patchwork.api.embedded import SeriesSerializer from patchwork.api.embedded import UserSerializer @@ -34,8 +33,10 @@ class EventSerializer(ModelSerializer): current_delegate = UserSerializer() created_check = SerializerMethodField() created_check = CheckSerializer() - previous_relation = PatchRelationSerializer(read_only=True) - current_relation = PatchRelationSerializer(read_only=True) + previous_relation = PatchSerializer( + source='previous_relation.patches', many=True, default=None) + current_relation = PatchSerializer( + source='current_relation.patches', many=True, default=None) _category_map = { Event.CATEGORY_COVER_CREATED: ['cover'], |