Fixed issue 132: user don't need to choose a plot if there's only one… - #156
Open
AhmedBenchekroun wants to merge 2 commits into
Open
Fixed issue 132: user don't need to choose a plot if there's only one…#156AhmedBenchekroun wants to merge 2 commits into
AhmedBenchekroun wants to merge 2 commits into
Conversation
alexgleason
requested changes
May 7, 2018
alexgleason
left a comment
Contributor
There was a problem hiding this comment.
Thank you! Please indent the conditionals with 4 spaces. Am about to test it.
| </div> | ||
| <div class="menu"> | ||
| {% if form.plot.field.queryset.count == 1 %} | ||
| <div class="item" data-value="{{ plot.id }}">{{ form.plot.field.queryset.0.title}}</div> |
| {% for plot in form.plot.field.queryset %} | ||
| <div class="item" data-value="{{ plot.id }}">{{ plot }}</div> | ||
| {% endfor%} | ||
| {%endif%} |
Contributor
There was a problem hiding this comment.
Please include spaces around endif
Contributor
alexgleason
requested changes
May 7, 2018
| <div class="item" data-value="{{ plot.id }}">{{ plot }}</div> | ||
| {% endfor%} | ||
| {% if form.plot.field.queryset.count == 1 %} | ||
| <div class="item" data-value="{{ plot.id }}">{{ form.plot.field.queryset.0.title}}</div> |
Contributor
There was a problem hiding this comment.
Here plot is not set. It's only set in the next part because it's within the for loop, so you need to set the data-value similar to how you're creating the title.
Contributor
|
So we don't forget, we discovered in our search that adding Therefore, we can set the value as the first item in the list under the condition that the list contains multiple items. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

… plot available