Returns the URL for the given model and admin url name.
832
def admin_url(model, url, object_id=None):
    
    opts = model._meta
    url = "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)
1142179
def get_urls(self):
        """"""
        urls = super(SimpleHistoryAdmin, self).get_urls()
        admin_site = self.admin_site
        opts = self.model._meta
        info = opts.app_label, opts.model_name
        history_urls = [
            url(
                "^([^/]+)/history/([^/]+)/$",
                admin_site.admin_view(self.history_form_view),
                name="%s_%s_simple_history" % info,
            )
        ]
        return history_urls + urls
729415
def admin_view_fk_link(modeladmin: ModelAdmin,
                       obj,
                       fkfield: str,
                       missing: str = "(None)",
                       use_str: bool = True,
                       view_type: str = "change",
                       current_app: str = None) -> str:
    
    if not hasattr(obj, fkfield):
        return missing
    linked_obj = getattr(obj, fkfield)
    app_name = linked_obj._meta.app_label.lower()
    model_name = linked_obj._meta.object_name.lower()
    viewname = "admin:{}_{}_{}".format(app_name, model_name, view_type)
    # https://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls  # noqa
    if current_app is None:
        current_app = modeladmin.admin_site.name
        # ... plus a bit of home-grown magic; see Django source
    url = reverse(viewname, args=[linked_obj.pk], current_app=current_app)
    if use_str:
        label = escape(str(linked_obj))
    else:
        label = "{} {}".format(escape(linked_obj._meta.object_name),
                               linked_obj.pk)
    return '<a href="{}">{}</a>'.format(url, label)
1092160
private function getUrl($value, $model)
    {
        if(isset($value['id']) && $value['id']) {
            $routeParam = isset($value['model'])
                ? [ 'id' => $value['id'], $value['model'] => $model->id]
                : ['id' => $model->id];
            return lmbRoute($value['route'], $routeParam);
        }

        return lmbRoute($value['route']);
    }
374131
def get_admin_urls_for_registration(self):
        
        urls = []
        for instance in self.modeladmin_instances:
            urls.extend(instance.get_admin_urls_for_registration())
        return urls
332515
def get_object(self, name, *argv, **kwargs):
        
        regexp = name
        options = self.opts(regexp)
        options.update(kwargs)
        args = options.pop('view_args', argv)
        csrf_enable = self.get_backend_data(regexp).get('CSRF_ENABLE', True)
        if regexp in self.settings_urls:
            regexp = r'^{}'.format(self.get_django_settings(regexp)[1:])
        view = self[name].as_view()
        if not csrf_enable:
            view = csrf_exempt(view)
        return url(regexp, view, *args, **options)
1217521
def get_urls(self):
        
        urls = super(AccountAdmin, self).get_urls()
        from django.conf.urls import url

        def wrap(view):
            def wrapper(*args, **kwargs):
                return self.admin_site.admin_view(view)(*args, **kwargs)
            return update_wrapper(wrapper, view)

        info = self.opts.app_label, self.opts.model_name

        extra_urls = [
            url(r'^login/(?P<provider>(\w|-)+)/$',
                wrap(OAuthRedirect.as_view()), name='%s_%s_login' % info),
            url(r'^callback/(?P<provider>(\w|-)+)/$',
                wrap(OAuthCallback.as_view()), name='%s_%s_callback' % info),
            url(r'^(.+)/json/$', wrap(self.json_view), name='%s_%s_json' % info),
        ]
        return extra_urls + urls
61638
def get_urls(self):
        
        urls = [
            url(r'^publish/([0-9]+)/$', self.admin_site.admin_view(self.publish_post),
                name='djangocms_blog_publish_article'),
        ]
        urls.extend(super(PostAdmin, self).get_urls())
        return urls
603888
def get_obj_url(request, obj):
    
    if (is_callable(getattr(obj, 'get_absolute_url', None)) and
            (not hasattr(obj, 'can_see_edit_link') or
             (is_callable(getattr(obj, 'can_see_edit_link', None)) and obj.can_see_edit_link(request)))):
        return call_method_with_unknown_input(obj.get_absolute_url, request=request)
    else:
        return get_url_from_model_core(request, obj)
890125
def admin_url(inst):
    
    if inst:
        t = Template("""{% load admin_urls %}{% url opts|admin_urlname:'change' inst.pk %}""")
        return t.render(Context({ 'inst': inst, 'opts': inst._meta}))
    return ""
466676
def get_checks_admin_reliability_warning_url(self):
        
        # TODO: cache this.
        path = self.get_checks_admin_url()
        content_type = ContentType.objects.get_for_model(self)
        params = "?content_type__id__exact={0}&q={1}&success__exact=0".format(
            content_type.id,
            self.id
        )
        url = path + params
        return url
955705
def get_admin_url(self, query_params=None, use_path=False):
        """"""

        if not query_params:
            query_params = {}

        url = ''
        if self.is_top_node():
            url = reverse('admin:media_tree_filenode_changelist');
        elif use_path and (self.is_folder() or self.pk):
            url = reverse('admin:media_tree_filenode_open_path', args=(self.get_path(),));
        elif self.is_folder():
            url = reverse('admin:media_tree_filenode_changelist');
            query_params['folder_id'] = self.pk
        elif self.pk:
            return reverse('admin:media_tree_filenode_change', args=(self.pk,));

        if len(query_params):
            params = ['%s=%s' % (key, value) for key, value in query_params.items()]
            url = '%s?%s' % (url, "&".join(params))

        return url
1222438
def get_field_model(name, model=None):
    
    if '.' in name:
        m, name = name.split('.')
        model = get_model(m)

    if model:
        return getattr(model, name, None), model
    else:
        return None, None
104900
def crud_for_model(model, urlprefix=None):
    
    model_lower = model.__name__.lower()

    if urlprefix is None:
        urlprefix = ''
    urlprefix += model_lower + '/'

    urls = crud_urls(
        model,
        list_view=CRUDListView.as_view(model=model),
        create_view=CRUDCreateView.as_view(model=model),
        detail_view=CRUDDetailView.as_view(model=model),
        update_view=CRUDUpdateView.as_view(model=model),
        delete_view=CRUDDeleteView.as_view(model=model),
        url_prefix=urlprefix,
    )
    return urls
710785
def get_url(route_name, id = nil, engine = Rails.application)
      return route_name.call if id.nil?
      return route_name.call(id) unless id.nil?
    end
1274956
def get_url(self, obj, view_name, request, format):
        
        # Unsaved objects will not yet have a valid URL.
        if hasattr(obj, 'pk') and obj.pk is None:
            return None

        lookup_value = getattr(obj, self.lookup_field)
        kwargs = {self.lookup_url_kwarg: lookup_value}
        return self.reverse(view_name, kwargs=kwargs, request=request, format=format)
669133
def get_model_url_base():
    '''
    
    '''
    url_base = get_model_url_base_from_env()
    if url_base is not None:
        logger.info('NNBLA_MODELS_URL_BASE is set as {}.'.format(url_base))
    else:
        url_base = 'https://nnabla.org/pretrained-models/nnp_models/'
    return url_base