1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

new-admin: Negligible formatting changes to django/core/meta/fields.py

git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1414 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-25 01:51:19 +00:00
parent 88fb208912
commit 5c60773256

View File

@ -59,7 +59,6 @@ def manipulator_validator_unique(f, opts, self, field_data, all_data):
return
raise validators.ValidationError, _("%(optname)s with this %(fieldname)s already exists.") % {'optname': capfirst(opts.verbose_name), 'fieldname': f.verbose_name}
class BoundField(object):
def __init__(self, field, field_mapping, original):
self.field = field
@ -79,7 +78,6 @@ class BoundField(object):
def __repr__(self):
return "BoundField:(%s, %s)" % (self.field.name, self.form_fields)
# A guide to Field parameters:
#
# * name: The name of the field specifed in the model.
@ -310,7 +308,6 @@ class Field(object):
def get_choices(self, include_blank=True, blank_choice=BLANK_CHOICE_DASH):
"Returns a list of tuples used as SelectField choices for this field."
first_choice = include_blank and blank_choice or []
if self.choices:
return first_choice + list(self.choices)
@ -333,8 +330,8 @@ class Field(object):
def flatten_data(self, follow, obj = None):
"""
Returns a dictionary mapping the field's manipulator field names to its
"flattened" string values for the admin view. Obj is the instance to extract the
values from.
"flattened" string values for the admin view. obj is the instance to
extract the values from.
"""
return {self.attname: self._get_val_from_obj(obj)}
@ -869,14 +866,12 @@ class OneToOne(ManyToOne):
class BoundFieldLine(object):
def __init__(self, field_line, field_mapping, original, bound_field_class=BoundField):
self.bound_fields = [field.bind(field_mapping, original, bound_field_class)
for field in field_line]
self.bound_fields = [field.bind(field_mapping, original, bound_field_class) for field in field_line]
def __iter__(self):
for bound_field in self.bound_fields:
yield bound_field
def __len__(self):
return len(self.bound_fields)
@ -901,8 +896,7 @@ class BoundFieldSet(object):
def __init__(self, field_set, field_mapping, original, bound_field_line_class=BoundFieldLine):
self.name = field_set.name
self.classes = field_set.classes
self.bound_field_lines = [ field_line.bind(field_mapping,original, bound_field_line_class)
for field_line in field_set]
self.bound_field_lines = [field_line.bind(field_mapping,original, bound_field_line_class) for field_line in field_set]
def __iter__(self):
for bound_field_line in self.bound_field_lines:
@ -950,7 +944,6 @@ class Admin:
}),)
else:
field_struct = self.fields
new_fieldset_list = []
for fieldset in field_struct:
name = fieldset[0]
@ -959,5 +952,3 @@ class Admin:
line_specs = fs_options['fields']
new_fieldset_list.append(FieldSet(name, classes, opts.get_field, line_specs))
return new_fieldset_list