#35532: Allow customizing errors processing in
BaseModelFormSet.validate_unique()
----------------------------------+--------------------------------------
Reporter: Christophe Henry | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: 5.0
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Sarah Boyce):
* resolution: => wontfix
* status: new => closed
Comment:
Replying to [comment:2 Christophe Henry]:
> [https://forum.djangoproject.com/t/allow-customizing-errors-processing-
in-basemodelformset-validate-unique/32589 So I did what you advised] but
that doesn't seem to attract much attention.
Thank you for doing so, lack of feedback can mean a few things (perhaps
there is limited interest of the feature, perhaps this needs to be
promoted more as it has gotten "lost", perhaps this needs more time).
> In the meantime, I really need this feature for a project. What should I
do?
Your proposed patch suggestion looks very similar to overwriting the
existing `get_unique_error_message` and `get_date_error_message` methods,
the added value is in customising whether the error is within
`NON_FIELD_ERRORS` or on a specific field from what I can see.
When I started to look into this, I noticed that
[https://github.com/django/django/blob/main/django/forms/models.py#L506-L515
BaseModelForm.validate_unique()] has a `_update_errors` processing step
which doesn't appear to be in `BaseModelFormSet.validate_unique()`. This
makes me think, how would we do this in a normal model form? Can we not do
this the same way in a model formset? Is that a bug?
I don't have time to play around with this, but I think if you investigate
or start asking questions from the angle of "I need to achieve this, how
can I do this? How would I do this for a model form?" on one of our
[https://www.djangoproject.com/community/ user support channels], you will
probably end up with (A) the work around that you need for your project
and (B) a conclusion as to whether a change in Django needs to happen.
I hope that helps. As we still don't have the community consensus that we
need to make this change yet, I am closing as wontfix
--
Ticket URL: <https://code.djangoproject.com/ticket/35532#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070190921e6cb2-22ed05a3-3ccc-4f81-8d61-59d90f400a11-000000%40eu-central-1.amazonses.com.