DateTimeField doesn't show in admin system

后端 未结 7 1667
野的像风
野的像风 2020-12-05 01:27

How come my \"date\" field doesn\'t come up in the admin system?

In my admin.py file i have

from django.contrib import admin
from glasses.players.mod         


        
7条回答
  •  攒了一身酷
    2020-12-05 02:13

    If you really want to see date in the admin panel, you can add readonly_fields in admin.py:

    class RatingAdmin(admin.ModelAdmin):
        readonly_fields = ('date',)
    
    admin.site.register(Rating,RatingAdmin)
    

    Any field you specify will be added last after the editable fields. To control the order you can use the fields options.

    Additional information is available from the Django docs.

提交回复
热议问题