#4718: Add get_admin_url() to Model
-------------------------------+--------------------------------------------
Reporter:  [EMAIL PROTECTED]  |       Owner:  adrian        
  Status:  new                 |   Component:  Core framework
 Version:  SVN                 |    Keywords:                
   Stage:  Unreviewed          |   Has_patch:  0             
-------------------------------+--------------------------------------------
 From a discussion on django-users, I came up with this after contributions
 from two other people, one who originally got the code from elsewhere :
 {{{
     def get_admin_url(self):
         pk = getattr(self, self._meta.pk.attname)
         return ('django.contrib.admin.views.main.change_stage',
                 (self._meta.app_label,
                  self._meta.module_name,
                  pk))
     get_admin_url = models.permalink(get_admin_url)
 }}}
 There's nothing there that couldn't be done in the base Model class, and
 the fact that there were a number of people who'd seen a need for it
 indicates that it should at least be considered for inclusion int he base
 Model class.
 
 On the downside, there's the question of what to do if the pk is None.
 Also, admin is in contrib, which means that it could be omitted, but I
 wouldn't expect people who aren't using the admin to call the new method.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4718>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to