Answer the question
In order to leave comments, you need to log in
Django admin setup (broad field description)?
When creating another model in Django, I encountered such a problem, which is easier to show than to explain:
Or, more precisely, the problem is that, as you can see, the title of the “Name” field and “Location” practically climb onto TextEdits. Not to say that it is critical, but there is little beauty in this. In addition, the TIN (Integer) field is too small to contain the entire number without scrolling. Question 2: Is it possible to indent the headings by more so that it doesn’t fit, and is it possible to make the TIN field as wide as all the others?
ps In the screenshot, of course, admin tools, but in the native admin panel everything is 1 in 1 as well.
Answer the question
In order to leave comments, you need to log in
About the width of the labels.
Since you have admintools, then you can add your ccs.
This should work, although you may need to specify !important
.aligned label{18em}
As for the width of the TIN field, specify the form and in the form specify the widget attribute, something like this:
class MyModelAdminForm(forms.ModelForm):
class Meta:
model = MyModel
widgets = {'inn':widgets.Textinput(attrs={'size':55})}
class MyModelAdmin(admin.ModelAdmin):
form = MyModelAdminForm
Or maybe a question a little off topic: who in their right mind makes all sorts of identifiers and numbers of type Integer and not Char?
@unit1 described the correct solution for the general case. Specifically, in the admin panel, specifically in this case, it can be a little simpler ('classes': ['wide'] is already defined in jung):
class MyAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'classes': ['wide'],
'fields': ('name', 'slug', 'enabled')
}),
(u'Расположение', {
'classes': ['wide'],
'fields': ('address', ),
}),
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question