django: How to render CharField as a label in Model Admin page?
My Model has a CharField called "comm开发者_开发知识库ents". I want to display this as just a regular paragraph of text, instead of the default html textarea on the Model admin page. How would I go about implementing this change?
I could be misunderstanding your question, but I think you want to take a look at Django's readonly_fields option.
readonly_fields = ('comments', )
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields
You'll want to create a custom widget and override the render()
method.
精彩评论