update SerializerMethodField example in docs (#7858)

* update SerializerMethodField example

* fix formatting
This commit is contained in:
Joe Michelini 2021-03-22 08:08:19 -04:00 committed by GitHub
parent 7e3dd9cd1b
commit 71e6c30034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -583,6 +583,7 @@ The serializer method referred to by the `method_name` argument should accept a
class Meta:
model = User
fields = '__all__'
def get_days_since_joined(self, obj):
return (now() - obj.date_joined).days