Changeset 2800
- Timestamp:
- 05/01/06 10:02:39 (2 years ago)
- Files:
-
- django/branches/magic-removal/django/contrib/admin/templates/admin/field_line.html (modified) (1 diff)
- django/branches/magic-removal/django/contrib/admin/templates/widget/foreign.html (modified) (1 diff)
- django/branches/magic-removal/django/contrib/admin/templates/widget/one_to_one.html (modified) (1 diff)
- django/branches/magic-removal/django/db/models/fields/related.py (modified) (2 diffs)
- django/branches/magic-removal/docs/model-api.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/django/contrib/admin/templates/admin/field_line.html
r1443 r2800 10 10 {% field_label bound_field %} 11 11 {% endif %} 12 {% if change %}13 {% if bound_field.field.primary_key %}14 {{ bound_field.original_value }}15 {% endif %}16 {% if bound_field.raw_id_admin %}17 {% if bound_field.existing_display %} <strong>{{ bound_field.existing_display|truncatewords:"14" }}</strong>{% endif %}18 {% endif %}19 {% endif %}20 12 {% if bound_field.field.help_text %}<p class="help">{{ bound_field.field.help_text }}</p>{% endif %} 21 13 {% endfor %} django/branches/magic-removal/django/contrib/admin/templates/widget/foreign.html
r2677 r2800 11 11 <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a> 12 12 {% endif %}{% endif %} 13 {% if change %} 14 {% if bound_field.field.primary_key %} 15 {{ bound_field.original_value }} 16 {% endif %} 17 {% if bound_field.raw_id_admin %} 18 {% if bound_field.existing_display %} <strong>{{ bound_field.existing_display|truncatewords:"14" }}</strong>{% endif %} 19 {% endif %} 20 {% endif %} django/branches/magic-removal/django/contrib/admin/templates/widget/one_to_one.html
r2700 r2800 1 {% include "widget/foreign.html" %} 1 {% if add %}{% include "widget/foreign.html" %}{% endif %} 2 {% if change %}{% if bound_field.existing_display %} <strong>{{ bound_field.existing_display|truncatewords:"14" }}</strong>{% endif %}{% endif %} django/branches/magic-removal/django/db/models/fields/related.py
r2771 r2800 76 76 # but this can be overridden with the "related_name" option. 77 77 return self.rel.related_name or opts.object_name.lower() 78 79 def prepare_field_objs_and_params(self, manipulator, name_prefix): 80 params = {'validator_list': self.validator_list[:], 'member_name': name_prefix + self.attname} 81 if self.rel.raw_id_admin: 82 field_objs = self.get_manipulator_field_objs() 83 params['validator_list'].append(curry(manipulator_valid_rel_key, self, manipulator)) 84 else: 85 if self.radio_admin: 86 field_objs = [forms.RadioSelectField] 87 params['ul_class'] = get_ul_class(self.radio_admin) 88 else: 89 if self.null: 90 field_objs = [forms.NullSelectField] 91 else: 92 field_objs = [forms.SelectField] 93 params['choices'] = self.get_choices_default() 94 return field_objs, params 78 95 79 96 class SingleRelatedObjectDescriptor(object): … … 452 469 return '%s__%s__exact' % (self.name, self.rel.get_related_field().name) 453 470 454 def prepare_field_objs_and_params(self, manipulator, name_prefix):455 params = {'validator_list': self.validator_list[:], 'member_name': name_prefix + self.attname}456 if self.rel.raw_id_admin:457 field_objs = self.get_manipulator_field_objs()458 params['validator_list'].append(curry(manipulator_valid_rel_key, self, manipulator))459 else:460 if self.radio_admin:461 field_objs = [forms.RadioSelectField]462 params['ul_class'] = get_ul_class(self.radio_admin)463 else:464 if self.null:465 field_objs = [forms.NullSelectField]466 else:467 field_objs = [forms.SelectField]468 params['choices'] = self.get_choices_default()469 return field_objs, params470 471 471 def get_manipulator_field_objs(self): 472 472 rel_field = self.rel.get_related_field() django/branches/magic-removal/docs/model-api.txt
r2799 r2800 878 878 879 879 This ``OneToOneField`` will actually replace the primary key ``id`` field 880 (since one-to-one relations share the same primary key), and has a few 881 differences in the admin interface: 882 883 * No ``Place`` selection interface is displayed on ``Restaurant`` pages. 884 There will be one (and only one) ``Restaurant`` for each ``Place``. 885 886 * On the ``Restaurant`` change list, every ``Place`` -- whether it has an 887 associated ``Restaurant`` or not -- will be displayed. Adding a 888 ``Restaurant`` to a ``Place`` just means filling out the required 889 ``Restaurant`` fields. 880 (since one-to-one relations share the same primary key), and will be displayed 881 as a read-only field when you edit an object in the admin interface: 890 882 891 883 See the `One-to-one relationship model example`_ for a full example.
