-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for show username in member permissions page #660
Conversation
{{ user.get_full_name }} | ||
{% else %} | ||
{{ user.username }} | ||
{% endif %} |
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.
Your PR looks good. Just one little thing:
In lines 43 and 47 the username is displayed again. I think, we should add a condition that the username is only shown, when there is no full name. Consider using the with
template tag to avoid hitting the database multiple times.
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 just noticed that my comment doesn't make any sense. I shouldn't do code reviews on a Sunday morning. Please ignore and sorry for the confusion.
This PR looks good and is ready to go. Thanks for helping us! In the meantime, I have merged two other PRs into master. Could you please update your branch with those two commits. After that we can merge your additions. |
Thanks for the PR, @kavindya89! As Oliver says, you'll need to rebase over the latest changes to master (you can read about how we use Git here: https://devwiki.corp.cadasta.org/Git%20workflow). The intent of what you've done is exactly right, but I'd like to see the code organised slightly differently. Instead of having the if-then logic to determine the display name inside the templates, I think it would be better to have a This is something it's almost always a good idea to do in Django: put as much logic as you can into your models, and as little logic as possible into views and templates. Models are much easier to test, for one thing, but they also tend to be used by views and templates much more than things working in the opposite direction. |
@kavindya89 Please see my comment on PR #675, since I notice that all the same applies to you here! |
@ian-ross @oliverroick Sorry I was away from the PC for two days. Will do the needful |
No problem! There's no rush with these things. |
@ian-ross I have added a method to the model object. Can you verify the changes and let me know If I done it correctly? |
@ian-ross I noticed check failed. Is there anything I need to correct? |
@kavindya89 Yes. You can follow the "Details" link next to the test failure message to see what's happening on Travis. You can run all the integration tests locally in your VM using the |
@ian-ross thank you. Yep I did it and fixed it. |
This is still failing. The first problem is layout: you need to follow PEP8 faithfully -- look at https://www.python.org/dev/peps/pep-0008/#id21 to see what PEP8 says about blank lines. (This might seem really fussy, but having completely uniform code layout makes a big difference when you're looking through the code base.) The second problem is test coverage: the lines you've added to In addition, as I mentioned above, for us to be able to merge a PR with these changes, you need to follow the instructions in this comment on issue #675: #675 (comment) |
If you run the tests with coverage analysis enabled, you'll see that one line (https://github.com/Cadasta/cadasta-platform/pull/660/files#diff-1ec82efacfd767281c32995e3d9b1547R76) isn't covered by a test. You need to figure out a way to make one of the tests go into that branch of that |
@ian-ross thanks a lot for your inputs. I'll go through them carefully and fix the issues. Lot's of new things learning. Thanks again. |
@kavindya89 Test coverage is kind of annoying, but it's a thing we do. And Git is complicated. Lots of people have trouble with it. I still get into a tangle with it now and then. |
139e318
to
b27043a
Compare
The issue Cadasta#626 suggest that if full name is empty then username should be set in member permission page. This pull request contains fix for it as well as member list page, when full name is empty member column gets blank. So I include to display username if full name is not present
Superseded by #687 |
Proposed changes in this pull request
The issue #626 suggest that if full name is empty then username should be set in member permission page. This pull request contains fix for it as well as member list page, when full name is empty member column gets blank. So I include to display username if full name is not present
When should this PR be merged
No Precondtions
Risks
No Potential Risks