63 # Since fields can be added only to the ModelForm subclass, check to |
63 # Since fields can be added only to the ModelForm subclass, check to |
64 # see if the Model has a corresponding field first. |
64 # see if the Model has a corresponding field first. |
65 if hasattr(self.Meta.model, field_name): |
65 if hasattr(self.Meta.model, field_name): |
66 model_prop = getattr(self.Meta.model, field_name) |
66 model_prop = getattr(self.Meta.model, field_name) |
67 |
67 |
68 # Check if the Model property defined verbose_name, and copy that |
|
69 # verbatim to the corresponding field label. |
|
70 if hasattr(model_prop, 'verbose_name'): |
68 if hasattr(model_prop, 'verbose_name'): |
71 self.fields[field_name].label = model_prop.verbose_name |
69 self.fields[field_name].label = model_prop.verbose_name |
72 |
70 |
73 # Check if the Model property added help_text, and copy that verbatim |
|
74 # to the corresponding field help_text. |
|
75 if hasattr(model_prop, 'help_text'): |
71 if hasattr(model_prop, 'help_text'): |
76 self.fields[field_name].help_text = model_prop.help_text |
72 self.fields[field_name].help_text = model_prop.help_text |
77 |
73 |
78 # Check if the Model property added example_text, and copy that verbatim |
|
79 # to the corresponding field help_text. |
|
80 if hasattr(model_prop, 'example_text'): |
74 if hasattr(model_prop, 'example_text'): |
81 self.fields[field_name].example_text = model_prop.example_text |
75 self.fields[field_name].example_text = model_prop.example_text |
|
76 |
|
77 if hasattr(model_prop, 'group'): |
|
78 self.fields[field_name].group = model_prop.group |
82 |
79 |
83 |
80 |
84 class SelectQueryArgForm(forms.Form): |
81 class SelectQueryArgForm(forms.Form): |
85 """URL query argument change control implemented as a Django form. |
82 """URL query argument change control implemented as a Django form. |
86 """ |
83 """ |