Skip to content
Advertisement

how to set default value in django template

i’m trying to set default value to an input field in django template , i have two models tables

JavaScript

forms.py

JavaScript

my views.py

JavaScript

urls

JavaScript

i tried to call back title using ajax but it doesnt work

JavaScript

my template

JavaScript
JavaScript
but still doesnt work ! is there something i did wrong ?

im trying to set booking_obj.title as default value for title input in the Cancel model thank you for helping

Advertisement

Answer

Pass an initial object to the form on initialization to set initial values. Be careful with the names of the fields you have declared in the form and model.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement