[BangPypers] Fwd: Regarding Forms : "ModelMultipleChoiceField"
Kishan Mehta
kishanmehta3 at gmail.com
Wed Dec 9 04:00:49 EST 2015
Hi All,
I am working on custom admin interface form generation. I want to display
big amount of results (around 5k) as multiple choice field in django form.
I want to add search functionality and paginate my following
"ModelMultipleChoiceField" field of django form
so that results can be selected easily. Is it the right approch?
Here is my forms.py
*class ScheduledTestForm(forms.ModelForm): tags =
forms.ModelMultipleChoiceField(queryset=Tag.objects.all()) class
Meta: model = Test exclude = ['pita_id', 'challenge',
'test_template']*
Here is my template.html :(partial code) :
{% block nav-global %}{% endblock %}
{% block content %}
*<form action="." method="post"> {% csrf_token %} {{
form.as_p }} <input type="submit" value="Submit" />*
</form>
{% endblock %}
More information about the BangPypers
mailing list