Re: Help with forms (really struggling)

2011-09-29 Thread David
Thank you both so much for your help! I had been fighting this for some time; doesn't help starting Django whilst still learning Python and OOP. The following works perfectly: @login_required @transaction.commit_on_success def update_log(request, pk): if request.method == 'POST' and

Re: Help with forms (really struggling)

2011-09-29 Thread Tom Evans
On Thu, Sep 29, 2011 at 3:16 PM, David wrote: > Thank you both for your assistance. > > When I try to use the following (which is my interpretation Tom of > your modifications) I get this error: > > Cannot assign "u'1'": "Log.person" must be a "Person" instance. > So you can

Re: Help with forms (really struggling)

2011-09-29 Thread David
I should add that person is a FK in the log model. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to

Re: Help with forms (really struggling)

2011-09-29 Thread David
Thank you both for your assistance. When I try to use the following (which is my interpretation Tom of your modifications) I get this error: Cannot assign "u'1'": "Log.person" must be a "Person" instance. @login_required @transaction.commit_on_success def update_log(request, pk): if

Re: Help with forms (really struggling)

2011-09-29 Thread Tom Evans
On Thu, Sep 29, 2011 at 2:58 PM, David wrote: > Hi Kurtis > > Thanks for your reply. > > That wasn't a silly question. A person is not a user. > > I modified my view like this: > > @login_required > def update_log(request, pk): >        try: >                person =

Re: Help with forms (really struggling)

2011-09-29 Thread David
Hi Kurtis Thanks for your reply. That wasn't a silly question. A person is not a user. I modified my view like this: @login_required def update_log(request, pk): try: person = Person.objects.get(pk=pk) except KeyError: raise Http404 if

Re: Help with forms (really struggling)

2011-09-29 Thread Kurtis Mullins
Hey, I'm still half asleep so I apologize if this is a dumb question. Is the "Person" the User using this? If so, you should have access to the User object from the session. If not, you could probably do a query with the Primary Key to grab the Person object. e.g. person = Person.objects.get(pk

Help with forms (really struggling)

2011-09-29 Thread David
Hi I have a page called Person which lists basic contact details. I intend to have a series of forms on this page in hidden div's that enable a user to submit data pertaining to this contact such as contact logs. Each form will be submitted by ajax which is why I am making their form actions