R
R
Ribachok2021-08-27 19:48:07
Django
Ribachok, 2021-08-27 19:48:07

How to assign value to model variable from html template?

I have an info variable in the Profile model that refers to a user. How can I change it through the html template? On {{ user.profile.info = "some" }} throws an error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nesterov, 2021-08-27
@AlexNest

1. How can a theoretical change in a field in a template change a record in the database? (more of a rhetorical question)
2. Is it necessary to do this in a template?
3. If you still need, use a separate view and JS (jquery AJAX or XMLHttpRequest in the case of pure js), which will send a request to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question