Django

Code

Changeset 7873

Show
Ignore:
Timestamp:
07/09/08 13:09:38 (2 months ago)
Author:
brosner
Message:

newforms-admin: Added some documentation about media defintions in ModelAdmin? classes. Fixed #7129.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin/docs/admin.txt

    r7872 r7873  
    482482    an index. Currently this is only available for MySQL. 
    483483 
     484``ModelAdmin`` media definitions 
     485-------------------------------- 
     486 
     487There are times where you would like add a bit of CSS and/or Javascript to 
     488the add/change views. This can be accomplished by using a Media inner class 
     489on your ``ModelAdmin``:: 
     490 
     491    class ArticleAdmin(admin.ModelAdmin): 
     492        class Media: 
     493            css = { 
     494                "all": ("my_styles.css",) 
     495            } 
     496            js = ("my_code.js",) 
     497 
     498Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules 
     499apply as `regular media definitions on forms`_. 
     500 
     501.. _regular media definitions on forms: ../newforms/#media 
     502 
    484503``InlineModelAdmin`` objects 
    485504============================