Closed jMartich closed 2 years ago
Hello @jMartich , Django deprecated request.REQUEST in 1.7 and removed it in 1.9. Developers are advised to "Use the more explicit GET and POST instead." So replace request.REQUEST with GET, it sould works.
@bsab This is going to be a dumb question, but I'm still learning here.
The block that contains the line django is complaining about, looks like this:
def get_success_url(self): redirect_to = self.request.REQUEST.get(self.redirect_field_name) if not is_safe_url(url=redirect_to, host=self.request.get_host()): redirect_to = self.success_url return redirect_to
Am I replacing all the "request" throughout the document or just the capitalized one in this block?
@jMartich only in this block
So should it look like this?
def get_success_url(self): redirect_to = self.GET(self.redirect_field_name) if not is_safe_url(url=redirect_to, host=self.request.get_host()): redirect_to = self.success_url return redirect_to
Yes. Does it work?
Not quite, I'm still getting the "object has no attribute error" instead this time is defines "GET"; I'm sure I'm doing/did something wrong. I'm trying to push this to a QA environment, & hosting it differs from running it in virtualenv. If you'd like to setup some real-time collaboration time, let me know & I'll send you a certificate for the server I'm currently hosting this project on for QA purposes.
The redirect_to line should read:
redirect_to = self.GET.get(self.redirect_field_name)
You're missing a .get after the block capital GET.
I've got this running using uwsgi emperor which keeps it all within the virtualenv. Not sure if that's suitable to your needs however. Let us know how you get on :)
Good Morning Everyone, I've been making what I think is good progress on this project, with a few bumps along the way I need some assistance ironing out. The registration part of the portal works correctly, I can register a user, the portal adds it to the database, but then when its time to navigate, it doesn't let me. I noticed that on the UniFi Controller it shows the device trying to connect, but it says its unauthorized; at one point I just manually authorized the test device, then it was able to browse the web. As for the login error; as I mentioned before, the registration part works. It writes to the database and the user is added. However when the user goes back and tries to login I get this error from the apache error log:
response = view_func(request, *args, kwargs) File "/usr/lib64/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func return func.get(self, type(self))(*args2, *kwargs2) "/var/www/html/vHost2/jMtest/Wifi_Portal/views.py", line 123, in dispatch return super(UnifiUserLogin, self).dispatch(request, args, kwargs) "/usr/lib64/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch return handler(request, *args, kwargs) File "/usr/lib64/python2.7/site-packages/django/views/generic/edit.py", line 183, in post return self.form_valid(form) File "/var/www/html/vHost2/jMtest/Wifi_Portal/views.py", line 133, in form_valid return super(UnifiUserLogin, self).form_valid(form) File "/usr/lib64/python2.7/site-packages/django/views/generic/edit.py", line 79, in form_valid return HttpResponseRedirect(self.get_success_url()) File "/var/www/html/vHost2/jMtest/Wifi_Portal/views.py", line 136, in get_success_url redirect_to = self.request.REQUEST.get(self.redirect_field_name) AttributeError: 'WSGIRequest' object has no attribute 'REQUEST'**
I tried to keep that as short as possible, but made the part of interest bold here.
Here's a screenshot from the UniFi Controller
I'm going to ssh into the access-point and see what's happening on that that side, I'll post logs if I find anything of interest. Thanks in advance I hope someone can assist me with this issue.