Ticket #12509: adminui-selectorinline-2.diff

File adminui-selectorinline-2.diff, 85.0 KB (added by jbronn, 16 years ago)
  • django/forms/formsets.py

     
    119119        return self.forms[self.initial_form_count():]
    120120    extra_forms = property(_get_extra_forms)
    121121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
    122137    # Maybe this should just go away?
    123138    def _get_cleaned_data(self):
    124139        """
     
    268283        """A hook for adding extra fields on to each form instance."""
    269284        if self.can_order:
    270285            # Only pre-fill the ordering field for initial forms.
    271             if index < self.initial_form_count():
     286            if index < self.initial_form_count():
    272287                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_(u'Order'), initial=index+1, required=False)
    273288            else:
    274289                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_(u'Order'), required=False)
  • django/forms/models.py

     
    620620                pk_value = form.instance.pk
    621621            else:
    622622                try:
    623                     pk_value = self.get_queryset()[index].pk
     623                    if index is not None:
     624                        pk_value = self.get_queryset()[index].pk
     625                    else:
     626                        pk_value = None
    624627                except IndexError:
    625628                    pk_value = None
    626629            if isinstance(pk, OneToOneField) or isinstance(pk, ForeignKey):
  • django/contrib/admin/media/css/base.css

     
    260260    padding: 2px 5px;
    261261    font-size: 11px;
    262262    background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x;
    263     border-left: 1px solid #ddd;
    264263    border-bottom: 1px solid #ddd;
    265264}
    266265
     
    328327
    329328/* ORDERABLE TABLES */
    330329
    331 table.orderable tbody tr td:hover {
    332     cursor: move;
     330table.orderable tbody trhover {
     331    ;
    333332}
    334333
    335 table.orderable tbody tr td:first-child {
    336     padding-left: 14px;
     334table.orderable tbody tr td: {
     335    padding-left: 1px;
    337336    background-image: url(../img/admin/nav-bg-grabber.gif);
    338337    background-repeat: repeat-y;
    339338}
    340339
     340
     341
     342
     343
    341344table.orderable-initalized .order-cell, body>tr>td.order-cell {
    342345    display: none;
    343346}
    344347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
    345367/* FORM DEFAULTS */
    346368
    347369input, textarea, select, .form-row p {
  • django/contrib/admin/media/css/forms.css

     
    233233    width: 8em;
    234234}
    235235
    236 .inline-related {
    237     position: relative;
    238 }
    239 
    240236.inline-related h3 {
    241237    margin: 0;
    242238    color: #666;
     
    247243}
    248244
    249245.inline-related h3 span.delete {
    250     padding-left: 20px;
    251     position: absolute;
    252     top: 2px;
    253     right: 10px;
     246    float: right;
    254247}
    255248
    256249.inline-related h3 span.delete label {
     
    274267    color: #fff;
    275268}
    276269
    277 .inline-related.tabular fieldset.module table {
     270. fieldset.module table {
    278271    width: 100%;
    279272}
    280273
     
    282275    border: none;
    283276}
    284277
    285 .inline-group .tabular tr.has_original td {
     278. tr.has_original td {
    286279    padding-top: 2em;
    287280}
    288281
    289 .inline-group .tabular tr td.original {
     282. tr td.original {
    290283    padding: 2px 0 0 0;
    291284    width: 0;
    292285    _position: relative;
    293286}
    294287
    295 .inline-group .tabular th.original {
     288. th.original {
    296289    width: 0px;
    297290    padding: 0;
    298291}
    299292
    300 .inline-group .tabular td.original p {
     293. td.original p {
    301294    position: absolute;
    302295    left: 0;
    303296    height: 1.1em;
    304     padding: 2px 7px;
     297    padding: 2px px;
    305298    overflow: hidden;
    306299    font-size: 9px;
    307300    font-weight: bold;
     
    325318    padding-left: 14px;
    326319}
    327320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
  • django/contrib/admin/media/js/jquery.js

     
     1
     2
     3
     4
     5
     6
     7
     8
     9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
  • django/contrib/admin/options.py

     
    11871187
    11881188    def _media(self):
    11891189        from django.conf import settings
    1190         js = []
     1190        js = []
    11911191        if self.prepopulated_fields:
    11921192            js.append('js/urlify.js')
    11931193        if self.filter_vertical or self.filter_horizontal:
     
    12381238
    12391239class TabularInline(InlineModelAdmin):
    12401240    template = 'admin/edit_inline/tabular.html'
     1241
     1242
     1243
  • django/contrib/admin/__init__.py

     
    11from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
    22from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
    3 from django.contrib.admin.options import StackedInline, TabularInline
     3from django.contrib.admin.options import StackedInline, TabularInline
    44from django.contrib.admin.sites import AdminSite, site
    55from django.utils.importlib import import_module
    66
  • django/contrib/admin/helpers.py

     
    195195                self.opts.prepopulated_fields, None, self.readonly_fields,
    196196                model_admin=self.model_admin)
    197197
     198
     199
    198200    def fields(self):
    199201        fk = getattr(self.formset, "fk", None)
    200202        for i, field in enumerate(flatten_fieldsets(self.fieldsets)):
  • django/contrib/admin/templates/admin/edit_inline/stacked.html

     
    11{% load i18n %}
    2 <div class="inline-group">
     2<div class="inline-group">
    33  <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
     4
    45{{ inline_admin_formset.formset.management_form }}
    56{{ inline_admin_formset.formset.non_form_errors }}
    67
    78{% for inline_admin_form in inline_admin_formset %}
    8 <div class="inline-related{% if forloop.last %} last-related{% endif %}">
    9   <h3><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %}
     9<div class="inline-related{% if forloop.last %} {% endif %}">
     10  <h3><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %}
    1011        {% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/">{% trans "View on site" %}</a>{% endif %}
    1112        {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
    1213  </h3>
     
    2021</div>
    2122{% endfor %}
    2223
    23 {# <ul class="tools"> #}
    24 {#   <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #}
    25 {# </ul> #}
     24<ul class="tools add_inline" id="{{ inline_admin_formset.formset.prefix }}-addinline">
     25  <li><a id="{{ inline_admin_formset.formset.prefix }}-add" class="add" href="#">Add a {{ inline_admin_formset.opts.verbose_name }}</a></li>
     26</ul>
     27
    2628</div>
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
  • django/contrib/admin/templates/admin/edit_inline/selector.html

     
     1
     2
     3
     4
     5
     6
     7
     8
     9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

     
    11{% load i18n %}
    2 <div class="inline-group">
    3   <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
     2<div class="tabular inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
    43{{ inline_admin_formset.formset.management_form }}
    54<fieldset class="module">
    65   <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
    76   {{ inline_admin_formset.formset.non_form_errors }}
    8    <table>
     7   <table>
    98     <thead><tr>
    109     {% for is_hidden, label in inline_admin_formset.fields %}
    1110       {% if not is_hidden %}
     
    2019        {% if inline_admin_form.form.non_field_errors %}
    2120        <tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr>
    2221        {% endif %}
    23         <tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
     22        <tr class="inline-related {% if forloop.last %}empty_form{% endif %} {% if not inline_admin_formset.opts.order_field %}{% cycle 'row1' 'row2' %} {% endif %}{% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}"
     23             id="{{ inline_admin_formset.formset.prefix }}{% if not forloop.last %}{{ forloop.counter }}{% else %}-empty{% endif %}">
    2424
    2525        <td class="original">
    2626          {% if inline_admin_form.original or inline_admin_form.show_url %}<p>
     
    6666   </table>
    6767
    6868</fieldset>
    69   </div>
    7069
    71   {# <ul class="tools"> #}
    72   {#   <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #}
    73   {# </ul> #}
     70<ul class="tools add_inline" id="{{ inline_admin_formset.formset.prefix }}-addinline">
     71 
     72</ul>
    7473
    7574</div>
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
  • django/contrib/contenttypes/generic.py

     
    399399
    400400class GenericTabularInline(GenericInlineModelAdmin):
    401401    template = 'admin/edit_inline/tabular.html'
     402
     403
     404
     405
  • tests/regressiontests/forms/formsets.py

     
    238238<li>Choice: <input type="text" name="choices-3-choice" /></li>
    239239<li>Votes: <input type="text" name="choices-3-votes" /></li>
    240240
     241
    241242
     243
     244
     245
     246
     247
     248
    242249# FormSets with deletion ######################################################
    243250
    244251We can easily add deletion ability to a FormSet with an argument to
  • docs/ref/contrib/admin/index.txt

     
    990990            BookInline,
    991991        ]
    992992
    993 Django provides two subclasses of ``InlineModelAdmin`` and they are:
     993Django provides t subclasses of ``InlineModelAdmin`` and they are:
    994994
    995995    * ``TabularInline``
    996996    * ``StackedInline``
     997
    997998
    998 The difference between these two is merely the template used to render them.
     999The difference between these t is merely the template used to render them.
    9991000
    10001001``InlineModelAdmin`` options
    10011002-----------------------------
     
    10361037to the initial forms. See the
    10371038:ref:`formsets documentation <topics-forms-formsets>` for more information.
    10381039
     1040
     1041
     1042
    10391043``max_num``
    10401044~~~~~~~~~~~
    10411045
     
    12411245
    12421246    admin.site.register(Product, ProductAdmin)
    12431247
    1244 ``django.contrib.contenttypes.generic`` provides both a ``GenericTabularInline``
    1245 and ``GenericStackedInline`` and behave just like any other inline. See the
     1248``django.contrib.contenttypes.generic`` provides
     1249like any other inline. See the
    12461250:ref:`contenttypes documentation <ref-contrib-contenttypes>` for more specific
    12471251information.
    12481252
Back to Top