Basically, I'm trying to make an edit profile modal with fields that are already prepopulated by the user's original data. I passed django models into my javascript files by using these brackets {{}} but it doesn't seem to work for {{user}} (as in request.user).
This is what I did for simple fields:
<div class="field">
<label>Email</label>
<input value={{user.email}} type="email" name="email" placeholder="Email">
</div>
{{user.email}} successfully is set as the default value for the input. Is there a different way to prepopulate fields? If there is, let me know and I might not have to deal with this next situation.
My naive solution works for text fields but if I have a multiselect like:
<div class="field">
<label>Native Language</label>
<select name="nativelanguage" id="nativedrop" class="ui fluid search selection dropdown">
<option value="">Language</option>
<option value="English">English</option>
<option value="Spanish">Spanish</option>
<option value="French">French</option>
</select>
</div>
my solution no longer works. I want to pass {{ user }}
into a javascript function like myFunction({{ user }})
but it seems that this is not possible.
Could anyone give me advice on how to prepopulate fields or fix the second issue below? Thanks!