0👍
This is wrong approach to define function on model, use custom managers for this.
Now problem is you can’t call a function from template(html page) call that function on view and render data in context.
With context data on view
_list_of_data = personne.types_permis2.all_valid()
{'_list_of_data':_list_of_data}
Now add this in context on render function
Then iterate over it on html
{% for item in _list_of_data %}
....
....
{% endfor %}
- Error Making POST to ServiceM8
- Use additional request param to generate a model field in DRF 3
- Google App Engine Django Standard Environment: Error: Server Error
Source:stackexchange.com