Django Admin widget 셋팅 주의점
2021. 2. 7. 13:03ㆍ파이썬/Django
적용안됨 : field.widget.attrs['size'] = 5
적용됨 : field.widget = forms.TextInput(attrs={'size': 5})
def formfield_for_dbfield(self, db_field, **kwargs):
field = super(ImageAdmin, self).formfield_for_dbfield(db_field, **kwargs)
if db_field.name in ('lang') :
field.widget = forms.TextInput(attrs={'size': 5})
#field.widget.attrs['size'] = 5
return field
'파이썬 > Django' 카테고리의 다른 글
tile cannot extend outside image (0) | 2021.02.11 |
---|---|
Django Admin list_editable save 호출 함수 (0) | 2021.02.10 |
Django Admin 함수 (0) | 2021.02.05 |
Django Admin 템플릿에서 static 사용시 주의점 (0) | 2021.02.04 |
Django Built-in template tags and filters for문 (0) | 2021.02.04 |