Avoid fetching Actor object on every request authentication

This commit is contained in:
Eliot Berriot 2018-04-28 00:25:47 +02:00
parent e0fce26820
commit 6dcde77b1e
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
8 changed files with 63 additions and 17 deletions

View file

@ -103,9 +103,10 @@ class ActorSerializer(serializers.Serializer):
def save(self, **kwargs):
d = self.prepare_missing_fields()
d.update(kwargs)
return models.Actor.objects.create(
**d
)
return models.Actor.objects.update_or_create(
url=d['url'],
defaults=d,
)[0]
def validate_summary(self, value):
if value: