class ActivationResource(ModelResource): """ Activation Resource. Uses ``activation_view``, which must be an intance of class from ``registration`` package. Of course you also can write your own activation-view class, see https://django-registration.readthedocs.org/en/latest/views.html The resource expects a data POST with ``activation_key`` key. """ activation_view = ActivationView() class Meta: queryset = RegistrationProfile.objects.all() authorization = Authorization() allowed_methods = ['post'] def obj_create(self, bundle, **kwargs): if 'activation_key' not in bundle.data: raise BadRequest('You must pass activation_key') activated_user = self.activation_view.activate( bundle.request, bundle.data['activation_key']) if activated_user: return bundle raise BadRequest('Wrong activation_key')