Karen,

Yes absolutely right.  Thanks for rescuing me from own stupidity!

On Sep 21, 4:54 pm, Karen Tracey <[email protected]> wrote:
> On Mon, Sep 21, 2009 at 11:49 AM, phoebebright 
> <[email protected]>wrote:
>
>
>
>
>
> > On Sep 21, 3:25 pm, Karen Tracey <[email protected]> wrote:
> > Karen,
>
> > Spot on with the first positional argument I think, but I now get the
> > error:
> > form = TweetForm(instance=obj)
> > TypeError: __init__() got an unexpected keyword argument 'instance'
>
> > Here is the view:
>
> >    if request.method == 'POST':
> >        form = TweetForm(request.POST)
> >        etc.
> >    elif isinstance(obj, TweetLog):
> >        form = TweetForm(instance=obj)     <----- had TweetForm(obj)
> > before!
> >    else:
> >        default_taglist = request.session.get('taglist', '')
> >        form = TweetForm(initial = {'tweet_taglist' :
> > default_taglist}) # An unbound form
>
> >    return form
>
> > And the form:
>
> > class TweetForm(forms.Form):
>
> TweetForm isn't a ModelForm, therefore it doesn't support passing a model
> instance as a parameter.  Given it looks like you are giving it a Meta class
> as if it were a ModelFrom below, perhaps all you need to do to fix it is
> change the base class here.
>
> >    tweet = forms.CharField(widget=TweetFieldWidget(), required=True)
> >    tweet_taglist = forms.CharField(max_length=100, required=False)
> >    process_backwards = forms.BooleanField(required=False)
>
> >    attached_notes = forms.CharField(widget=forms.Textarea,
> > required=False)
> >    attached_url = forms.URLField(required=False)
> >    attached_file = forms.FileField(required=False)
> >    attached_image = forms.ImageField(required=False)
>
> >    class Media:
> >        js = ('/js/jquery.js', '/js/jquery-ui.min.js','js/
> > jeditable.js','js/tweetform.js', 'js/jquery-ui.tabs.js')
> >        css = { 'all': ('/css/jquery-ui.css','/css/smoothness/jquery-
> > ui-1.7.2.custom.css') }
>
> >    class Meta :
> >        model = TweetLog
> >        fields =
> > ('tweet','attached_notes','attached_url','attached_file','attached_image')
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to