ringemup wrote: > > Do you then have to figure out which errors apply to which Form > fields, and sort them out and assign them? I haven't seen any sample > code doing anything of this sort, so I'd be very interested to see how > it works. >
I was recently in the same situation and did something like this: def handle_integrityerror(form): message = sys.exc_info()[1].message if message.startswith("column "): parts = message.split(" ") form.errors.setdefault(parts[1],[]).append(" ".join(parts[1:])) You basically call this method when catching a django.db.IntegrityError and it will try to determine based on the exception's message what field in the auto-generated form caused the trouble and adds basically that message to the error-list for the offending field. It's not really an elegant solution but so far it seems to work for me. Horst --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---