Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-21 Thread radioflyer
Thanks again dallas and kenneth, Kenneth's comment about the clean process sent me back to the docs. I was using form.cleaned_data to do my own integrity checking, but I didn't realize what was truly available from the clean methods. Handling the validation with custom form methods does seem

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread dallas lynn
I believe this is a postgres thing -- the transaction failed but postgres didn't rollback, and the message_set.create tries to put a message in the database. it's kind of ghetto, but you can also try manually rolling back postgres when you catch the exception but before you set the message.

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread Kenneth Gonsalves
On 21-Apr-08, at 6:42 AM, radioflyer wrote: > I've decided to manually check for uniqueness after form validation > and before saving, and that seems to work fine for now. > > Things like 'unique_for_date' and 'unique_together' seem to work great > in the admin interface, but in the wild, you

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread radioflyer
Hello Kenneth, Yes it would. If the user tries to submit a Change that is not unique on 'student' and 'date' , I want to return them back to the original page with a message that says "You've already got a change submitted for that date." I'm guessing that the programming error has to do with

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread Kenneth Gonsalves
On 21-Apr-08, at 12:50 AM, radioflyer wrote: > > Hello, > I need some help with the code after the IntegrityError exception. > > > s = Student.objects.get(pk=student_id) > > if request.method == 'POST': > form = ChangeForm(request.POST) > if form.is_valid(): > try: >

'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread radioflyer
Hello, I need some help with the code after the IntegrityError exception. s = Student.objects.get(pk=student_id) if request.method == 'POST': form = ChangeForm(request.POST) if form.is_valid(): try: form.save() request.user.message_set.create(message="Your