Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Why won't Django render its select widget with this code? [closed]
Closed as unclear by Karl Knechtel on Jan 22, 2026 at 21:17
This question cannot be answered in its current form, because critical information is missing.
This question was closed; new answers can no longer be added. Users with the Vote on Holds ability may vote to reopen this question if it has been improved or closed incorrectly.
I am trying to use Django's default select widget to render an HTML dropdown. I have this code:
in models.py:
class VehicleYear(TimeStampedModel):
oem_year = models.IntegerField(
unique=True, null=False, blank=False, default=current_year, validators=[
MinValueValidator(1900), max_value_current_year])
in forms.py:
class SelectYear(forms.Form):
vehicle_year = forms.ModelChoiceField(queryset=VehicleYear.objects.all(), label="Select Year")
in views.py:
def Year(request):
context = {'form': SelectYear()}
return render(request, 'vehicles/select_year.html', context)
in my HTML template (select_year.html):
{{ form.as_p }}
select_year.html is part of select_filter.html, which uses
{% include "folder/select_year.html" %}.

1 comment thread