[Fixed]-Update view not working? Django

1👍

Assuming you’re trying to edit an aircraft with a specific ID, you would need something like this in url.py (assuming that the IDs are integers):

url('^account/uploads/edit/(?P<id>[0-9]+)$', aircraft_update, name='aircraft_update')

And in your template you would need to update your anchor link to include the ID:

<a href="{% url 'aircraft_update' id=upload.id %}">

NOTE that this assumes that the upload object (in your template’s loop) includes an id property, and that the id property corresponds to the aircraft ID that you want to update. (It is possible that you have named this property something else.)

EDIT: This would be sufficient for executing a GET request. However, I notice that your view definition for aircraft_update also attempts to check whether a form is valid. Where is this form in your template? It does not appear to be in your loop.

👤nb1987

Leave a comment