How can i set the size of rows , columns in textField in Django Models

Viewed 62307

I have this Model

summary         = models.TextField()

But I want to have only 4 rows and 15 columns.

Also if I do that do I need to install database again or not.

8 Answers

Use Widget in Meta. Keep in Mind that you must add that field in modelform also

class MyModelForm(forms.ModelForm):
    address = forms.CharField()
        
    class Meta:
        model = MyModel
        exclude = ()
        widgets = {
            address': forms.Textarea(attrs={'rows':1, 'cols':15}),
        }
Related