1đź‘Ť
In addition to the issues pointed out by other posters, you have an issue with your urls.py. You do not terminate the pattern for your index view, so it matches everything that starts with “aircraft” – which includes “aircraftdetail”. You should use $
consistently:
url(r'^admin/', admin.site.urls),
url(r'^aircraft/$', 'aircraft.views.browseaircraft', name='browseaircraft'),
url(r'^aircraftdetail/(?P<pk>\d+)/$', 'aircraft.views. aircraft_detail_view', name='aircraftdetail'),]
👤Daniel Roseman
0đź‘Ť
Well, your aircraft_detail.html
loops over all aircrafts and displays their information. If you want to only show information for the one selected aircraft, you’ll need to change the html page to something like this:
{% block content %}
<h1>Title: {{ aircraft.title }}</h1>
{{ aircraft.cost }}
{{ aircraft.range}}
{{ aircraft.cost }}
{{ aircraft.cruise_speed }}
{% endblock %}
👤NS0
- Django html onclick to open another html page
- How do i print data from a database in column format?
- Ldapdb: "'NoneType' object is not callable" when adding ldap database to django
- NOT NULL constraint failed: device_api_devicegroup.owner_id
- Django queryset – classify and filter by value
Source:stackexchange.com