Ticket #12509: adminui-selectorinline-2.diff
| File adminui-selectorinline-2.diff, 85.0 KB (added by , 16 years ago) |
|---|
-
django/forms/formsets.py
119 119 return self.forms[self.initial_form_count():] 120 120 extra_forms = property(_get_extra_forms) 121 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 122 137 # Maybe this should just go away? 123 138 def _get_cleaned_data(self): 124 139 """ … … 268 283 """A hook for adding extra fields on to each form instance.""" 269 284 if self.can_order: 270 285 # Only pre-fill the ordering field for initial forms. 271 if index < self.initial_form_count():286 if index < self.initial_form_count(): 272 287 form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_(u'Order'), initial=index+1, required=False) 273 288 else: 274 289 form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_(u'Order'), required=False) -
django/forms/models.py
620 620 pk_value = form.instance.pk 621 621 else: 622 622 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 624 627 except IndexError: 625 628 pk_value = None 626 629 if isinstance(pk, OneToOneField) or isinstance(pk, ForeignKey): -
django/contrib/admin/media/css/base.css
260 260 padding: 2px 5px; 261 261 font-size: 11px; 262 262 background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x; 263 border-left: 1px solid #ddd;264 263 border-bottom: 1px solid #ddd; 265 264 } 266 265 … … 328 327 329 328 /* ORDERABLE TABLES */ 330 329 331 table.orderable tbody tr td:hover {332 cursor: move;330 table.orderable tbody trhover { 331 ; 333 332 } 334 333 335 table.orderable tbody tr td: first-child{336 padding-left: 1 4px;334 table.orderable tbody tr td: { 335 padding-left: 1px; 337 336 background-image: url(../img/admin/nav-bg-grabber.gif); 338 337 background-repeat: repeat-y; 339 338 } 340 339 340 341 342 343 341 344 table.orderable-initalized .order-cell, body>tr>td.order-cell { 342 345 display: none; 343 346 } 344 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 345 367 /* FORM DEFAULTS */ 346 368 347 369 input, textarea, select, .form-row p { -
django/contrib/admin/media/css/forms.css
233 233 width: 8em; 234 234 } 235 235 236 .inline-related {237 position: relative;238 }239 240 236 .inline-related h3 { 241 237 margin: 0; 242 238 color: #666; … … 247 243 } 248 244 249 245 .inline-related h3 span.delete { 250 padding-left: 20px; 251 position: absolute; 252 top: 2px; 253 right: 10px; 246 float: right; 254 247 } 255 248 256 249 .inline-related h3 span.delete label { … … 274 267 color: #fff; 275 268 } 276 269 277 . inline-related.tabularfieldset.module table {270 . fieldset.module table { 278 271 width: 100%; 279 272 } 280 273 … … 282 275 border: none; 283 276 } 284 277 285 . inline-group .tabulartr.has_original td {278 . tr.has_original td { 286 279 padding-top: 2em; 287 280 } 288 281 289 . inline-group .tabulartr td.original {282 . tr td.original { 290 283 padding: 2px 0 0 0; 291 284 width: 0; 292 285 _position: relative; 293 286 } 294 287 295 . inline-group .tabularth.original {288 . th.original { 296 289 width: 0px; 297 290 padding: 0; 298 291 } 299 292 300 . inline-group .tabulartd.original p {293 . td.original p { 301 294 position: absolute; 302 295 left: 0; 303 296 height: 1.1em; 304 padding: 2px 7px;297 padding: 2px px; 305 298 overflow: hidden; 306 299 font-size: 9px; 307 300 font-weight: bold; … … 325 318 padding-left: 14px; 326 319 } 327 320 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
1187 1187 1188 1188 def _media(self): 1189 1189 from django.conf import settings 1190 js = [ ]1190 js = [] 1191 1191 if self.prepopulated_fields: 1192 1192 js.append('js/urlify.js') 1193 1193 if self.filter_vertical or self.filter_horizontal: … … 1238 1238 1239 1239 class TabularInline(InlineModelAdmin): 1240 1240 template = 'admin/edit_inline/tabular.html' 1241 1242 1243 -
django/contrib/admin/__init__.py
1 1 from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME 2 2 from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL 3 from django.contrib.admin.options import StackedInline, TabularInline 3 from django.contrib.admin.options import StackedInline, TabularInline 4 4 from django.contrib.admin.sites import AdminSite, site 5 5 from django.utils.importlib import import_module 6 6 -
django/contrib/admin/helpers.py
195 195 self.opts.prepopulated_fields, None, self.readonly_fields, 196 196 model_admin=self.model_admin) 197 197 198 199 198 200 def fields(self): 199 201 fk = getattr(self.formset, "fk", None) 200 202 for i, field in enumerate(flatten_fieldsets(self.fieldsets)): -
django/contrib/admin/templates/admin/edit_inline/stacked.html
1 1 {% load i18n %} 2 <div class="inline-group" >2 <div class="inline-group"> 3 3 <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2> 4 4 5 {{ inline_admin_formset.formset.management_form }} 5 6 {{ inline_admin_formset.formset.non_form_errors }} 6 7 7 8 {% 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> {% 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> {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %} 10 11 {% 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 %} 11 12 {% 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 %} 12 13 </h3> … … 20 21 </div> 21 22 {% endfor %} 22 23 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 26 28 </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
1 1 {% 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"> 4 3 {{ inline_admin_formset.formset.management_form }} 5 4 <fieldset class="module"> 6 5 <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2> 7 6 {{ inline_admin_formset.formset.non_form_errors }} 8 <table >7 <table> 9 8 <thead><tr> 10 9 {% for is_hidden, label in inline_admin_formset.fields %} 11 10 {% if not is_hidden %} … … 20 19 {% if inline_admin_form.form.non_field_errors %} 21 20 <tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr> 22 21 {% 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 %}"> 24 24 25 25 <td class="original"> 26 26 {% if inline_admin_form.original or inline_admin_form.show_url %}<p> … … 66 66 </table> 67 67 68 68 </fieldset> 69 </div>70 69 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> 74 73 75 74 </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
399 399 400 400 class GenericTabularInline(GenericInlineModelAdmin): 401 401 template = 'admin/edit_inline/tabular.html' 402 403 404 405 -
tests/regressiontests/forms/formsets.py
238 238 <li>Choice: <input type="text" name="choices-3-choice" /></li> 239 239 <li>Votes: <input type="text" name="choices-3-votes" /></li> 240 240 241 241 242 243 244 245 246 247 248 242 249 # FormSets with deletion ###################################################### 243 250 244 251 We can easily add deletion ability to a FormSet with an argument to -
docs/ref/contrib/admin/index.txt
990 990 BookInline, 991 991 ] 992 992 993 Django provides t wosubclasses of ``InlineModelAdmin`` and they are:993 Django provides t subclasses of ``InlineModelAdmin`` and they are: 994 994 995 995 * ``TabularInline`` 996 996 * ``StackedInline`` 997 997 998 998 The difference between these t wois merely the template used to render them.999 The difference between these t is merely the template used to render them. 999 1000 1000 1001 ``InlineModelAdmin`` options 1001 1002 ----------------------------- … … 1036 1037 to the initial forms. See the 1037 1038 :ref:`formsets documentation <topics-forms-formsets>` for more information. 1038 1039 1040 1041 1042 1039 1043 ``max_num`` 1040 1044 ~~~~~~~~~~~ 1041 1045 … … 1241 1245 1242 1246 admin.site.register(Product, ProductAdmin) 1243 1247 1244 ``django.contrib.contenttypes.generic`` provides both a ``GenericTabularInline``1245 and ``GenericStackedInline`` and behave justlike any other inline. See the1248 ``django.contrib.contenttypes.generic`` provides 1249 like any other inline. See the 1246 1250 :ref:`contenttypes documentation <ref-contrib-contenttypes>` for more specific 1247 1251 information. 1248 1252