MCPcopy
hub / github.com/django/django / get_urls

Method get_urls

tests/admin_custom_urls/models.py:33–50  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

31 return [url for url in super().get_urls() if url.name != name]
32
33 def get_urls(self):
34 # Add the URL of our custom 'add_view' view to the front of the URLs
35 # list. Remove the existing one(s) first
36 from django.urls import re_path
37
38 def wrap(view):
39 def wrapper(*args, **kwargs):
40 return self.admin_site.admin_view(view)(*args, **kwargs)
41
42 return update_wrapper(wrapper, view)
43
44 info = self.opts.app_label, self.opts.model_name
45
46 view_name = "%s_%s_add" % info
47
48 return [
49 re_path("^!add/$", wrap(self.add_view), name=view_name),
50 ] + self.remove_url(view_name)
51
52
53class Person(models.Model):

Callers 1

remove_urlMethod · 0.45

Calls 2

remove_urlMethod · 0.95
wrapFunction · 0.85

Tested by

no test coverage detected