Django

Code

Show
Ignore:
Timestamp:
07/18/08 18:54:34 (4 months ago)
Author:
brosner
Message:

Merged the newforms-admin branch into trunk.

This is a backward incompatible change. The admin contrib app has been
refactored. The newforms module has several improvements including FormSets?
and Media definitions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/redirects/models.py

    r7651 r7967  
    44 
    55class Redirect(models.Model): 
    6     site = models.ForeignKey(Site, radio_admin=models.VERTICAL
     6    site = models.ForeignKey(Site
    77    old_path = models.CharField(_('redirect from'), max_length=200, db_index=True, 
    88        help_text=_("This should be an absolute path, excluding the domain name. Example: '/events/search/'.")) 
     
    1616        unique_together=(('site', 'old_path'),) 
    1717        ordering = ('old_path',) 
     18     
     19    def __unicode__(self): 
     20        return "%s ---> %s" % (self.old_path, self.new_path) 
    1821 
    19     class Admin: 
    20         list_display = ('old_path', 'new_path') 
    21         list_filter = ('site',) 
    22         search_fields = ('old_path', 'new_path') 
     22# Register the admin options for these models. 
     23# TODO: Maybe this should live in a separate module admin.py, but how would we 
     24# ensure that module was loaded? 
    2325 
    24     def __unicode__(self): 
    25         return u"%s ---> %s" % (self.old_path, self.new_path) 
     26from django.contrib import admin 
     27 
     28class RedirectAdmin(admin.ModelAdmin): 
     29    list_display = ('old_path', 'new_path') 
     30    list_filter = ('site',) 
     31    search_fields = ('old_path', 'new_path') 
     32    radio_fields = {'site': admin.VERTICAL} 
     33 
     34admin.site.register(Redirect, RedirectAdmin) 
     35