Conversation
|
|
||
| class SignedRecipeSerializer(serializers.ModelSerializer): | ||
| signature = SignatureSerializer() | ||
| recipe = serializers.SerializerMethodField() |
There was a problem hiding this comment.
The docs suggest you can just use RecipeSerializer as the field and get the same effect: http://www.django-rest-framework.org/api-guide/relations/#nested-relationships
There was a problem hiding this comment.
I tried that first. The problem is that this serializer is serializing a Recipe, and needs to pass itself to the nested serializer. If this line were just recipe = RecipeSerializer(), it would try and look for self.recipe, which doesn't exist. I also couldn't figure out anything I could supply as the source for the serializer to make it point to itself either.
|
Just to check my understanding: Signatures are meant to be deleted when they're invalidated, right? Also, this PR doesn't include creating signatures outside of the management command. That's waiting for peer signing, right? And will block this branch from getting merged? |
| @@ -0,0 +1,27 @@ | |||
| from datetime import datetime | |||
There was a problem hiding this comment.
I wasn't sure there were working just right. So I tested it.
|
Missing tests for Alright, I think that covers my first pass. Nice work thusfar! |
| signatures = list(Recipe.objects.all().values_list('signature__signature', flat=True)) | ||
| assert signatures == ['fake signature', 'fake signature'] | ||
|
|
||
| def test_update_signatures_increments_revision_id(self, mocker): |
There was a problem hiding this comment.
We talked offline about removing this test, let's not keep it.
|
r+wc if the tests pass after you remove that failure |

Retargeting #180 at a branch.
@Osmose r?