Hi @ all,

I'm looking for a way how to get the amazing function *"filter_horizontal"* 
which i use in django's admin site available in my bootstrap3 form.

I've searched some days, but i cant find no way to get it working..

So please could one of you help me!

#models.py
Class TestModel(models.Model):
    field1 = models.ManyToManyField('Contacts')
    field2 = models.ForeignKey('Testuser')

#forms.py
class TestForm(ModelForm):
    class Meta:
        model = TestModel
        fields = ['fiedl1','field2',]

#views.py
class CreateTestView(CreateView):
    form_class = TestForm
    template_name = 'myapp/test.html'

#test.html
{% block content %}
<br><br>

{% load bootstrap3 %}

<h2> Add a new entry </h2>

{% bootstrap_messages %}

    <form action="" method="post" class="form">
      {% csrf_token %}
      {% bootstrap_form form %}
      {% buttons %}
        <button type="submit" class="btn btn-primary">
          {% bootstrap_icon "star" %} Create
        </button>
      {% endbuttons %}
    </form>
    </div>

{% endblock %}

#urls.py
urlpatterns = [
     url(r'^test/add/$',  views..CreateTestView.as_view(), 
 name='create_test'),
]

Thanks for your help!

BR
Florian


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/32588818-d1ae-4212-9c6a-9eaf687bb495%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to