Backends RegistrationView with multiple 'things'


#1

Hi,

Well, I’ve been a busy beaver and I have come across a slight problem that I have not been able to fathom. If I wanted to have more than one ‘thing’, such as Client and Contact, how would I use the below code from hellowebapp to redirect back to the correct URL - ie registration_create_client or registration_create_contact.

Also, I take it that if I wanted all users to access everything everyone else has done, then I should be able to omit this part, n’est pas? However, I think that would be too dangerous and I would only want authorised users to create, edit and delete etc., but I’m not sure on how to implement a global registration and login.

from registration.backends.simple.views import RegistrationView

# my new reg view, subclassing RegistrationView from our plugin
class MyRegistrationView(RegistrationView):
    def get_success_url(self, request, user):
        # the named URL that we want to redirect to after
        # successful registration
        return ('registration_create_thing')

Regards

David


#2

Just making sure I understand correctly, you’re looking to have two different registration pages for the different things? Or one registration page that creates both a Client and Contact?


#3

Hi Tracy,

What I am after ideally would be just one registration/login for all of my ‘things’.


#4

If you want to have one page doing everything, rather than multiple pages, things definitely get more complicated. :) Could you just have a multi-part registration, where Step 1 creates the user, Step 2 creates the client, etc? It would be a lot simpler to build in the beginning, because you can use the steps I outlined in the HWA tutorial.


#5

Hi, I actually have multiple models and these are separated with their different pages. I have managed to get everything going fairly well. Progress is slow and due to work constraints I have not been able to spend much time on it lately.
There is a registration section and you have to log in to be able to use the “site”, but only once.
When I return home later, I will post what I have done so far so that you can see.


#6

Hi,
Here is my source code for one of my projects to give you an idea of what I am doing.

https://bitbucket.org/DavidJ61/client-admin/src

David


#7

Cool — so you got something working then?


#8

Hi, sorry for the delay in replying. I have managed to do this but other things started getting too complicated in other areas for my level of understanding so I decided to create another more manageable and simpler project.
I will post what I have done later today, so that you can see and also for those that may wish to use the code as an example.


#9

As promised, here is my code on bitbucket for this once only login for multiple models…
It does have some bootstrap3 code as well but it is far from finished.

https://bitbucket.org/DavidJ61/client-admin/src

David

(ha ha - I just realised that I already posted this link above