Customize Django admin (wider description fields)

When you create another model in Django are faced with this problem, which is easier to show than to explain:



Or rather the problem is that as you can see the header field "Name" and "Location" practically climb up on TextEdit-s. Not to say that critical, but the beauty of this little. In addition the INN field (Integer) too small to accommodate all the number in full without scrolling. Question 2: is it Possible to make the indent from the headers for more to fit, and is it possible to make the field was as wide as everyone else?

z.s. In the screenshot of course admin tools, but the native admin 1 all 1 also.
October 8th 19 at 00:08
3 answers
October 8th 19 at 00:10
Solution
About the width of the labels.
Once you have admintools, so you can add your ccs.
This alien work, although it may be necessary to specify !important
.aligned label{18em}

As for the width of the ID field, specify the form and specify a widget attribute, like this:

class MyModelAdminForm(forms.ModelForm):

 class Meta:
 model = MyModel
 widgets = {'inn':widgets.Textinput(attrs={'size':55})}


class MyModelAdmin(admin.ModelAdmin):
 form = MyModelAdminForm
*add your css. - Willow17 commented on October 8th 19 at 00:13
Thank you, it's what I needed :) - Collin_Mills commented on October 8th 19 at 00:16
October 8th 19 at 00:12
May I ask a question slightly off topic: who in their right mind does all sorts of identifiers and numbers with Integer type and not Char?
Well, my task is now more likely to take a ready-made implementation of the database, and translate it to the Web on Django :). Accordingly, the fact that it was in the original and guided, and the General experience I have no. - Willow17 commented on October 8th 19 at 00:15
October 8th 19 at 00:14
@unit1 correct solution for the General case described. Specifically in the admin, in this particular case it can be a little easier ('classes': ['wide'] in gange already defined):

class MyAdmin(admin.ModelAdmin):

 fieldsets = (
 (None, {
 'classes': ['wide'],
 'fields': ('name', 'slug', 'enabled')
}),
 (u 'Location', {
 'classes': ['wide'],
 'fields': ('address', ),
 }), 
}

Find more questions by tags System administrationDjangoPython