I have two TextField
in my model. But i want to change the rows and cols attribute of only of the TextField
. I know from this page that the look of TextField
can be changed using the following code in the admin.py
.
class RulesAdmin(admin.ModelAdmin):
formfield_overrides = {
models.TextField: {'widget': Textarea(
attrs={'rows': 1,
'cols': 40})},
}
...
admin.site.register(Rules, RulesAdmin)
As I said, using the above code changed the look of both the TextField
, I want only to change one of those here is how my model looks like:
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
pub_date = models.DateTimeField(auto_now_add=True)
update_date = models.DateTimeField(auto_now=True)
meta = models.TextField(blank=True)
def __str__(self):
return self.title
I want only to change the look of meta
field.
How should I go about this ?