Skip to content

Instantly share code, notes, and snippets.

Avatar
🛵
here and there ...

Jakub Miazek grillazz

🛵
here and there ...
View GitHub Profile
@grillazz
grillazz / serializers.py
Created Sep 24, 2019
DRF overwriting __init__ for Serializer to conditionally add fields.
View serializers.py
from rest_framework.serializers import HyperlinkedModelSerializer
from dry_rest_permissions.generics import DRYPermissionsField
from .models import CustomUser
class CustomUserSerializer(HyperlinkedModelSerializer):
permissions = DRYPermissionsField(additional_actions=["activate", "deactivate"])
class Meta:
View keybase.md

Keybase proof

I hereby claim:

  • I am grillazz on github.
  • I am grillazz (https://keybase.io/grillazz) on keybase.
  • I have a public key ASA146K8yDmIuhpImRdIBDvs3uC5vwGWgRoYDkdL1zcHhwo

To claim this, I am signing this object: