Merge pull request #112 from bohyn/master

Django Admin's input for BigIntegerField should be larger, Fixes #17804
This commit is contained in:
Honza Král 2012-06-05 04:39:47 -07:00
commit 4db34e7b4f
3 changed files with 11 additions and 2 deletions

View File

@ -49,7 +49,7 @@ FORMFIELD_FOR_DBFIELD_DEFAULTS = {
models.TextField: {'widget': widgets.AdminTextareaWidget}, models.TextField: {'widget': widgets.AdminTextareaWidget},
models.URLField: {'widget': widgets.AdminURLFieldWidget}, models.URLField: {'widget': widgets.AdminURLFieldWidget},
models.IntegerField: {'widget': widgets.AdminIntegerFieldWidget}, models.IntegerField: {'widget': widgets.AdminIntegerFieldWidget},
models.BigIntegerField: {'widget': widgets.AdminIntegerFieldWidget}, models.BigIntegerField: {'widget': widgets.AdminBigIntegerFieldWidget},
models.CharField: {'widget': widgets.AdminTextInputWidget}, models.CharField: {'widget': widgets.AdminTextInputWidget},
models.ImageField: {'widget': widgets.AdminFileWidget}, models.ImageField: {'widget': widgets.AdminFileWidget},
models.FileField: {'widget': widgets.AdminFileWidget}, models.FileField: {'widget': widgets.AdminFileWidget},

View File

@ -226,6 +226,10 @@ body.popup .submit-row {
width: 5em; width: 5em;
} }
.vBigIntegerField {
width: 10em;
}
.vForeignKeyRawIdAdminField { .vForeignKeyRawIdAdminField {
width: 5em; width: 5em;
} }

View File

@ -303,12 +303,17 @@ class AdminURLFieldWidget(forms.TextInput):
super(AdminURLFieldWidget, self).__init__(attrs=final_attrs) super(AdminURLFieldWidget, self).__init__(attrs=final_attrs)
class AdminIntegerFieldWidget(forms.TextInput): class AdminIntegerFieldWidget(forms.TextInput):
class_name = 'vIntegerField'
def __init__(self, attrs=None): def __init__(self, attrs=None):
final_attrs = {'class': 'vIntegerField'} final_attrs = {'class': self.class_name}
if attrs is not None: if attrs is not None:
final_attrs.update(attrs) final_attrs.update(attrs)
super(AdminIntegerFieldWidget, self).__init__(attrs=final_attrs) super(AdminIntegerFieldWidget, self).__init__(attrs=final_attrs)
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
class_name = 'vBigIntegerField'
class AdminCommaSeparatedIntegerFieldWidget(forms.TextInput): class AdminCommaSeparatedIntegerFieldWidget(forms.TextInput):
def __init__(self, attrs=None): def __init__(self, attrs=None):
final_attrs = {'class': 'vCommaSeparatedIntegerField'} final_attrs = {'class': 'vCommaSeparatedIntegerField'}