On 21-Apr-08, at 12:50 AM, radioflyer wrote:

>
> Hello,
> I need some help with the code after the IntegrityError exception.
>
> <snip>
> 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 request has been
> submitted...")
>         return HttpResponseRedirect(reverse(student, args=(s.id,)))
>       except IntegrityError:
>         request.user.message_set.create(message="Can't do that!")
>         return HttpResponseRedirect(reverse(student, args=(s.id,)))
> </snip>
>
> This code throws:
> Exception Type: ProgrammingError at /new_change/45/
> Exception Value: current transaction is aborted, commands ignored
> until end of transaction block
>
> Commenting out the 'message create' line, the code runs. If I leave
> it, Django attempts to insert my message string into the database.

why are you using message_set? Would this not be the set of all  
messages belonging to the particular user?

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to