It looks like i'm passing the right objects but get told there isn't a
comments field
Exception Type:AttributeErrorException Value:
'PollForm' object has no attribute 'comments'
The debug info says:
poll.comments.append(self) ...
▼ Local vars
Variable Value
self
user
poll
On
Hi,
The first form saves fine but the second still dosn't.
I can't seem to pass the poll object to the save method of the form
properly.
Since i'm using nonrel once i've passed the poll object I can append the
comment using something like poll.comments.append(comment) but I just don't
seem to
Hi Paul,
After a bit more playing around I got it going, there was another unrelated
issue with my code.
Learnt to use the debugging info more effectively in the process which is
great.
Thanks again for your help, very much appreciated.
Kind regards,
Jason
On Thursday, 7 November 2013 04:56:14
Its likely i'm passing the wrong arguements, because its a type mismatch
error
However i'm only passing the request.POST, instance and request.user.
Since the two arguements are "self" and "user", prehaps i'm not passing the
self objject corrrectly, though I thought this was past of the request.
Hi,
Thanks for the tip, i tried adding the user as the argument, i tried the
following:
new_post = pform.save(user=request.user)
new_post = pform.save(user)
new_post = pform.save(request.user)
and a few other things...
Now i just get the following save() takes at least 2 arguments (2 given)
Any
Hi Paul,
Thanks, now you mention it and I look at it again it seems obvious, can't
see the wood for the trees moment.
Funnily enough I had that included at some point, but have made so many
changes.
I'll try that tonight when I get home, thanks very much for the prompt
reply!
Kind regards,
Jaso
Hey Jason--
You defined the save method as needing the user parameter, but you don't
pass that in. Try that (assuming user should equal request.user). Good
luck!
-Paul
On Thursday, November 7, 2013 5:25:18 AM UTC-5, Jason S wrote:
>
> Hi,
> Disclaimer - I'm new to django and python, so plea
Hi,
Disclaimer - I'm new to django and python, so please bear with me.
Note: My django instance uses a nosql database.
I'm trying to create a formset which has multiple forms based on models.
The formset will have one form "post", then 1-3 "comment" forms. Eventually
i'd like to be able to add/
8 matches
Mail list logo