-
Notifications
You must be signed in to change notification settings - Fork 4
Migrated authentication and registration application from FBV to CBV #341
Conversation
@amruthasangeeth Tests are failing. :( @smarshy Is this obvious that with this change tests will fail? |
@tapasweni-pathak There are failures across 80 tests, and most of them are showing unable to locate username and login panel. I think tests are accessing pages, which now no longer have the same content @amruthasangeeth Have you changed urls? |
@smarshy Yes, The url syntax for CBV is different. There is no change in the url name or path. I had to change the function name to view name. |
@amruthasangeeth The functional tests are failing; they don't access the view names or function names. So any change you do there would not be a problem, unless you are making logical changes in the functionality. However, they do hit urls directly. Currently, login maps to |
@@ -16,4 +22,7 @@ | |||
url(r'^registration/', include('registration.urls', namespace='registration')), | |||
url(r'^shift/', include('shift.urls', namespace='shift')), | |||
url(r'^volunteer/', include('volunteer.urls', namespace="volunteer")), | |||
url(r'^portal', TemplateView.as_view(template_name='home/home.html'), name='home'), | |||
url(r'^login/$', anonymous_required(auth_views.login), {'template_name': 'authentication/login.html'}, name='login_process'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amruthasangeeth I think urls are changing here. They have been shifted from the authentication app to the main urls.py file. Please recheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have added the authentication urls to the main urls.py. Is it creating issues? Should I revert it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amruthasangeeth Any specific reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I frequently come across this exception in the build. I think it is not getting directed to the correct login page due to change in url. If the url changes are not necessary, please revert them back to the initial ones. (link old urls itself to your new views) Also, I think there is a url already mapping to the home page in the urls.py. Isn't the portal/
url linking to the same template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smarshy Thats nice
@smarshy @amruthasangeeth I think I messed up in the planning. Some changes will affect the test cases, no matter what. We need to reduce the rework. @smarshy Ping me when you are free, on Slack. @amruthasangeeth is having her final year project presentation. We both will discuss and then we three will have a meeting. |
@smarshy @tapasweni-pathak Alright |
@amruthasangeeth I think I was not clear with my previous comment. You need to accomodate the changes that @smarshy is suggesting. You need to pass as many test cases as possible without affecting the functionality of the change you are doing. Rework is for @smarshy, I remember she pointed out this in the start. I have send both of you a mail describing the situation, please follow it. In case of confict or any help I will pitch in. |
@amruthasangeeth The ones failing are basically selenium tests. The way selenium webdriver is working is - it goes to the webpage, finds elements and triggers actions by interacting with them. Since the webdriver has no knowledge of the underlying views (what the names are etc.), so any changes done to refactor the view wouldn't cause problems. But if there are changes made to the url, then the webdriver wouldn't be able to reach the page itself or if the template is changed, it might not be able to detect the elements. This is why there will be issues incase url/template is changed. I had a look at the entire build. This error keeps popping up -
Are there packages which need to be installed to get this PR running? Please send me a list of the new ones then. I will need to update travis/requirements accordingly. |
For the issue you mentioned about braces.views you need to install python-django-braces. I think that will work. And for the issue regarding the url change for authentication, can I make a PR to revert it back to the authentication/urls.py. I think we can have discussion on this. |
@amruthasangeeth Would there be a problem in changing the urls in this PR? Mapping the same views but to the original urls in urls.py. Because right now it is unconfirmed if these are the only reasons for failures. Once we complete changes, build needs to be re-run to see if issues are fixed. |
@amruthasangeeth I am fine with you making a new pull request. Creating a new pull request is the easiest thing to do but that also stops you from learning something new. Less rework is needed in updating this one. Try updating this pull request itself. You need to rebase the changes and then force push here. Let me know if you need any help. |
@amruthasangeeth One more thing keep a note of the new packages that you are installing and write them in the description of the pull request. When you install it in your local machine, write it down so that you will not forget. There are many places where we are documenting them. Travis, our documentation, requirements file. Everything needs to updated. Update the description of this pull request explaining why we need django-braces. |
@amruthasangeeth Did you get the time to fix this? |
Coverage decreased (-0.02%) to 94.131% when pulling 268a7d3298575cb2dd3843c679c919e0e03f19ea on amruthasangeeth:shiftRegToCBV into f3eda78 on systers:develop. |
Coverage decreased (-0.02%) to 94.131% when pulling 5c9d35e07e1bcd3878c16a1af0c05ce7ff6bcc2c on amruthasangeeth:shiftRegToCBV into f3eda78 on systers:develop. |
Coverage increased (+0.04%) to 94.195% when pulling 85d741849cf21da68bb934c8e52a156f65d0f5aa on amruthasangeeth:shiftRegToCBV into f3eda78 on systers:develop. |
Coverage decreased (-0.02%) to 94.131% when pulling 85d741849cf21da68bb934c8e52a156f65d0f5aa on amruthasangeeth:shiftRegToCBV into f3eda78 on systers:develop. |
@@ -62,6 +62,11 @@ | |||
</div> | |||
</div> | |||
{% endif %} | |||
{% if form.errors %} | |||
<div class="alert alert-danger"> | |||
<i class="fa fa-warning"></i> "Your username and password didn't match. Please try again." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amruthasangeeth Are we using fa fa icons anywhere in VMS? If not, it is better to show the message without this.
Coverage decreased (-0.04%) to 94.135% when pulling 40ba7a56fc09c6280abe97d222fab09971ddaced on amruthasangeeth:shiftRegToCBV into 123f69b on systers:develop. |
Coverage decreased (-0.1%) to 82.631% when pulling 2dd8ac77b18e1b0efd90b3997baa4d711ccffcff on amruthasangeeth:shiftRegToCBV into 4436a63 on systers:develop. |
@tapasweni-pathak I have done the suggested changes. Can you please look at it. |
{% if form.errors %} | ||
<div class="alert alert-danger"> | ||
"Your username and password didn't match. Please try again." | ||
</div> <!-- alert alert-danger --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amruthasangeeth When I enter wrong username or/and password I get this. How can I get the above error on the UI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tapasweni-pathak I am getting the correct one. Let me check it. Or can you try it in incognito window
Migrated authentication application from CBV using Django's auth views. It used function based views for login and logout process earlier. Registration application is migrated to TemplateView based calls view which allows administrator and volunteer signup. Also implemented generating a message when username and password mismatches and phone number error. Updated requirements to avoid tests failure, and corrected URLs
Closing down in favor of #367 |
Migrated authentication application from CBV using Django's auth views. It used function based views for login and logout process earlier. Registration application which allows administrator and volunteer signup is migrated to TemplateView which displays a signup form.
Referenced to #288