35👍
✅
I don’t think that’s what you want to do. A model is a class: it won’t have a status
, as that’s a field which only gets a value for a particular instance.
I suspect what you mean to do is access the model instance associated with the form, which is just form.instance
.
2👍
If you create a property on the form that reads the value then you can access it very easily in the template.
class SomeForm(...):
@property
def status(self):
return self._meta.model.status
...
{{ form.status }}
- How to track the progress of individual tasks inside a group which forms the header to a chord in celery?
- Can you achieve a case insensitive 'unique' constraint in Sqlite3 (with Django)?
- Django: Reading Array of JSON objects from QueryDict
- How do I update an object's members using a dict?
Source:stackexchange.com