django 2.1.5 with python 3.7.2 I have a models.py class as follows: class Article(models.Model): title = models.CharField(max_length=255,) And I want to override the rendered default size attribute to 100 in the input/text form field.
the template rendering is done as follows <form method="post"> {% csrf_token %} {{ form.as_p}} <button class="btn btn-dark ml-2" type="submit">Save</button> </form> in the application admin.py I have the following: class ArticleAdmin(admin.ModelAdmin): formfield_overrides = { models.CharField: {'widget': TextInput(attrs={'size': '100'}), }, } # registered as admin.site.register(Article, ArticleAdmin) Sadly it appears to have no effect. Viewing the rendered source, I do not see a size attribute. the field is rendered as: <input type="text" name="title" maxlength="255" required id="id_title"> Have I ommited a step? thanks -- Tim Johnson http://www.tj49.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20190511190931.GC2372%40mail.akwebsoft.com. For more options, visit https://groups.google.com/d/optout.