django framework study: nineteen .admin background table names and field display Chinese

Foreword

As shown, the generated database table, admin backend will automatically generate a table name more than a s below, if you want a table name, field names and the form of the Chinese show, django where you need to add verbose_name and verbose_name_plural property.

 

 

 

 verbose_name usage

As shown below, if you want to display the field names in Chinese table, the need to add verbose_name file models.py

 

models.py file code is modified as follows

 

 

 Admin management background refresh the page as follows:

 

verbose_name_plural usage

Table Name Articles This place can also be changed to Chinese display, plus a verbose_name_plural property

verbose_name_plural property is written under the class Meta, class Meta nested in the class Article

 

 Refresh admin admin page

 

 admin.py registry

Ordering set the sort, preceded by a minus sign indicates descending without the minus sign, and that is the positive sequence List_editable pages directly editable fields.

 

Registry Code

 

 

 Refresh admin management background, age field in descending order, name fields can be edited.

 

 

Guess you like

Origin www.cnblogs.com/liushui0306/p/12659122.html