3👍
Gabi’s answer is exactly what you want. You could use setattr
instead though:
setattr(user, field_to_edit, strip_tags(value))
Which is (very very slightly!) more intuitive.
- [Django]-How to launch your already made Django App on Heroku
- [Django]-Python: Element order in dictionary
- [Django]-Django return user model id with L
- [Django]-Django AttributeError: 'User' object has no attribute 'set_password' but user is not override
- [Django]-Reorder Fields of FeinCMS Content Type in Page Admin
Source:stackexchange.com