robogals / myrobogals

myRobogals is the global intranet and record-keeping tool for Robogals. It has been built to simplify many of our day-to-day tasks including organising school visits, maintaining a member database, communicating with members, storing records reliably for future generations and easily collecting statistics on a global scale.
https://my.robogals.org
10 stars 21 forks source link

change username issue #37

Closed juneesingh17 closed 11 years ago

juneesingh17 commented 11 years ago

Now displays the username textbox, so that the user can change the username using the edit profile form. UPDATE: I cold not add another pull request, as there was an existing one already. So I have updated this request with my comments for the task, "Add a new workshop link" I got the page Workshops -> Schools to redirect to Add a New Workshop page, but without the school selected. Now, the newvisit() method simply calls the editvisit() with the visit_id set to 0. I could not use the newvisit(), as I wanted the school to be selected already and so setting the visit_id to 0 would mean it would not look for the school in the SchoolVisit table at all. Also, the editvisit() function takes only visit_id as an argument. I could have made it to accept school_id as an argument as well (making things way easier), but that would require changing EVERY function that calls the editvisit function, and I wanted to keep that option as a last resort. And the editvisit() method gets the value for "school" from the form data; sending it a school_id didn't seem very right.

So, I have created another function called newvisit_with_school_selected() that creates a new SchoolVisit() instance and gets the visit_id from that object.In order to do that, I had to create default values for chapter, visit_start, visit_end and location, as these are required fields. Also, the redirection leads to Edit Workshop page instead of Add a New Workshop with this method. Let me know if this works for you, or would you rather I change the editvisit() function to accept a school id as well? Thanks!

U-238 commented 11 years ago

You need to check that the new username is valid and is not already taken by another user. See rgprofile/views.py lines 690 - 701. This only needs to be checked if the username is being changed (so if form input for "username" is different to the existing username)

juneesingh17 commented 11 years ago

Suggested changes implemented.