Ticket #8164: fieldorderdocs.diff
File fieldorderdocs.diff, 1.4 KB (added by , 16 years ago) |
---|
-
docs/modelforms.txt
262 262 263 263 2. Use the ``fields`` attribute of the ``ModelForm``'s inner ``Meta`` 264 264 class. This attribute, if given, should be a list of field names 265 to include in the form. 265 to include in the form. Note that this attribute also changes the 266 order in which fields are displayed in the resulting form (see 267 below). 266 268 267 269 3. Use the ``exclude`` attribute of the ``ModelForm``'s inner ``Meta`` 268 270 class. This attribute, if given, should be a list of field names … … 339 341 ... class Meta: 340 342 ... model = Article 341 343 344 Customizing field order 345 ------------------------------- 346 347 By default django will show the model's fields first, followed by any form- 348 specific fields. When you define the ``field`` attribute of the 349 ``ModelForm``'s inner ``Meta`` class, that order will be used:: 350 351 >>> Class CustomAuthor(ModelForm): 352 ... pseudonym = CharField() 353 ... 354 ... class Meta: 355 ... model = Author 356 ... fields = ('name', 'pseudonym', 'birth_date') 357 358 This will render a form with the pseudonym field in between name and birth_date. 359 You can declare model fields, new fields and overridden fields in the ``fields`` 360 attribute. 361 362 342 363 Form inheritance 343 364 ---------------- 344 365