Django

Code

Ticket #5736 (closed: duplicate)

Opened 1 year ago

Last modified 1 year ago

unique fields won't be validated by .is_valid() in NewForms form_for_models

Reported by: packermann@thomas-krenn.com Assigned to: nobody
Milestone: Component: Forms
Version: SVN Keywords: unique is_valid()
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

I have some unique-Fields in my models.py. I use form_for_models and form_for_instance to build my forms to populate my DB. For validation I use .is_valid(): Example:

if request.method == 'POST':
		f = ServerForm(request.POST)
		if f.is_valid():
			saveobject = f.save()

If I test this by trying to add a duplicate entry, I get a "duplicate key violates unique constraint" instead of the expected error-message in my forms as for the other validation. If you need some files, traceback please mail me.

regards

Attachments

Change History

10/11/07 09:15:35 changed by brosner

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to duplicate.
  • needs_tests changed.
  • needs_docs changed.

I am closing this as a duplicate of #4895. The reasoning in that ticket is the same for this one as well.


Add/Change #5736 (unique fields won't be validated by .is_valid() in NewForms form_for_models)




Change Properties
Action