Skip to content
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

Feature: I need the ability to validate everything before saving. #1

Open
rockymeza opened this issue Dec 7, 2013 · 1 comment
Open

Comments

@rockymeza
Copy link

In the situation of redirects, for example, I would like to validate all of the rows before any are saved. This would allow me to make sure there are no circular redirects. I also think it's good usability not to insert any of them before checking that all of them pass validation.

I was thinking that process_row could become validate_row or even clean_row (then we could also consider it as a hook for fixing some of the data).

Somewhat related:

Also, would it be possible to use form non-field errors instead of the messages framework? I know that it might be a big change, but would it be possible to move the import logic to the Form instead of the View? That would have several advantages:

  • We could take the Form in use it outside of the admin in a normal FormView.
  • clean_row could live on the form, and be a part of the normal validation flow
  • The obvious place to the circular redirect check is now clean.
@acatton
Copy link
Contributor

acatton commented Dec 9, 2013

Rocky,

If one row is invalid, the data import doesn't get committed. You could just raise a ValidationError in the clean method of the form, when a row introduces a circular redirect.

Side-note: @gavinwahl would like to display the whole CSV in a table form with the validations errors when there are some. This would allow the user to update the data and resubmit it. I feel like this would be related to this feature.

Anyway, I don't really understand how this would work, but in the abstract, I don't see anything wrong with your feature. And I would like to have @gavinwahl's suggested feature if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants