Hello all, I have some suggestions for newforms, which I've condensed into point form, excuse me if they seem a little blunt they are just meant to be concise --
1. Magic cleaned_data - So we can get/set values out of order and before the clean() run, having themselves clean implicitly as required. 2. A pre_clean() hook - So we can still manipulate data, fields, and required settings etc before validation. Common use case is requiring or un-requiring fields A,B,C based on value of field X. 3. Easy access to form/field errors - After validation, when I go to process() or save() my form, I need to be able to set form and sometimes field level errors - but there is no elegant way of doing this. Hacking with _errors, __all__, ErrorDict is ugly. Using another error reporting system is ugly and unnecessary, too. 4. Pass value to field clean_ method as parameter - Eg clean_field(self, value) - why bother users with the extra line of code? Obviously they are going to want the value, aren't they? 5. (Somewhat pedantic) Rename data[] to raw_data[] and cleaned_data[] to data[] - Has anyone seen how unnecessarily ugly this can get? If these are all deemed to be ill-fated ideas, then to cover at least some of the above, I'd be grateful if anyone can please suggest -- 1. How do I toggle field required settings for fields A,B,C dependent on the value of field X ? 2. How do I dynamically copy data from fields A,B,C to fields X,Y,Z before validation ? 3. What is the recommended way of setting non_field_errors outside the clean methods? Thanks Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
