Search code examples
djangoaccountactivationdjoser

Djoser: trigger action on user account activation


I have djoser integrated on my django project, and I need to create a stripe customer_id on account activation, how can I do this?

I've been searching on djoser doc, but there is nothing about customizing activation, or passing a callback method.


Solution

  • Djoser provides user_activated signal. It is usable just like ordinary django signal. It's undocumented but working.

    Example usage

    from django.dispatch import receiver
    
    from djoser.signals import user_activated
    
    @receiver(user_activated)
    def my_handler(user, request):
        # do what you need here