Regarding Forms : "ModelMultipleChoiceField"

15 views
Skip to first unread message

Kishan Mehta

unread,
Dec 9, 2015, 3:55:03 AM12/9/15
to django...@googlegroups.com

Hi All,

I am generating admin interface form.

I want to add search functionality and paginate my following "ModelMultipleChoiceField" field of django form. Is is possible to achieve this ?


Because it contains around 5000 results.


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 %}





Reply all
Reply to author
Forward
0 new messages