-
-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation when using ModelResource #176
Comments
Hi @sergei-maertens!
In this case django will raise an exception and this exception will be presented to user together with line number. I am aware that as much as I wanted this errors to be descriptive with including stack trace they are sometimes confusing. I wish we have better error reporting and I am open for ideas.
This is not validation, but some processing of data, right? |
I think that user-directed validation errors should be displayed below the The max length example leads to a DatabaseIntegriyError if untreated, and Those things should be caught on the widget or field by introspecting the |
I agree, this would be nice feature. |
Did anything ever come of this? |
No, not yet |
maybe just call |
Hi @bmihelac. I've got a version of this working locally, which I think is 'pretty okay'. However, I'm sure you'll have your own ideas about a few things (as will always be the case with changes of this size). Is this something you'd rather solve yourself, or would you be happy for me to submit a PR, and we can bash things into shape together? |
Hi @ababic, it would be great if you can submit a PR for this. Having better validation/error messages would be excellent. |
Fixed with bd5ce92. |
Is anybody working on validation for resources generated by the modelresource_factory?
For instance, a Django CharField that has choices as keyword argument should be validated when importing. The value in the import file should match one of the possible values.
Another example is again with CharFields: make sure that max_length is respected and if the provided value is too long, trim it with django.utils.text.Truncator.
If this sounds reasonable, I'm definitely willing to put some time in it to add those validation rules and make a pull request. Right now for a project I'm overriding quite a bit of stuff to make this possible.
The text was updated successfully, but these errors were encountered: