Suppose I have a model named "OneOfTheModelsUsed", and in this model there is a field named "car_name" and "date".
The following code worked for me when I used Django FormWizard. After going through all the steps in the form, and it will be saved. I used
last_entry = OneOfTheModelsUsed.objects.latest("date")
This gives all the entries in this model.
last_car_name = last_entry.car_name
This gives the specific field entry that you want in the given form.
return render(request, 'reference.html', {'last_car_name':last_car_name,}
passed the data to the template.
to display in the template that I used
{{last_car_model}}
and if you need an identifier for this entry .. use this {{last_car_model.id}} in the template.
PS: I'm pretty new to Django and web development in general, so I donβt know a lot of technical terms for all this
source share