Changes between Version 12 and Version 13 of NewformsAdminBranch


Ignore:
Timestamp:
Apr 6, 2007, 11:31:28 PM (18 years ago)
Author:
Adrian Holovaty
Comment:

Added "Backwards-incompatible changes" section, which is incomplete

Legend:

Unmodified
Added
Removed
Modified
  • NewformsAdminBranch

    v12 v13  
    4444|| Change {{{raw_id_admin}}} so that it's a {{{class Admin}}} option rather than being a database {{{Field}}} option. || Done in [4430] ||
    4545|| Figure out a cleaner way of specifying admin options, now that {{{class Admin}}} is much more powerful. It doesn't feel like it should live in the model anymore. || Not done yet; discussion is [http://groups.google.com/group/django-developers/browse_frm/thread/d94c7b11392c5085/# here] ||
     46
     47== Backwards-incompatible changes ==
     48
     49This is a (currently incomplete) list of backwards-incompatible changes made in this branch.
     50
     51=== Changed Admin.manager option to more flexible hook ===
     52
     53As 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
     59These give you much more flexibility.
     60
     61Note 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
     65As 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:
     71class 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:
     80class 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
     89Note 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
     93As of [4585], the documentation views for the Django admin site were moved into a new package, {{{django.contrib.admindocs}}}.
     94
     95The 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
     97Because 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
     104Note that this change was made to the NewformsAdminBranch. The change will not be made to trunk until that branch is merged to trunk.
Back to Top