Skip to content

Commit a7d9bae

Browse files
committed
project list page support for empty database / no projects
1 parent 003b263 commit a7d9bae

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/marketplace/templates/marketplace/proj_list.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ <h4>Filter results</h4>
3636
{% include 'marketplace/components/filter_checkbox.html' with field_name='projectstatus' field_value='completed' field_text='Completed' is_checked=checked_project_fields.completed %}
3737
</fieldset>
3838

39+
{% if project_years %}
3940
<fieldset class="mt-3" name="since">
4041
<legend>Posted in or after</legend>
4142
{# if we make form auto-submit on change, then these should perhaps be anchors. however, as currently implemented, radios perhaps make most sense. #}
4243
{% for project_year, is_checked in project_years %}
4344
{% include 'marketplace/components/filter_checkbox.html' with field_name='postedsince' field_value=project_year field_text=project_year field_type='radio' is_checked=is_checked %}
4445
{% endfor %}
4546
</fieldset>
47+
{% endif %}
4648

4749
<button type="submit"
4850
form="projlist"

src/marketplace/views/proj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def project_list_view(request):
157157
Min('creation_year'),
158158
).values()
159159
)
160-
project_years = range(latest_year, (oldest_year - 1), -1)
160+
project_years = range(latest_year, (oldest_year - 1), -1) if latest_year and oldest_year else ()
161161

162162
try:
163163
filter_year = int(request.GET.get('postedsince', ''))

0 commit comments

Comments
 (0)