| 46 | |
| 47 | == Backwards-incompatible changes == |
| 48 | |
| 49 | This is a (currently incomplete) list of backwards-incompatible changes made in this branch. |
| 50 | |
| 51 | === Changed Admin.manager option to more flexible hook === |
| 52 | |
| 53 | As of [4342], the {{{manager}}} option to {{{class Admin}}} no longer exists. This option was undocumented, but we're mentioning the change here in case you used it. In favor of this option, {{{class Admin}}} may now define one of these methods: |
| 54 | |
| 55 | * {{{queryset()}}} |
| 56 | * {{{queryset_add()}}} |
| 57 | * {{{queryset_change()}}} |
| 58 | |
| 59 | These give you much more flexibility. |
| 60 | |
| 61 | Note that this change was made to the NewformsAdminBranch. (We initially called the new method {{{change_list_queryset}}}, but this was changed in [4584] to be more flexible.) The change will not be made to trunk until that branch is merged to trunk. |
| 62 | |
| 63 | === Changed prepopulate_from to be defined in the Admin class, not database field classes === |
| 64 | |
| 65 | As of [4446], the {{{prepopulate_from}}} option to database fields no longer exists. It's been discontinued in favor of the new {{{prepopulated_fields}}} option on {{{class Admin}}}. The new {{{prepopulated_fields}}} option, if given, should be a dictionary mapping field names to lists/tuples of field names. Here's an example comparing old syntax and new syntax: |
| 66 | |
| 67 | {{{ |
| 68 | #!python |
| 69 | |
| 70 | # OLD: |
| 71 | class MyModel(models.Model): |
| 72 | first_name = models.CharField(maxlength=30) |
| 73 | last_name = models.CharField(maxlength=30) |
| 74 | slug = models.CharField(maxlength=60, prepopulate_from=('first_name', 'last_name')) |
| 75 | |
| 76 | class Admin: |
| 77 | pass |
| 78 | |
| 79 | # NEW: |
| 80 | class MyModel(models.Model): |
| 81 | first_name = models.CharField(maxlength=30) |
| 82 | last_name = models.CharField(maxlength=30) |
| 83 | slug = models.CharField(maxlength=60) |
| 84 | |
| 85 | class Admin: |
| 86 | prepopulated_fields = {'slug': ('first_name', 'last_name')} |
| 87 | }}} |
| 88 | |
| 89 | Note that this change was made to the NewformsAdminBranch. The change will not be made to trunk until that branch is merged to trunk. |
| 90 | |
| 91 | === Moved admin doc views into django.contrib.admindocs === |
| 92 | |
| 93 | As of [4585], the documentation views for the Django admin site were moved into a new package, {{{django.contrib.admindocs}}}. |
| 94 | |
| 95 | The admin docs, which aren't documented very well, were located at {{{docs/}}} in the admin site. They're also linked-to by the "Documentation" link in the upper right of default admin templates. |
| 96 | |
| 97 | Because we've moved the doc views, you now have to activate admin docs explicitly. Do this by adding the following line to your URLconf: |
| 98 | |
| 99 | {{{ |
| 100 | #!python |
| 101 | (r'^admin/doc/', include('django.contrib.admindocs.urls')), |
| 102 | }}} |
| 103 | |
| 104 | Note that this change was made to the NewformsAdminBranch. The change will not be made to trunk until that branch is merged to trunk. |