Hi,

It's a bit hacky, but I've used filter_horizontal outside of the admin 
before.

from django.contrib.admin import widgets

class MyForm(forms.Form):
    users = forms.ModelMultipleChoiceField(
        required=False,
        widget=widgets.FilteredSelectMultiple(verbose_name='Field Name', 
is_stacked=False),
        queryset=choices_qs,
        initial=initial_qs,
    )

<link rel="stylesheet" href="/static/admin/css/widgets.css">
<script>function addEvent(obj, evType, fn){obj.addEventListener(evType, fn, 
false)}</script>
<div>{{ form }}</div>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js";
></script>
<script>django = {jQuery: $}</script>
<script src="/admin/jsi18n/"></script>
{{ form.media }}

Collin

On Monday, January 5, 2015 at 12:39:39 AM UTC-5, ebuild wrote:
>
> I'm wondering if there is a standard way to add a javascript-based filter 
> on the right box like the one in the  left
> when having manytomany relation with filter_horizontal.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d704af5e-af3d-4767-8537-439a5693c055%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to