2008-07-19 07:54:34 +08:00
|
|
|
"""
|
|
|
|
Form Widget classes specific to the Django admin site.
|
|
|
|
"""
|
2011-03-28 09:40:43 +08:00
|
|
|
import copy
|
2012-06-08 00:08:47 +08:00
|
|
|
|
2008-07-19 09:22:26 +08:00
|
|
|
from django import forms
|
2013-11-18 06:26:20 +08:00
|
|
|
from django.db.models.deletion import CASCADE
|
2015-12-30 23:51:16 +08:00
|
|
|
from django.urls import reverse
|
2016-01-28 08:43:04 +08:00
|
|
|
from django.urls.exceptions import NoReverseMatch
|
2015-01-28 20:35:27 +08:00
|
|
|
from django.utils.encoding import force_text
|
2016-12-28 06:00:56 +08:00
|
|
|
from django.utils.html import smart_urlquote
|
2015-01-28 20:35:27 +08:00
|
|
|
from django.utils.safestring import mark_safe
|
2011-07-14 21:47:10 +08:00
|
|
|
from django.utils.text import Truncator
|
2008-07-19 07:54:34 +08:00
|
|
|
from django.utils.translation import ugettext as _
|
|
|
|
|
2011-08-11 22:07:39 +08:00
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
class FilteredSelectMultiple(forms.SelectMultiple):
|
|
|
|
"""
|
|
|
|
A SelectMultiple with a JavaScript filter interface.
|
|
|
|
|
2008-09-01 01:20:43 +08:00
|
|
|
Note that the resulting JavaScript assumes that the jsi18n
|
|
|
|
catalog has been loaded in the page
|
2008-07-19 07:54:34 +08:00
|
|
|
"""
|
2011-08-11 22:07:39 +08:00
|
|
|
@property
|
|
|
|
def media(self):
|
|
|
|
js = ["core.js", "SelectBox.js", "SelectFilter2.js"]
|
2015-11-07 19:24:38 +08:00
|
|
|
return forms.Media(js=["admin/js/%s" % path for path in js])
|
2008-09-01 01:20:43 +08:00
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
def __init__(self, verbose_name, is_stacked, attrs=None, choices=()):
|
|
|
|
self.verbose_name = verbose_name
|
|
|
|
self.is_stacked = is_stacked
|
|
|
|
super(FilteredSelectMultiple, self).__init__(attrs, choices)
|
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def get_context(self, name, value, attrs=None):
|
|
|
|
context = super(FilteredSelectMultiple, self).get_context(name, value, attrs)
|
|
|
|
context['widget']['attrs']['class'] = 'selectfilter'
|
2011-08-11 22:07:39 +08:00
|
|
|
if self.is_stacked:
|
2016-12-28 06:00:56 +08:00
|
|
|
context['widget']['attrs']['class'] += 'stacked'
|
|
|
|
context['widget']['attrs']['data-field-name'] = self.verbose_name
|
|
|
|
context['widget']['attrs']['data-is-stacked'] = int(self.is_stacked)
|
|
|
|
return context
|
2008-07-19 07:54:34 +08:00
|
|
|
|
2011-08-11 22:07:39 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
class AdminDateWidget(forms.DateInput):
|
2011-08-11 22:07:39 +08:00
|
|
|
@property
|
|
|
|
def media(self):
|
|
|
|
js = ["calendar.js", "admin/DateTimeShortcuts.js"]
|
2015-11-07 19:24:38 +08:00
|
|
|
return forms.Media(js=["admin/js/%s" % path for path in js])
|
2008-09-02 06:43:38 +08:00
|
|
|
|
2011-11-20 19:12:37 +08:00
|
|
|
def __init__(self, attrs=None, format=None):
|
|
|
|
final_attrs = {'class': 'vDateField', 'size': '10'}
|
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
|
|
|
super(AdminDateWidget, self).__init__(attrs=final_attrs, format=format)
|
2008-07-19 07:54:34 +08:00
|
|
|
|
2011-08-11 22:07:39 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
class AdminTimeWidget(forms.TimeInput):
|
2011-08-11 22:07:39 +08:00
|
|
|
@property
|
|
|
|
def media(self):
|
|
|
|
js = ["calendar.js", "admin/DateTimeShortcuts.js"]
|
2015-11-07 19:24:38 +08:00
|
|
|
return forms.Media(js=["admin/js/%s" % path for path in js])
|
2008-07-19 07:54:34 +08:00
|
|
|
|
2011-11-20 19:12:37 +08:00
|
|
|
def __init__(self, attrs=None, format=None):
|
|
|
|
final_attrs = {'class': 'vTimeField', 'size': '8'}
|
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
|
|
|
super(AdminTimeWidget, self).__init__(attrs=final_attrs, format=format)
|
2008-09-02 06:43:38 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
class AdminSplitDateTime(forms.SplitDateTimeWidget):
|
|
|
|
"""
|
|
|
|
A SplitDateTime Widget that has some admin-specific styling.
|
|
|
|
"""
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/split_datetime.html'
|
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
def __init__(self, attrs=None):
|
|
|
|
widgets = [AdminDateWidget, AdminTimeWidget]
|
|
|
|
# Note that we're calling MultiWidget, not SplitDateTimeWidget, because
|
|
|
|
# we want to define widgets.
|
|
|
|
forms.MultiWidget.__init__(self, widgets, attrs)
|
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def get_context(self, name, value, attrs):
|
|
|
|
context = super(AdminSplitDateTime, self).get_context(name, value, attrs)
|
|
|
|
context['date_label'] = _('Date:')
|
|
|
|
context['time_label'] = _('Time:')
|
|
|
|
return context
|
2008-07-19 07:54:34 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
class AdminRadioSelect(forms.RadioSelect):
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/radio.html'
|
2008-07-19 07:54:34 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2010-10-01 10:02:58 +08:00
|
|
|
class AdminFileWidget(forms.ClearableFileInput):
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/clearable_file_input.html'
|
2008-09-02 06:43:38 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2011-01-28 22:08:25 +08:00
|
|
|
def url_params_from_lookup_dict(lookups):
|
|
|
|
"""
|
|
|
|
Converts the type of lookups specified in a ForeignKey limit_choices_to
|
|
|
|
attribute to a dictionary of query parameters
|
|
|
|
"""
|
|
|
|
params = {}
|
|
|
|
if lookups and hasattr(lookups, 'items'):
|
|
|
|
items = []
|
|
|
|
for k, v in lookups.items():
|
2013-08-07 00:38:31 +08:00
|
|
|
if callable(v):
|
|
|
|
v = v()
|
2011-04-22 20:03:50 +08:00
|
|
|
if isinstance(v, (tuple, list)):
|
2013-08-30 07:20:00 +08:00
|
|
|
v = ','.join(str(x) for x in v)
|
2011-01-28 22:08:42 +08:00
|
|
|
elif isinstance(v, bool):
|
|
|
|
v = ('0', '1')[v]
|
2011-01-28 22:08:25 +08:00
|
|
|
else:
|
2016-12-29 23:27:49 +08:00
|
|
|
v = str(v)
|
2011-01-28 22:08:25 +08:00
|
|
|
items.append((k, v))
|
|
|
|
params.update(dict(items))
|
|
|
|
return params
|
2008-07-19 07:54:34 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
class ForeignKeyRawIdWidget(forms.TextInput):
|
|
|
|
"""
|
|
|
|
A Widget for displaying ForeignKeys in the "raw_id" interface rather than
|
|
|
|
in a <select> box.
|
|
|
|
"""
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/foreign_key_raw_id.html'
|
|
|
|
|
2011-08-02 07:38:11 +08:00
|
|
|
def __init__(self, rel, admin_site, attrs=None, using=None):
|
2008-07-19 07:54:34 +08:00
|
|
|
self.rel = rel
|
2011-08-02 07:38:11 +08:00
|
|
|
self.admin_site = admin_site
|
2009-12-22 23:18:51 +08:00
|
|
|
self.db = using
|
2008-07-19 07:54:34 +08:00
|
|
|
super(ForeignKeyRawIdWidget, self).__init__(attrs)
|
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def get_context(self, name, value, attrs=None):
|
|
|
|
context = super(ForeignKeyRawIdWidget, self).get_context(name, value, attrs)
|
2015-02-26 22:19:17 +08:00
|
|
|
rel_to = self.rel.model
|
2011-08-02 07:38:11 +08:00
|
|
|
if rel_to in self.admin_site._registry:
|
|
|
|
# The related object is registered with the same AdminSite
|
2013-12-13 04:23:24 +08:00
|
|
|
related_url = reverse(
|
|
|
|
'admin:%s_%s_changelist' % (
|
|
|
|
rel_to._meta.app_label,
|
|
|
|
rel_to._meta.model_name,
|
|
|
|
),
|
|
|
|
current_app=self.admin_site.name,
|
|
|
|
)
|
2011-08-02 07:38:11 +08:00
|
|
|
|
|
|
|
params = self.url_parameters()
|
|
|
|
if params:
|
2016-12-28 06:00:56 +08:00
|
|
|
related_url += '?' + '&'.join(
|
|
|
|
'%s=%s' % (k, v) for k, v in params.items(),
|
|
|
|
)
|
|
|
|
context['related_url'] = mark_safe(related_url)
|
|
|
|
context['link_title'] = _('Lookup')
|
|
|
|
# The JavaScript code looks for this class.
|
|
|
|
context['widget']['attrs'].setdefault('class', 'vForeignKeyRawIdAdminField')
|
|
|
|
if context['widget']['value']:
|
|
|
|
context['link_label'], context['link_url'] = self.label_and_url_for_value(value)
|
|
|
|
return context
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2008-09-02 14:10:14 +08:00
|
|
|
def base_url_parameters(self):
|
2014-02-02 03:23:31 +08:00
|
|
|
limit_choices_to = self.rel.limit_choices_to
|
|
|
|
if callable(limit_choices_to):
|
|
|
|
limit_choices_to = limit_choices_to()
|
|
|
|
return url_params_from_lookup_dict(limit_choices_to)
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2008-09-02 14:10:14 +08:00
|
|
|
def url_parameters(self):
|
|
|
|
from django.contrib.admin.views.main import TO_FIELD_VAR
|
|
|
|
params = self.base_url_parameters()
|
|
|
|
params.update({TO_FIELD_VAR: self.rel.get_related_field().name})
|
|
|
|
return params
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def label_and_url_for_value(self, value):
|
2008-09-02 06:43:38 +08:00
|
|
|
key = self.rel.get_related_field().name
|
2010-03-02 10:28:49 +08:00
|
|
|
try:
|
2015-02-26 22:19:17 +08:00
|
|
|
obj = self.rel.model._default_manager.using(self.db).get(**{key: value})
|
|
|
|
except (ValueError, self.rel.model.DoesNotExist):
|
2016-12-28 06:00:56 +08:00
|
|
|
return '', ''
|
2008-09-02 06:43:38 +08:00
|
|
|
|
2016-01-28 08:43:04 +08:00
|
|
|
try:
|
2016-12-28 06:00:56 +08:00
|
|
|
url = reverse(
|
2016-01-28 08:43:04 +08:00
|
|
|
'%s:%s_%s_change' % (
|
|
|
|
self.admin_site.name,
|
|
|
|
obj._meta.app_label,
|
|
|
|
obj._meta.object_name.lower(),
|
|
|
|
),
|
|
|
|
args=(obj.pk,)
|
|
|
|
)
|
|
|
|
except NoReverseMatch:
|
2016-12-28 06:00:56 +08:00
|
|
|
url = '' # Admin not registered for target model.
|
2016-01-28 08:43:04 +08:00
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
return Truncator(obj).words(14, truncate='...'), url
|
2016-01-28 08:43:04 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
|
|
|
|
"""
|
|
|
|
A Widget for displaying ManyToMany ids in the "raw_id" interface rather than
|
|
|
|
in a <select multiple> box.
|
|
|
|
"""
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/many_to_many_raw_id.html'
|
|
|
|
|
|
|
|
def get_context(self, name, value, attrs=None):
|
|
|
|
context = super(ManyToManyRawIdWidget, self).get_context(name, value, attrs)
|
2015-02-26 22:19:17 +08:00
|
|
|
if self.rel.model in self.admin_site._registry:
|
2011-08-02 07:38:11 +08:00
|
|
|
# The related object is registered with the same AdminSite
|
2016-12-28 06:00:56 +08:00
|
|
|
context['widget']['attrs']['class'] = 'vManyToManyRawIdAdminField'
|
|
|
|
return context
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2008-09-02 14:10:14 +08:00
|
|
|
def url_parameters(self):
|
|
|
|
return self.base_url_parameters()
|
2009-07-17 00:16:13 +08:00
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def label_and_url_for_value(self, value):
|
|
|
|
return '', ''
|
2008-07-19 07:54:34 +08:00
|
|
|
|
|
|
|
def value_from_datadict(self, data, files, name):
|
2010-10-19 15:14:38 +08:00
|
|
|
value = data.get(name)
|
2008-07-19 07:54:34 +08:00
|
|
|
if value:
|
2010-10-19 15:14:38 +08:00
|
|
|
return value.split(',')
|
2008-09-02 06:43:38 +08:00
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def format_value(self, value):
|
|
|
|
return ','.join(force_text(v) for v in value) if value else ''
|
|
|
|
|
2008-07-19 07:54:34 +08:00
|
|
|
|
|
|
|
class RelatedFieldWidgetWrapper(forms.Widget):
|
|
|
|
"""
|
|
|
|
This class is a wrapper to a given widget to add the add icon for the
|
|
|
|
admin interface.
|
|
|
|
"""
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/related_widget_wrapper.html'
|
2013-11-18 06:26:20 +08:00
|
|
|
|
|
|
|
def __init__(self, widget, rel, admin_site, can_add_related=None,
|
|
|
|
can_change_related=False, can_delete_related=False):
|
2008-07-19 07:54:34 +08:00
|
|
|
self.needs_multipart_form = widget.needs_multipart_form
|
|
|
|
self.attrs = widget.attrs
|
|
|
|
self.choices = widget.choices
|
|
|
|
self.widget = widget
|
|
|
|
self.rel = rel
|
2010-09-11 00:56:36 +08:00
|
|
|
# Backwards compatible check for whether a user can add related
|
|
|
|
# objects.
|
|
|
|
if can_add_related is None:
|
2015-02-26 22:19:17 +08:00
|
|
|
can_add_related = rel.model in admin_site._registry
|
2010-09-11 00:56:36 +08:00
|
|
|
self.can_add_related = can_add_related
|
2013-11-18 06:26:20 +08:00
|
|
|
# XXX: The UX does not support multiple selected values.
|
|
|
|
multiple = getattr(widget, 'allow_multiple_selected', False)
|
|
|
|
self.can_change_related = not multiple and can_change_related
|
|
|
|
# XXX: The deletion UX can be confusing when dealing with cascading deletion.
|
|
|
|
cascade = getattr(rel, 'on_delete', None) is CASCADE
|
|
|
|
self.can_delete_related = not multiple and not cascade and can_delete_related
|
2008-07-19 07:54:34 +08:00
|
|
|
# so we can check if the related object is registered with this AdminSite
|
|
|
|
self.admin_site = admin_site
|
|
|
|
|
|
|
|
def __deepcopy__(self, memo):
|
|
|
|
obj = copy.copy(self)
|
|
|
|
obj.widget = copy.deepcopy(self.widget, memo)
|
|
|
|
obj.attrs = self.widget.attrs
|
|
|
|
memo[id(self)] = obj
|
|
|
|
return obj
|
|
|
|
|
2014-02-26 23:03:51 +08:00
|
|
|
@property
|
|
|
|
def is_hidden(self):
|
|
|
|
return self.widget.is_hidden
|
|
|
|
|
2011-08-11 22:07:39 +08:00
|
|
|
@property
|
|
|
|
def media(self):
|
2015-02-22 20:03:28 +08:00
|
|
|
return self.widget.media
|
2013-11-18 06:26:20 +08:00
|
|
|
|
|
|
|
def get_related_url(self, info, action, *args):
|
|
|
|
return reverse("admin:%s_%s_%s" % (info + (action,)),
|
|
|
|
current_app=self.admin_site.name, args=args)
|
2008-09-01 01:20:43 +08:00
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def get_context(self, name, value, attrs=None):
|
|
|
|
with self.widget.override_choices(self.choices):
|
|
|
|
context = self.widget.get_context(name, value, attrs)
|
|
|
|
|
2013-11-18 06:26:20 +08:00
|
|
|
from django.contrib.admin.views.main import IS_POPUP_VAR, TO_FIELD_VAR
|
2015-02-26 22:19:17 +08:00
|
|
|
rel_opts = self.rel.model._meta
|
2013-11-18 06:26:20 +08:00
|
|
|
info = (rel_opts.app_label, rel_opts.model_name)
|
|
|
|
url_params = '&'.join("%s=%s" % param for param in [
|
|
|
|
(TO_FIELD_VAR, self.rel.get_related_field().name),
|
|
|
|
(IS_POPUP_VAR, 1),
|
|
|
|
])
|
2016-12-28 06:00:56 +08:00
|
|
|
context['url_params'] = url_params
|
|
|
|
context['model'] = rel_opts.verbose_name
|
2013-11-18 06:26:20 +08:00
|
|
|
if self.can_change_related:
|
|
|
|
change_related_template_url = self.get_related_url(info, 'change', '__fk__')
|
|
|
|
context.update(
|
|
|
|
can_change_related=True,
|
|
|
|
change_related_template_url=change_related_template_url,
|
|
|
|
)
|
2010-09-11 00:56:36 +08:00
|
|
|
if self.can_add_related:
|
2013-11-18 06:26:20 +08:00
|
|
|
add_related_url = self.get_related_url(info, 'add')
|
|
|
|
context.update(
|
|
|
|
can_add_related=True,
|
|
|
|
add_related_url=add_related_url,
|
|
|
|
)
|
|
|
|
if self.can_delete_related:
|
|
|
|
delete_related_template_url = self.get_related_url(info, 'delete', '__fk__')
|
|
|
|
context.update(
|
|
|
|
can_delete_related=True,
|
|
|
|
delete_related_template_url=delete_related_template_url,
|
|
|
|
)
|
2016-12-28 06:00:56 +08:00
|
|
|
return context
|
2008-07-19 07:54:34 +08:00
|
|
|
|
|
|
|
def value_from_datadict(self, data, files, name):
|
|
|
|
return self.widget.value_from_datadict(data, files, name)
|
|
|
|
|
|
|
|
def id_for_label(self, id_):
|
|
|
|
return self.widget.id_for_label(id_)
|
2008-08-09 03:54:34 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2008-08-09 03:54:34 +08:00
|
|
|
class AdminTextareaWidget(forms.Textarea):
|
2008-08-09 05:27:03 +08:00
|
|
|
def __init__(self, attrs=None):
|
|
|
|
final_attrs = {'class': 'vLargeTextField'}
|
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
2008-08-09 05:33:55 +08:00
|
|
|
super(AdminTextareaWidget, self).__init__(attrs=final_attrs)
|
2008-08-09 03:54:34 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2008-08-09 03:54:34 +08:00
|
|
|
class AdminTextInputWidget(forms.TextInput):
|
2008-08-09 05:27:03 +08:00
|
|
|
def __init__(self, attrs=None):
|
|
|
|
final_attrs = {'class': 'vTextField'}
|
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
|
|
|
super(AdminTextInputWidget, self).__init__(attrs=final_attrs)
|
2008-08-09 03:54:34 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2013-07-26 19:22:30 +08:00
|
|
|
class AdminEmailInputWidget(forms.EmailInput):
|
|
|
|
def __init__(self, attrs=None):
|
|
|
|
final_attrs = {'class': 'vTextField'}
|
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
|
|
|
super(AdminEmailInputWidget, self).__init__(attrs=final_attrs)
|
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2013-07-26 19:22:30 +08:00
|
|
|
class AdminURLFieldWidget(forms.URLInput):
|
2016-12-28 06:00:56 +08:00
|
|
|
template_name = 'admin/widgets/url.html'
|
|
|
|
|
2008-08-09 05:27:03 +08:00
|
|
|
def __init__(self, attrs=None):
|
|
|
|
final_attrs = {'class': 'vURLField'}
|
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
|
|
|
super(AdminURLFieldWidget, self).__init__(attrs=final_attrs)
|
2008-08-09 03:54:34 +08:00
|
|
|
|
2016-12-28 06:00:56 +08:00
|
|
|
def get_context(self, name, value, attrs):
|
|
|
|
context = super(AdminURLFieldWidget, self).get_context(name, value, attrs)
|
|
|
|
context['current_label'] = _('Currently:')
|
|
|
|
context['change_label'] = _('Change:')
|
|
|
|
context['widget']['href'] = smart_urlquote(context['widget']['value'])
|
|
|
|
return context
|
|
|
|
|
|
|
|
def format_value(self, value):
|
|
|
|
value = super(AdminURLFieldWidget, self).format_value(value)
|
|
|
|
return force_text(value)
|
2012-07-07 20:24:50 +08:00
|
|
|
|
|
|
|
|
2016-09-08 23:58:42 +08:00
|
|
|
class AdminIntegerFieldWidget(forms.NumberInput):
|
2012-06-05 19:28:32 +08:00
|
|
|
class_name = 'vIntegerField'
|
|
|
|
|
2008-08-09 05:27:03 +08:00
|
|
|
def __init__(self, attrs=None):
|
2012-06-05 19:28:32 +08:00
|
|
|
final_attrs = {'class': self.class_name}
|
2008-08-09 05:27:03 +08:00
|
|
|
if attrs is not None:
|
|
|
|
final_attrs.update(attrs)
|
|
|
|
super(AdminIntegerFieldWidget, self).__init__(attrs=final_attrs)
|
2008-08-29 04:58:10 +08:00
|
|
|
|
2013-10-31 23:42:28 +08:00
|
|
|
|
2012-06-05 19:28:32 +08:00
|
|
|
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
|
|
|
|
class_name = 'vBigIntegerField'
|