76 return d |
76 return d |
77 |
77 |
78 |
78 |
79 # contains the list of arguments in each field |
79 # contains the list of arguments in each field |
80 field_names = { |
80 field_names = { |
81 'CharField': ['max_length', 'min_length'], |
81 'CharField': ['max_length', 'min_length'], |
82 'IntegerField': ['max_value', 'min_value'], |
82 'IntegerField': ['max_value', 'min_value'], |
83 'FloatField': ['max_value', 'min_value'], |
83 'FloatField': ['max_value', 'min_value'], |
84 'DecimalField': ['max_value', 'min_value', 'max_digits', 'decimal_places'], |
84 'DecimalField': ['max_value', 'min_value', 'max_digits', 'decimal_places'], |
85 'DateField': ['input_formats'], |
85 'DateField': ['input_formats'], |
86 'DateTimeField': ['input_formats'], |
86 'DateTimeField': ['input_formats'], |
87 'TimeField': ['input_formats'], |
87 'TimeField': ['input_formats'], |
88 'RegexField': ['max_length', 'min_length'], # sadly we can't get the expr |
88 'RegexField': ['max_length', 'min_length'], # sadly we can't get the expr |
89 'EmailField': ['max_length', 'min_length'], |
89 'EmailField': ['max_length', 'min_length'], |
90 'URLField': ['max_length', 'min_length', 'verify_exists', 'user_agent'], |
90 'URLField': ['max_length', 'min_length', 'verify_exists', 'user_agent'], |
91 'ChoiceField': ['choices'], |
91 'ChoiceField': ['choices'], |
92 'FilePathField': ['path', 'match', 'recursive', 'choices'], |
92 'FilePathField': ['path', 'match', 'recursive', 'choices'], |
93 'IPAddressField': ['max_length', 'min_length'], |
93 'IPAddressField': ['max_length', 'min_length'], |
94 } |
94 } |
95 |
95 |
96 |
96 |
97 def describe_field_errors(field): |
97 def describe_field_errors(field): |
98 res = {} |
98 res = {} |
99 field_type = field.__class__.__name__ |
99 field_type = field.__class__.__name__ |