Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Closes #1451 Added user categories to profile and settings #1459
base: develop
Are you sure you want to change the base?
Closes #1451 Added user categories to profile and settings #1459
Changes from 1 commit
c359526
2f63423
ed37c54
610fde0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We don't need to loop over all of the categories here, but would instead loop over the
profile.categories
and list them horizontally.Since
div
is a block element, it causes the categories to stack. Instead of wrapping each category in its owndiv
display the categories in a paragraph or span of text, separated by commas.Notice that the above code lists all the profile categories separated by commas. For bonus points, we can later figure out how to make it, so the last category in the list doesn't have a trailing comma.
References
Check out the following documents for further info related to this comment.
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.
Oh that's fine @brylie but, I already performed the logic in the backend
or will you'll prefer I do it using the Django templating syntax?
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.
Using the
profile
object already available in the template would require less code since the categories property is already part of theprofile
.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.
Hello @brylie please I'm getting a server error after implementing this
here is the error message
TypeError: 'ManyRelatedManager' object is not iterable
any suggestions on what I'm missing out?
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.
That error seems common enough to find an answer via Google or Stack Overflow. Let me know what search results you get and what you tried to resolve the error. It would also help to see what the exact line of code is that produces the error.
It may be worth considering that the code I suggested during the code review won't work without modification since I was going from memory.
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.
Thanks @brylie I just pushed my code for review, I also helped fix the last trailing comma you mentioned, with the best logic I could come up with for now before we find something more permanent.
Also, I don't remember you mentioning anything about the issue I raised in the settings.html file
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'll add a comment in settings.html