Skip to content

Instantly share code, notes, and snippets.

here and there ...

Jakub Miazek grillazz

here and there ...
View GitHub Profile
grillazz /
Created Sep 24, 2019
DRF overwriting __init__ for Serializer to conditionally add fields.
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:

Keybase proof

I hereby claim:

  • I am grillazz on github.
  • I am grillazz ( on keybase.
  • I have a public key ASA146K8yDmIuhpImRdIBDvs3uC5vwGWgRoYDkdL1zcHhwo

To claim this, I am signing this object: