Changeset 2059

Show
Ignore:
Timestamp:
06/23/09 11:20:54 (9 months ago)
Author:
JensDiemer
Message:

add a incredible color preview ;)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.9/pylucid_project/apps/pylucid/admin.py

    r2057 r2059  
    5555 
    5656    list_display = ( 
    57         "slug", "site", "get_absolute_url", "description", 
     57        "id", "slug", "site", "get_absolute_url", "description", 
    5858        "lastupdatetime", "lastupdateby" 
    5959    ) 
     
    7373 
    7474class PageMetaAdmin(VersionAdmin): 
    75     list_display = ("title_or_slug", "get_absolute_url", "get_site", "lastupdatetime", "lastupdateby",) 
     75    list_display = ("id", "title_or_slug", "get_absolute_url", "get_site", "lastupdatetime", "lastupdateby",) 
    7676    list_display_links = ("title_or_slug", "get_absolute_url") 
    7777    list_filter = ("lang", "keywords", "createby", "lastupdateby") 
    7878    date_hierarchy = 'lastupdatetime' 
    7979    search_fields = ("description", "keywords") 
     80     
    8081 
    8182admin.site.register(models.PageMeta, PageMetaAdmin) 
    8283 
     84class PageContentInline(admin.StackedInline): 
     85    model = models.PageContent 
    8386 
    8487class PageContentAdmin(VersionAdmin): 
    85     list_display = ("title_or_slug", "get_absolute_url", "get_site", "lastupdatetime", "lastupdateby",) 
     88    list_display = ("id", "title_or_slug", "get_absolute_url", "get_site", "lastupdatetime", "lastupdateby",) 
    8689    list_display_links = ("title_or_slug", "get_absolute_url") 
    8790    list_filter = ("lang", "markup", "createby", "lastupdateby",) 
     
    9497class PluginPageAdmin(VersionAdmin): 
    9598    list_display = ( 
    96         "get_plugin_name", "get_absolute_url", "app_label", "get_site", "lastupdatetime", "lastupdateby", 
     99        "id", "get_plugin_name", "get_absolute_url", "app_label", 
     100        "get_site", "lastupdatetime", "lastupdateby", 
    97101    ) 
    98102    list_display_links = ("get_plugin_name", "app_label") 
     
    113117 
    114118class ColorSchemeAdmin(VersionAdmin):     
    115     list_display = ("name",) 
     119    list_display = ("id", "name", "preview", "lastupdatetime", "lastupdateby") 
    116120    list_display_links = ("name",) 
    117121    search_fields = ("name",) 
    118     inlines = [ 
    119         ColorInline, 
    120     ] 
     122    inlines = [ColorInline,] 
     123     
     124    def preview(self, obj): 
     125        colors = models.Color.objects.all().filter(colorscheme=obj) 
     126        result = "" 
     127        for color in colors: 
     128            result += '<span style="background-color:#%s;" title="%s">&nbsp;&nbsp;&nbsp;</span>' % ( 
     129                color.value, color.name 
     130            ) 
     131        return result 
     132    preview.short_description = 'color preview' 
     133    preview.allow_tags = True 
    121134     
    122135admin.site.register(models.ColorScheme, ColorSchemeAdmin) 
    123136 
    124137 
    125  
    126138class DesignAdmin(VersionAdmin):     
    127     list_display = ("name", "template", "colorscheme", "lastupdatetime", "lastupdateby") 
     139    list_display = ("id", "name", "template", "colorscheme", "lastupdatetime", "lastupdateby") 
    128140    list_display_links = ("name",) 
    129141    list_filter = ("site", "template", "colorscheme", "createby", "lastupdateby") 
     
    134146 
    135147class EditableHtmlHeadFileAdmin(VersionAdmin): 
    136     list_display = ("filepath", "render", "description", "lastupdatetime", "lastupdateby") 
     148    list_display = ("id", "filepath", "render", "description", "lastupdatetime", "lastupdateby") 
    137149    list_display_links = ("filepath", "description") 
    138150    list_filter = ("site","render") 
     
    143155 
    144156class UserProfileAdmin(VersionAdmin): 
    145     list_display = ("user", "site_info", "lastupdatetime", "lastupdateby") 
     157    list_display = ("id", "user", "site_info", "lastupdatetime", "lastupdateby") 
    146158    list_display_links = ("user",) 
    147159    list_filter = ("site",)