def admin_url(model, url, object_id=None):
 opts = model._meta
 url = (u'admin:%s_%s_%s' % (opts.app_label, opts.object_name.lower(), url))
 args = ()
 if (object_id is not None):
  args = (object_id,)
 return reverse(url, args=args)

def admin_url ( model , url , object_id = None ) : opts = model . _meta url = ( u'admin:%s_%s_%s' % ( opts . app_label , opts . object_name . lower ( ) , url ) ) args = ( ) if ( object_id is not None ) : args = ( object_id , ) return reverse ( url , args = args )
returns the url for the given model and admin url name .