Changes between Version 190 and Version 191 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
07/19/08 12:23:26 (7 years ago)
Author:
brosner
Comment:

improved the newforms-admin changes.

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v190 v191  
    715715Previously, there was one "global" version of the admin site, which used all models that contained a {{{class Admin}}}. This new scheme allows for much more fine-grained control over your admin sites, allowing you to have multiple admin sites in the same Django instance.
    716716
    717 
    718717=== Changed Admin.manager option to more flexible hook ===
    719718
    720 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 a ```queryset``` method:
     719The {{{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, a {{{ModelAdmin}}} clas may now define a ```queryset``` method:
    721720
    722721{{{
     
    733732=== Changed prepopulate_from to be defined in the Admin class, not database field classes ===
    734733
    735 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. This change was made in an effort to remove admin-specific options from the model itself. Here's an example comparing old syntax and new syntax:
     734The {{{prepopulate_from}}} option to database fields no longer exists. It's been discontinued in favor of the new {{{prepopulated_fields}}} option in a {{{ModelAdmin}}}. The new {{{prepopulated_fields}}} option, if given, should be a dictionary mapping field names to lists/tuples of field names. This change was made in an effort to remove admin-specific options from the model itself. Here's an example comparing old syntax and new syntax:
    736735
    737736{{{
     
    763762=== Moved admin doc views into django.contrib.admindocs ===
    764763
    765 As of [4585], the documentation views for the Django admin site were moved into a new package, {{{django.contrib.admindocs}}}.
     764The documentation views for the Django admin site were moved into a new package, {{{django.contrib.admindocs}}}.
    766765
    767766The 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.
     
    812811=== Inline editing ===
    813812
    814 The syntax is now different and much, much better.
     813We have significantly improved working with inlines.
     814
    815815Here is an example:
    816816{{{
    817817#!python
    818 from django.contrib import admin
    819 
    820 class ChildInline(admin.TabularInline):
    821     model = Child
    822     extra = 3
    823 
    824 class ParentAdmin(admin.ModelAdmin):
    825     model = Parent
    826     inlines = [ChildInline]
    827 }}}
    828 See [http://code.djangoproject.com/browser/django/branches/newforms-admin/docs/admin.txt#L506 this documentation] for more details on field options for inline classes
     818
     819# OLD:
     820
     821class Author(models.Model):
     822    name = models.CharField(max_length=100)
     823
     824class Book(models.Model):
     825    author = models.ForeignKey(Author, edit_inline=models.TABULAR)
     826    title = models.CharField(max_length=100)
     827
     828# NEW:
     829# no longer need the edit_inline database field option above. just remove it.
     830
     831from django.contrib import admin
     832
     833class BookInline(admin.TabularInline):
     834    model = Book
     835    extra = 3
     836
     837class AuthorAdmin(admin.ModelAdmin):
     838    inlines = [BookInline]
     839
     840admin.site.register(Author, AuthorAdmin)
     841}}}
     842
     843Before you would define an {{{edit_inline}}} database field option and give it the value of the type of inline you wanted, either {{{models.TABULAR}}} or {{{models.STACKED}}}. This is now done with classes and gives you much more flexibility over the options of a specific inline. See [http://www.djangoproject.com/documentation/admin/#inlinemodeladmin-objects the inlines documentation] to learn more.
    829844
    830845=== Refactored inner Admin ```js``` option to media definitions ===
     
    901916=== ```django.contrib.auth``` is now using newforms ===
    902917
    903 In [7191] ```django.contrib.auth``` has been converted to use newforms as
    904 opposed to using oldforms. If you are relying on the oldforms, you will need
    905 to modify your code/templates to work with newforms.
     918```django.contrib.auth``` has been converted to use newforms as opposed to
     919using oldforms. If you are relying on the oldforms, you will need to modify
     920your code/templates to work with newforms.
    906921
    907922=== Moved radio_admin from the model definition ===
Back to Top