Skip to content
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

Fixed issue 132: user don't need to choose a plot if there's only one… #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions gardenhub/templates/gardenhub/order_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
Select a Plot
</div>
<div class="menu">
{% for plot in form.plot.field.queryset %}
<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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

{% else %}
{% for plot in form.plot.field.queryset %}
<div class="item" data-value="{{ plot.id }}">{{ plot }}</div>
{% endfor%}
{%endif%}
</div>
</div>
{{ form.plot.errors }}
Expand Down