lambdalisue/django-inspectional-registration

Using the Registration Backend Base

andrewfam opened this issue · 3 comments

Hi,

I need to have a custom view where a user of my website can accept and manage the registrations without going into the Django admin.

I see that there is class registration.backends.RegistrationBackendBase and accept -- accept a registration. How do i go about using this? Do i do a url or extend it?

You can get current backend instance with registration.backends.get_backend() function.
If you don't specify the argument (path) of the function, the function will return backend instance which was specified in settings module.

https://django-inspectional-registration.readthedocs.org/en/latest/registration.backends.html#registration.backends.get_backend

And you can find the documentation for the default backend class at

https://django-inspectional-registration.readthedocs.org/en/latest/registration.backends.default.html#registration.backends.default.DefaultRegistrationBackend

So you can create your original view which accept, reject, activate user profiles.
If you need some permission systems, checkout djang-permission or django-gardian.
I'm sure that you need these kind of permission system if you are going to create your own management views.

Thanks. I tried the above with the following code but I'm getting a Not implemented Error.
reg_id = request.POST.get('reg_id', None)
rp = get_object_or_404(RegistrationProfile, id=reg_id)
get_backend()
rbackend = RegistrationBackendBase()
rbackend.accept(rp, request,send_email=True, message=None)

Try.

rbackend = get_backend()
rbackend.accept(rp, request, send_email=True, message=None)