Answer the question
In order to leave comments, you need to log in
How to display post id in django admin panel?
Can't display id in django admin panel. I know that he himself assigns id to new records, but displays only those that I specified in the model. Tried through fields = ["id"], but output, there is no such field. I tried to specify it in the model, but the result is the same. I would also like to display it not only when editing posts, but also in the title of the post in the preview. I don’t want to click and go to the page of a specific post every time to see the id . Please help solve the problem
Answer the question
In order to leave comments, you need to log in
class MyModelAdmin(admin.ModelAdmin):
readonly_fields = ('id',)
admin.site.register(MyModel, MyModelAdmin)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question