friends: polish admin ui for friends blogs:
authorYury Yurevich <the.pythy@gmail.com>
Thu Apr 09 23:57:39 2009 +0700 (2 weeks ago)
changeset 139927ce755b3d76
parent 13981d59275d67f5
child 1400c57aa412859d
friends: polish admin ui for friends blogs:
* move not-so-often-used options to separate groups
* collapse groups by default
apps/friends/admin.py
apps/nebula/models.py
       1 --- a/apps/friends/admin.py	Thu Apr 09 23:16:15 2009 +0700
       2 +++ b/apps/friends/admin.py	Thu Apr 09 23:57:39 2009 +0700
       3 @@ -1,10 +1,26 @@
       4 +from django.utils.translation import ugettext_lazy as _
       5  from django.contrib import admin
       6  from lib import libadmin
       7  from friends.models import FriendBlog
       8  
       9  
      10  class FriendBlogAdmin(libadmin.BFAdmin):
      11 +    prepopulated_fields = {'slug': ('name', )}
      12      list_display = ('name', 'feed', 'link', 'active')
      13      search_fields = ('name', 'feed', 'link')
      14 +    exclude = ('etag', 'bad_dates', 'bad_tags', 'target', )
      15 +    fieldsets = (
      16 +        (None, {'fields': ('name', 'slug', 'link', 'feed')}),
      17 +        (_('Extra'), {'classes': ('collapse',), 
      18 +                      'fields': ('active', 'weight',)}),
      19 +        (_('Multiuser/multisite support'), {'classes': ('collapse',),
      20 +                                            'fields': ('author', 'site',)}),        
      21 +        (_('Relations'), {'classes': ('collapse',),
      22 +                          'fields': ('friendship_rel', 'physical_rel', 
      23 +                                     'professional_rel', 'geographical_rel', 
      24 +                                     'family_rel', 'romantic_rel',
      25 +                                     'identity_rel')}),
      26 +                                     
      27 +    )
      28  
      29  admin.site.register(FriendBlog, FriendBlogAdmin)
     1.1 --- a/apps/nebula/models.py	Thu Apr 09 23:16:15 2009 +0700
     1.2 +++ b/apps/nebula/models.py	Thu Apr 09 23:57:39 2009 +0700
     1.3 @@ -13,15 +13,17 @@
     1.4  
     1.5  class AggregatedBlog(models.Model):
     1.6      """A blog or blog-like website run by an individual or corporation"""
     1.7 -    name = models.CharField(_('name'), blank=True, max_length=255)
     1.8 -    slug = models.SlugField(_('slug'), blank=True)
     1.9 -    link = models.URLField(blank=True, verify_exists=False)
    1.10 -    feed  = models.URLField(_('feed'), verify_exists=False, blank=True)
    1.11 -    active = models.BooleanField(_('active'), default=True)
    1.12 +    name = models.CharField(_('name'), blank=True, max_length=255, help_text=_("Name of the blogroll item"))
    1.13 +    slug = models.SlugField(_('slug'), blank=True, help_text=_("Slug, populates automatically from name"))
    1.14 +    link = models.URLField(_('link'), blank=False, verify_exists=False, help_text=_("Link to blog"))
    1.15 +    feed  = models.URLField(_('feed'), verify_exists=False, blank=True, help_text=_("Link to blog's feed, discovered automatically if not filled"))
    1.16 +    active = models.BooleanField(_('active'), default=True, help_text=_("Show item in blogroll"))
    1.17 +    
    1.18      bad_dates = models.BooleanField(_('bad dates'), default=False)
    1.19      bad_tags = models.BooleanField(_('no tags'), default=False)
    1.20      etag = models.CharField(_('etag'), blank=True, max_length=50)
    1.21      target = models.CharField(_('target app'), blank=True, max_length=50)
    1.22 +    
    1.23      site = models.ForeignKey(Site, related_name='nebula')    # multiside byteflow support
    1.24      author = models.ForeignKey(User, related_name='nebula')  # multiuser byteflow support
    1.25