On Dec 24, 2007 2:57 AM, Michel Thadeu Sabchuk <[EMAIL PROTECTED]> wrote:
>
> Hi guys,
>
> I'm migrating some of my applications to newforms-admin branch and I
> have a question about the way I should define extra js files at model
> level administration. Coming from standard django admin configuration
> I should expect that the following code would work:
>
> from django.contrib import admin
>
> admin_site = admin.AdminSite()
>
> class ObjectOptions(admin.ModelAdmin):
>     js = ['/path/to/some/extra/script/file.js']
> admin_site.register(Object, ObjectOptions)
>
> This code does not work, to specify extra js, I create a "admin/
> objects/object/change_form.html" template extending the "admin/
> change_form.html" and appending the proper scripts I need. Is this the
> recomended way now? The lack of js option in the admin configuration
> is proposital?

The capability to specify javascript is still there; it's just been
moved into a more generic framework for media handling that is shared
by ModelAdmin, forms, and widgets. Your ModelAdmin definition needs to
look like:

class ObjectOptions(admin.ModelAdmin):
    class Media:
        js = ['/path/to/some/extra/script/file.js']

The newforms.txt documentation in the newforms-admin branch contains a
detailed discussion on the capabilities of the new Media class.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to