This may point you in the right direction:

http://stackoverflow.com/questions/559361/inline-formset-in-django-removing-certain-fields

Take home message is that you can pass a ModelForm subclass to the fomset
constructor, so you can have a custom form. There is no example in that link
though, and I don't know what the syntax/parameter name is.

- Paulo

On Mon, Mar 29, 2010 at 7:43 PM, Fredrik <frecarl...@gmail.com> wrote:

> Hi,
> I have this forms.py file
>
>
> -------------------------------------------------------------------------------------------------------------------
>  # -*- coding: utf-8 -*-
> from django.contrib.admin.widgets import FilteredSelectMultiple
> from django.forms.models import inlineformset_factory
> from django.forms.models import BaseInlineFormSet
>
> from django.forms import ModelForm
> from django import forms
> from django.conf import settings
>
> from models import *
>
> class ScenariosForm(ModelForm):
>
> Contacts=forms.ModelMultipleChoiceField(Contacts.objects.all(),widget=FilteredSelectMultiple("Mottakere",False,attrs={'rows':'4'}))
>   class Meta:
>        model = Scenarios
>        exclude = ('deleted', 'contacts')
>
> class SMSform(ModelForm):
>    class Meta:
>        model = SMSs
>
>
> -------------------------------------------------------------------------------------------------------------------
>
> But I want to add this
> ScenariosFormSet = inlineformset_factory(Scenarios, SMSs, extra=4,
> max_num=10),
>
> to create a form width scenarios and sms, where sms has a foreign key
> to scenarios...
>
> But then I miss this functionality:
>
> forms.ModelMultipleChoiceField(Contacts.objects.all(),widget=FilteredSelectMultiple("Mottakere",False,attrs={'rows':'4'}))
>
>
> How can I add this widget to inlineformset_factory ?
>
> Regards
> Fredrik
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to