Migrating to new-admin...

7 views
Skip to first unread message

jdetaeye

unread,
Sep 15, 2007, 10:02:55 AM9/15/07
to Django developers

Hi,

I just finished migrating an application that uses the admin interface
to the new admin.
It took me quite a while to gather all changes correctly from the
mailing list, google search through tickets, and looking at the
code, ... :-(

Does it make sense to update the page http://code.djangoproject.com/wiki/NewformsAdminBranch
with more complete information for people to make the move?
Or do you have a different mechanism in mind to help people
migrating?
Or is the newforms-admin branch still too much on-the-move to do so?

Some extra migration information I believe people like me would be
interested in:

1) Registering code and how to handle it.
The wiki shows an example but doesn't go as far as to give people a
clear guideline / best practice on how to best handle the registration
of your admin classes.
I put the admin classes in a file admin.py and added an import
statement in the __init__.py file of my application directory. Not
sure whether this is the best and recommended way...

2) Rename 'fields' to 'fieldsets'
'fields' is still used, but it accepts only a list of fields.
In case one uses fieldsets to organize the fields, one needs to use
'fieldsets' instead.
If you forget to rename the field, you get an error message that is
very hard to relate back to its root cause.

3) Inlined models
The syntax is now different and much, much better. Not sure whether
the dust is completely settled on the new syntax...
You need code like:
from django.contrib import admin
class Child_Inline(admin.TabularInline):
model = Child
extra = 3
class Parent_admin(admin.ModelAdmin):
inlines = [Child_Inline]

4) raw_id_admin
The syntax is now (rightly) seperated from the definition of your
models.
In your adminoption classes one needs:
class YourModelAdmin(admin.ModelAdmin):
raw_id_fields = ('field1', 'field2')

When given a green light I am willing to update the wiki page with
this above information.

My 2 cents,

Johan

Joseph Kocherhans

unread,
Sep 15, 2007, 1:23:00 PM9/15/07
to django-d...@googlegroups.com
On 9/15/07, jdetaeye <johan.d...@gmail.com> wrote:
>
> Does it make sense to update the page http://code.djangoproject.com/wiki/NewformsAdminBranch
> with more complete information for people to make the move?
> Or do you have a different mechanism in mind to help people
> migrating?
> Or is the newforms-admin branch still too much on-the-move to do so?
>
> Some extra migration information I believe people like me would be
> interested in:

[snip]

> When given a green light I am willing to update the wiki page with
> this above information.

That would be great start. I think the newforms-admin branch is
getting close to stable, but I haven't put any effort into
documentation yet.

Joseph

jdetaeye

unread,
Sep 16, 2007, 3:09:07 AM9/16/07
to Django developers

Joseph,

I edited the page according to the above.

Personally, I feel the page is still very much "developer-oriented",
rather than "django-user-oriented". E.g. the refs to ticket numbers
are useful for the developer, but not for somebody who wants to get
going with the new-admin.
Given a green light I am willing to edit the page further.

>> That would be great start. I think the newforms-admin branch is getting close to stable, but I haven't put any effort into documentation yet.

"If it ain't documented, the functionality doesn't exist" It's one
of my credo's :-)

I believe that the little time required to update this page with the
latest info and status on the branch will pay off...

Regards,

Johan

Nicola Larosa

unread,
Sep 16, 2007, 6:04:57 AM9/16/07
to django-d...@googlegroups.com
jdetaeye wrote:
> Personally, I feel the page is still very much "developer-oriented",
> rather than "django-user-oriented". E.g. the refs to ticket numbers are
> useful for the developer, but not for somebody who wants to get going
> with the new-admin.
> Given a green light I am willing to edit the page further.

That *is* a developer-oriented page, since it's part of the dev wiki. :-)

The user doc you're looking has been added to the newforms-admin:

http://code.djangoproject.com/browser/django/branches/newforms-admin/docs/admin.txt

It's in ReStructured Text format, as all the rest of the user docs.


--
Nicola Larosa - http://www.tekNico.net/

I'd like to get to a point where I'm making a comfortable living that's
independent of any single client or employer, with complete control over
my schedule. That's my ultimate goal. -- Phillip J. Eby, April 2007


Reply all
Reply to author
Forward
0 new messages