Django

Code

Ticket #1690 (closed: duplicate)

Opened 3 years ago

Last modified 2 years ago

Validators which check other fields don't work with edit_inline

Reported by: Esaj Assigned to: adrian
Milestone: Component: Validators
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Validators which check other fields don't work with edit_inline.

Take django.core.validators.RequiredIfOtherFieldEquals for example:

This validates by checking if all_data[self.other_field] equals self.other_value. However, with edit_inline, all_data contains keys of the form foo.0.field_name, hence using self.other_field as a key for all_data doesn't work.

Ideally, for edit_inline, the validator should be passed a modified all_data dict with only the relevant fields in it. Maybe DotExpandedDict would come in handy when implementing this?

Attachments

Change History

04/27/06 08:19:38 changed by Malcolm Tredinnick <malcolm@pointy-stick.com>

There are a couple of sides to this behaviour, it seems. I am trying to start a discussion on the developers list to work out what we really want to do here: http://groups.google.com/group/django-developers/browse_frm/thread/123a0a9ba53753b2/e31cb47a017b69cd#e31cb47a017b69cd

02/17/07 22:52:24 changed by Gary Wilson <gary.wilson@gmail.com>

  • status changed from new to closed.
  • resolution set to duplicate.

I'm marking this a dup of #265 as it appears to be the same issue and has some code attached.


Add/Change #1690 (Validators which check other fields don't work with edit_inline)




Change Properties
Action