mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
apply custom action
Change to more accurate word and apply custom action
This commit is contained in:
parent
c0cf29202d
commit
94808d7eb2
|
@ -327,15 +327,14 @@ class SchemaGenerator(object):
|
||||||
if not self.has_view_permissions(path, method, view):
|
if not self.has_view_permissions(path, method, view):
|
||||||
continue
|
continue
|
||||||
link = self.get_link(path, method, view)
|
link = self.get_link(path, method, view)
|
||||||
typical_path = self.make_typical_path(path)
|
overall = self.make_overall(path)
|
||||||
keys = self.get_keys(path, typical_path, method, view)
|
keys = self.get_keys(path, overall, method, view)
|
||||||
insert_into(links, keys, link)
|
insert_into(links, keys, link)
|
||||||
return links
|
return links
|
||||||
|
|
||||||
# Methods used when we generate a view instance from the raw callback...
|
# Methods used when we generate a view instance from the raw callback...
|
||||||
|
|
||||||
|
def make_overall(self, path):
|
||||||
def make_typical_path(self, path):
|
|
||||||
"""
|
"""
|
||||||
Removes '/' from path and returns a linked value using '-'.
|
Removes '/' from path and returns a linked value using '-'.
|
||||||
"""
|
"""
|
||||||
|
@ -343,7 +342,6 @@ class SchemaGenerator(object):
|
||||||
if partial and '{' not in partial ]
|
if partial and '{' not in partial ]
|
||||||
return '-'.join(ret)
|
return '-'.join(ret)
|
||||||
|
|
||||||
|
|
||||||
def create_view(self, callback, method, request=None):
|
def create_view(self, callback, method, request=None):
|
||||||
"""
|
"""
|
||||||
Given a callback, return an actual view instance.
|
Given a callback, return an actual view instance.
|
||||||
|
@ -590,7 +588,7 @@ class SchemaGenerator(object):
|
||||||
|
|
||||||
# Method for generating the link layout....
|
# Method for generating the link layout....
|
||||||
|
|
||||||
def get_keys(self, path, subpath, method, view):
|
def get_keys(self, path, overall, method, view):
|
||||||
"""
|
"""
|
||||||
Return a list of keys that should be used to layout a link within
|
Return a list of keys that should be used to layout a link within
|
||||||
the schema document.
|
the schema document.
|
||||||
|
@ -614,7 +612,7 @@ class SchemaGenerator(object):
|
||||||
|
|
||||||
named_path_components = [
|
named_path_components = [
|
||||||
component for component
|
component for component
|
||||||
in subpath.strip('/').split('/')
|
in overall.strip('/').split('/')
|
||||||
if '{' not in component
|
if '{' not in component
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -626,8 +624,8 @@ class SchemaGenerator(object):
|
||||||
action = self.coerce_method_names[action]
|
action = self.coerce_method_names[action]
|
||||||
return named_path_components + [action]
|
return named_path_components + [action]
|
||||||
else:
|
else:
|
||||||
|
named_path_components = overall.split('-')
|
||||||
return named_path_components[:-1] + [action]
|
return named_path_components[:-1] + [action]
|
||||||
|
|
||||||
if action in self.coerce_method_names:
|
if action in self.coerce_method_names:
|
||||||
action = self.coerce_method_names[action]
|
action = self.coerce_method_names[action]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user