css includes in class Admin like js = ()

1 view
Skip to first unread message

Bas van Oostveen

unread,
Feb 27, 2007, 7:09:39 PM2/27/07
to django-d...@googlegroups.com
Hi Guys,

In semi-response to wonderfull things like Upcoming changes to the Django admin :)
How about having something similar as the js tuple for css styles ?

A usecase could be the admin fields for a model, there u can declare something like:

fields = (
            (None, {
                'fields': ('name',),
            }),
            ("Slot 1", {
                'description': 'Slot 1 Content',
                'classes': 'wide extrapretty imgfoo',
                'fields': ('foo','bar',),
            }),
            ("Slot 2", {
                'description': 'Slot 2 Content',
                'classes': 'wide extrapretty imgbacon',
                'fields': ('bacon','spam','eggs',),
            }),
)

As with js u can add some javascript to fields of your choosing, an added option
css would let u add a file with the 2 extra .imgfoo {} and .imgbacon {} css classes.

But maybe also other things like adding a border or different bg color to that one
special field in your model :-)

respect and regards,
Bas

James Bennett

unread,
Mar 1, 2007, 11:58:10 PM3/1/07
to django-d...@googlegroups.com
On 2/27/07, Bas van Oostveen <v.oos...@gmail.com> wrote:
> As with js u can add some javascript to fields of your choosing, an added
> option
> css would let u add a file with the 2 extra .imgfoo {} and .imgbacon {} css
> classes.

I think one of the goals of the admin reworking is that it'll be easy
for people to write subclasses of the base model admin and admin site
which implement whatever they want; this will cut down significantly
on the need for explicit support in the base classes.

--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Reply all
Reply to author
Forward
0 new messages