List Info

Thread: newforms-admin: specify model level extra js files (the js admin option)




newforms-admin: specify model level extra js files (the js admin option)
user name
2007-12-23 11:57:32
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?

Thanks for help!

--
Michel Thadeu Sabchuk

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newforms-admin: specify model level extra js files (the js admin option)
user name
2007-12-30 09:24:56
On Dec 23, 2007 12:57 PM, Michel Thadeu Sabchuk < micheltsgmail.com">micheltsgmail.com> wrote:

Hi guys,

I&#39;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.js9;]
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&quot; and appending the proper scripts I need. Is this the
recomended way now? The lack of js option in the admin configuration
is proposital?

Thanks for help!

I would have expected the first way to work in newforms_admin, since I don't see any reason why this function would have been dropped.&nbsp; I expect it just hasn't been implemented yet, which means the best way to make sure it isn't forgotten would be to create an issue in the tracker (assuming there isn't one already).

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: newforms-admin: specify model level extra js files (the js admin option)
user name
2007-12-30 17:32:38
On Dec 24, 2007 2:57 AM, Michel Thadeu Sabchuk
<micheltsgmail.com> 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-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newforms-admin: specify model level extra js files (the js admin option)
user name
2008-01-03 08:41:11
Hi!

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

I will take a look on the newforms and modeladmin
documentation. Very
thanks!
Best regards...

Michel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )