The Jan. 31 deadline for merging the newforms-admin has passed, so I
thought I'd give a status update:

I'm really excited about the changes made so far in this branch. In a
nutshell, the way admin options are specified has gotten *much* more
flexible, resulting in easier and more powerful customization of the
Django admin site. A model's "class Admin" now has new hooks, such as
has_add_permission(), that let you define arbitrary behavior. I've
also taken the opportunity to refactor some admin-specific options --
raw_id_admin and prepopulate_from -- so that they're defined in the
"class Admin" rather than in the model fields themselves. To see which
hooks have been implemented, see the class ModelAdmin in
django/contrib/admin/options.py in the newforms-admin branch.

The admin site, using this branch, should be completely functional
according to my tests -- except for "edit inline" fields. If you're
not using "edit_inline" in your models, I encourage you to check out
the branch and take it for a spin, reporting any bugs. Information on
getting the branch is here:
http://code.djangoproject.com/wiki/NewformsAdminBranch

Regarding "edit inline," a couple of decisions need to be made. Ticket
#2248 (http://code.djangoproject.com/ticket/2248) has an interesting
suggestion: you define the inline stuff within the admin class. I'll
copy and paste from that ticket:

    class Admin:
        inline_models = (
            {'model':'Child',
             'type':models.TABULAR,
             'min_num_in_admin':3,
             'max_num_in_admin':20,
             'num_extra_on_change':3,
             'fields':('name','age',)
            },
            {'model':'Job',
             'type':models.STACKED,
             'min_num_in_admin':1,
             'max_num_in_admin':3,
             'fields':('company','salary',)
            }
        )

I agree this approach is a huge improvement over the current syntax,
but I wonder whether it can be expanded even more. Instead of
dictionaries, let's use objects:

    from django.contrib.admin import TabularInline, StackedInline

    # ...

    class Admin:
        inlines = (
            TabularInline('Child', min=3, max=20, extra=3,
                fields=('name', 'age')),
            StackedInline('Job', min=1, max=3,
                fields=('company', 'salary')),
        )

This infastructure would let you create your own inline types by
implementing an Inline subclass.

What sort of hooks would an Inline class need? And are there any
thoughts or other ideas/proposals while we're focusing on this?

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to