reuse FilteredSelectMultiple

2009-02-17 Thread natxooy
I'm trying to reuse FilteredSelectMultiple from admin.widgets in my forms (two select-widgets to choose from one to other like 'user permisions' in admin interface), but didn't find how. The closest I've done was with this code: class PersonaForm(ModelForm): def __init__(self, *args, **kwargs

Re: reuse FilteredSelectMultiple

2009-02-17 Thread natxooy
Thaks!! that works!! On 17 feb, 15:31, Alex Gaynor wrote: > On Tue, Feb 17, 2009 at 7:27 AM, wrote: > > > I'm trying to reuse FilteredSelectMultiple from admin.widgets in my > > forms (two select-widgets to choose from one to other like 'user > > permisions' in admin interface), but didn't find

Re: reuse FilteredSelectMultiple

2009-02-17 Thread natxooy
Thanks!! that works!! On 17 feb, 15:31, Alex Gaynor wrote: > On Tue, Feb 17, 2009 at 7:27 AM, wrote: > > > I'm trying to reuse FilteredSelectMultiple from admin.widgets in my > > forms (two select-widgets to choose from one to other like 'user > > permisions' in admin interface), but didn't fin

ModelMultipleChoiceField

2009-03-02 Thread natxooy
I've got an error using ModelMultipleChoiceField, but don't guess where: my form is : class SearchForm(forms.Form): titulos = forms.ModelMultipleChoiceField(Titulo.objects.all ().order_by('tipo'), label='Títulos') in my template I insert it with: {% for field in form %} {{ field.label

Re: ModelMultipleChoiceField

2009-03-02 Thread natxooy
Thanks!! that works On 2 mar, 19:26, Alex Gaynor wrote: > On Mon, Mar 2, 2009 at 12:42 PM, wrote: > > > I've got an error using ModelMultipleChoiceField, but don't guess > > where: > > > my form is : > > > class SearchForm(forms.Form): > >    titulos = forms.ModelMultipleChoiceField(Titulo.obje

dynamic filter m2m field

2009-03-02 Thread natxooy
I'm trying to make a complex dynamic filter. The first thing I've done is get dynamically a list of list of titles, something like this: [[, ], []] and a way to add/remove list of titles to/from the general list (let's call it big list). Is there a way to filter a list of Persons that have Titl

Re: dynamic filter m2m field

2009-03-03 Thread natxooy
I've done it intersecting the list of lists in pure python and then calling the filter: ml=[Persona.objects.filter(titulos__in=f).distinct() for f in filtros] tmp = {} for l in ml: for x in l: z = tmp.get(x, []) z.append(1)