Unable to overwrite RegistrationView in backends.py during "Thing" creation


#1

I keep getting this error:

get_success_url() missing 1 required positional argument: ‘user’

when trying to implement the new registration flow that involves the user creating their “thing” after signing up. I checked the method in my class ‘MyRegistrationView’, and the user argument is there. I tried rearranging the arguments (self, request, user) and the last argument is always overlooked, and an error is thrown saying that that argument is missing.

I cannot find anything online about this issue, so I figured it was best to reach out directly.

Thank you for any help you can offer, and kudos on the great book.


#2

Thanks for the kudos!

Can you copy/paste the relevant code either here or in pastebin.com so I can take a look? :)


#3

http://pastebin.com/vqBSzqWG

Does this chunk of code suffice? It’s just the relevant bits of each file. If you need more, let me know. The code also lives at https://github.com/jcquinlan/hellowebapp/tree/master/hellowebapp/collection if you want to see everything.

Thank you for the help. I have a job interview next week that involve Django development so I want to make sure I have the basics down. Thanks a ton!


#4

This might be causing an issue, in your urls.py:
https://www.dropbox.com/s/h9p8ip5szn2fb06/Screenshot%202016-04-01%2017.16.57.png?dl=0

You have /accounts twice in there, once to default urls and simple urls. I’d recommend sticking all related URLs in their own section, like here: https://github.com/hellowebapp/hellowebapp-code/blob/chapter-11/hellowebapp/urls.py

Try updating your urls.py and let me know if the problem still happens. :)


#5

So I reformatted my urls.py to make sure things were not duplicated, and I’m still getting the same error. I even copied the urls.py from your repo (and changed the names of routes to match my naming choices) and I still have the error. I’m very confused. I’m going to push the code to the repo I shared earlier if you want to take a look at it. I am going to take a look at my RegistrationView class again to see if the problem lies there. If that doesn’t work I’ll try StackOverflow or reddit I suppose.

Thanks for all your help!


#6

✨ FIGURED IT OUT ✨

django-registration-redux launched a new version!

The book says to install 1.3:

In 1.4, they changed the arguments taken for get_success_url.
Version 1.3: https://github.com/macropin/django-registration/blob/v1.3/registration/views.py#L56
Version 1.4: https://github.com/macropin/django-registration/blob/v1.4/registration/views.py#L70
(Note the arguments that get_success_url is taking and how it takes one less for the 1.4 version)

So you can either remove request from backends.py so it looks like this: def get_success_url(self, user):

Or, you can pip uninstall django-registration-redux then pip install django-registration-redux==1.3 to get the version that the book was written for.

FYI you have one other issue — your create-quote.html template is in the wrong directory. :)


ValueError at /accounts/create_thing/
#7

Thank you so much! You’re incredibly helpful/kind!


#8

Glad I could help!


#9

recently I got similar problem,I use django-registration-redux (1.4),and I have to removed the request parameter in backends.py within the get_success_url(self, request, user): -->get_success_url(self, user):,and then 1.4 can work well see the link in stack overflow