本文整理汇总了Python中tastypie.utils.trailing_slash函数的典型用法代码示例。如果您正苦于以下问题:Python trailing_slash函数的具体用法?Python trailing_slash怎么用?Python trailing_slash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trailing_slash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: prepend_urls
def prepend_urls(self):
return [
url(r"(?P<resource_name>%s)/post%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('post_article'),name="api_post_article"),
url(r"(?P<resource_name>%s)/comment%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('comment_article'),name="api_comment_article"),
url(r"(?P<resource_name>%s)/like%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('like_article'),name="api_like_article"),
url(r"(?P<resource_name>%s)/list%s$"%(self._meta.resource_name,trailing_slash()),self.wrap_view('list_article'),name="api_list_article"),
]
开发者ID:ojxing,项目名称:Arboad-Pass-Backend,代码行数:7,代码来源:api.py
示例2: base_urls
def base_urls(self):
return [
url(r"^" + self.parent_resource_name + "/(?P<pk>\w[\w-]*)/(?P<resource_name>%s)%s$" %
(self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
url(r"^" + self.parent_resource_name + "/(?P<pk>\w[\w-]*)/(?P<resource_name>%s)\.(?P<format>\w+)%s$" % (
self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
]
开发者ID:chembl,项目名称:chembl_webservices,代码行数:7,代码来源:derivativeResource.py
示例3: base_urls
def base_urls(self):
"""
Same as the original ``base_urls`` but supports using the custom
url_id_attribute instead of the pk of the objects.
"""
# Due to the way Django parses URLs, ``get_multiple``
# won't work without a trailing slash.
return [
url(r"^(?P<resource_name>%s)%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_list'),
name="api_dispatch_list"),
url(r"^(?P<resource_name>%s)/schema%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('get_schema'),
name="api_get_schema"),
url(r"^(?P<resource_name>%s)/set/(?P<%s_list>(%s;?)*)/$" %
(self._meta.resource_name,
self._meta.url_id_attribute,
self.get_url_id_attribute_regex()),
self.wrap_view('get_multiple'),
name="api_get_multiple"),
url(r"^(?P<resource_name>%s)/(?P<%s>%s)%s$" %
(self._meta.resource_name,
self._meta.url_id_attribute,
self.get_url_id_attribute_regex(),
trailing_slash()),
self.wrap_view('dispatch_detail'),
name="api_dispatch_detail"),
]
开发者ID:tadeck,项目名称:django-tastypie-extendedmodelresource,代码行数:30,代码来源:extendedmodelresource.py
示例4: prepend_urls
def prepend_urls(self):
""" Add the following array of urls to the UserResource base urls """
resource_name = self._meta.resource_name
return [
# register
url(r"^(?P<resource_name>%s)/register%s$" %
(resource_name, trailing_slash()),
self.wrap_view('register'), name="api_register"),
# login
url(r"^(?P<resource_name>%s)/login%s$" %
(resource_name, trailing_slash()),
self.wrap_view('login'), name="api_login"),
# logout
url(r'^(?P<resource_name>%s)/logout%s$' %
(resource_name, trailing_slash()),
self.wrap_view('logout'), name='api_logout'),
# is_authenticated
url(r'^(?P<resource_name>%s)/is_authenticated%s$' %
(resource_name, trailing_slash()),
self.wrap_view('authenticated'), name='api_authenticated'),
# recover password
url(r'^(?P<resource_name>%s)/recover_password%s$' %
(resource_name, trailing_slash()),
self.wrap_view('recover_password'),
name='api_recover_password'),
]
开发者ID:magnet-cl,项目名称:django-tastypie-project-template,代码行数:26,代码来源:resources.py
示例5: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/signin%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('signin'), name='signin_api'),
url(r"^(?P<resource_name>%s)/signout%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('signout'), name='signout_api'),
]
开发者ID:zouyapeng,项目名称:Review,代码行数:7,代码来源:resource.py
示例6: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/set-current%s$" % (
self._meta.resource_name, trailing_slash()), self.wrap_view('set_current'),
name="playlist_api_set_current"),
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/reorder%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('reorder'), name="playlist_api_reorder"),
# collecting
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/collect%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('collect_specific'), name="playlist_api_collect_specific"),
url(r"^(?P<resource_name>%s)/collect%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('collect'), name="playlist_api_collect"),
# services & hooks
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/mixdown-complete%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('mixdown_complete'), name="alibrary-playlist_api-mixdown_complete"),
# # autocomplete
# url(r"^(?P<resource_name>%s)/autocomplete%s$" % (self._meta.resource_name, trailing_slash()),
# self.wrap_view('autocomplete'), name="alibrary-playlist_api-autocomplete"),
#
# # legacy
# url(r"^(?P<resource_name>%s)/autocomplete-name%s$" % (self._meta.resource_name, trailing_slash()),
# self.wrap_view('autocomplete'), name="alibrary-playlist_api-autocomplete"),
]
开发者ID:hzlf,项目名称:openbroadcast.org,代码行数:25,代码来源:playlistapi.py
示例7: prepend_urls
def prepend_urls(self):
"""
1) + 2)
Allow login and logout via the API
cf. http://stackoverflow.com/questions/11770501/how-can-i-login-to-django-using-tastypie
3)
Allow negative primary key when requesting individual user
(Django Guardian has the convention that there exists an AnonymousUser with id=-1)
cf https://github.com/toastdriven/django-tastypie/pull/395/files
"""
return [
url(r"^(?P<resource_name>%s)/login%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('login'), name="api_login"),
url(r'^(?P<resource_name>%s)/logout%s$' %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('logout'), name='api_logout'),
url(r"^(?P<resource_name>%s)/(?P<pk>-?\w[\w/-]*)%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_detail'), name="api_dispatch_detail")
]
开发者ID:osp,项目名称:osp.work.oralsite.www,代码行数:25,代码来源:api.py
示例8: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/login%s$" %(self._meta.resource_name, trailing_slash()),self.wrap_view('login'), name="api_login"),
url(r'^(?P<resource_name>%s)/logout%s$' %(self._meta.resource_name, trailing_slash()),self.wrap_view('logout'), name='api_logout'),
url(r'^(?P<resource_name>%s)/register%s$' %(self._meta.resource_name, trailing_slash()),self.wrap_view('register'), name='api_register'),
url(r'^(?P<resource_name>%s)/save_settings%s$' %(self._meta.resource_name, trailing_slash()),self.wrap_view('save_settings'), name='api_save_settings'),
]
开发者ID:MrHaves,项目名称:kicknews,代码行数:7,代码来源:api.py
示例9: prepend_urls
def prepend_urls(self):
return [
url(r'^(?P<resource_name>%s)/addfavr%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('addFavR'), name = 'addFavR'),
url(r'^(?P<resource_name>%s)/addfavu%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('addFavU'), name = 'addFavU'),
url(r'^(?P<resource_name>%s)/removefavr%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('removeFavR'), name = 'removeFavR'),
url(r'^(?P<resource_name>%s)/removefavu%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('removeFavU'), name = 'removeFavU'),
]
开发者ID:battousai8728,项目名称:PCAT_final,代码行数:7,代码来源:resources.py
示例10: base_urls
def base_urls(self):
return [
url(r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
url(r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
url(r"^(?P<resource_name>%s)/set/(?P<pk_list>\w[\w;-]*)/$" % self._meta.resource_name, self.wrap_view('get_multiple'), name="api_get_multiple"),
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w-]*)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:Concert,项目名称:Concert,代码行数:7,代码来源:api.py
示例11: actionurls
def actionurls(self):
urls = []
for name, method in self.__class__.__dict__.iteritems():
if hasattr(method, "is_auto_action"):
actionName = name if not hasattr(method, "auto_action_name") \
else method.auto_action_name
if hasattr(method, "auto_action_url"):
urls.append(
url(method.auto_action_url,
self.wrap_view(name),
name="api_action_%s" % actionName)
)
else:
if not method.auto_action_static:
urls.append(
url(r"^(?P<resource_name>%s)/(?P<%s>[A-Za-z0-9]+)/%s%s$" % (
self._meta.resource_name,
self._meta.detail_uri_name,
actionName,
trailing_slash()),
self.wrap_view(name),
name="api_action_static_%s" % actionName)
)
else:
urls.append(
url(r"^(?P<resource_name>%s)/%s%s$" % (
self._meta.resource_name,
actionName,
trailing_slash()),
self.wrap_view(name),
name="api_action_%s" % actionName)
)
return urls
开发者ID:kitanata,项目名称:SpeakerMotion2,代码行数:35,代码来源:tastypie.py
示例12: base_urls
def base_urls(self):
return [
url(r"^(?P<website_togo>\w+)%s$" % (trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
url(r"^(?P<website_togo>\w+)/schema%s$" % (trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
url(r"^(?P<website_togo>\w+)/set/(?P<pk_list>\w[\w/;-]*)/$", self.wrap_view('get_multiple'), name="api_get_multiple"),
url(r"^(?P<website_togo>\w+)/(?P<pk>\w[\w/-]*)%s$" % (trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:sergeiest,项目名称:clicktree_general_api,代码行数:7,代码来源:api.py
示例13: base_urls
def base_urls(self):
return [
url(
r"^(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_list"),
name="api_dispatch_list",
),
url(
r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("get_schema"),
name="api_get_schema",
),
url(
r"^(?P<resource_name>%s)/set/(?P<%s_list>\w[\w/;-]*)%s$"
% (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()),
self.wrap_view("get_multiple"),
name="api_get_multiple",
),
# Our lookup field.
# Slugs can't start with the _ character or contain a
# slash surrounded by the _ character. We do this so we can
# define URLs for sub-resources more easily.
url(
r"^(?P<resource_name>%s)/(?P<%s>[^_]((?!(/_)|(_/)).)*?)%s$"
% (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()),
self.wrap_view("dispatch_detail"),
name="api_dispatch_detail",
),
]
开发者ID:pvl,项目名称:localwiki,代码行数:29,代码来源:api.py
示例14: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<pk>[0-9]+)%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
url(r"^(?P<resource_name>%s)/autocomplete%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('autocomplete'), name="api_tag_autocomplete"),
url(r"^(?P<resource_name>%s)/trending%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('get_trending'), name="api_tag_trending"),
url(r"^(?P<resource_name>%s)/nearby%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('get_nearby'), name="api_tag_nearby"),
url(r"^(?P<resource_name>%s)/by_name/(?P<tag>[\w\d]+)%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:datea,项目名称:datea-api,代码行数:25,代码来源:resources.py
示例15: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/jobs%s$" % (self._meta.resource_name,
trailing_slash()), self.wrap_view('jobs'), name="jobs"),
url(r"^(?P<resource_name>%s)/crawl%s$" % (self._meta.resource_name,
trailing_slash()), self.wrap_view('crawl'), name="crawl"),
]
开发者ID:saymedia,项目名称:seosuite-dashboard-api,代码行数:7,代码来源:__init__.py
示例16: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/schedule%s$" % (
self._meta.resource_name,
trailing_slash()),
self.wrap_view('get_schedule'),
name="playlist_api_schedule"),
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/history%s$" % (
self._meta.resource_name,
trailing_slash()),
self.wrap_view('get_history'),
name="playlist_api_history"),
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/on-air%s$" % (
self._meta.resource_name,
trailing_slash()),
self.wrap_view('get_now_playing'),
name="playlist_api_on_air"),
url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/program%s$" % (
self._meta.resource_name,
trailing_slash()),
self.wrap_view('get_program'),
name="channel_api_program"),
]
开发者ID:hzlf,项目名称:openbroadcast.org,代码行数:28,代码来源:baseapi.py
示例17: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/login%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('user_login'), name="api_login"),
url(r"^(?P<resource_name>%s)/change_password%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('change_password'), name="api_change_password"),
url(r"^(?P<resource_name>%s)/update_password%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('update_password'), name="api_update_password"),
url(r"^(?P<resource_name>%s)/forgot_password%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('forgot_password'), name="api_forgot_password"),
url(r"^(?P<resource_name>%s)/new%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('new_user'), name="api_new_user"),
url(r"^(?P<resource_name>%s)/update%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('update_user'), name="api_update_user"),
url(r"^(?P<resource_name>%s)/edit%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('edit_user'), name="api_edit_user"),
url(r"^user/logout/$", self.wrap_view('logout'), name='api_logout'),
url(r"^(?P<resource_name>%s)/view%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('get_cards'), name="api_get_cards"),
url(r"^(?P<resource_name>%s)/add_cards%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('add_cards'), name="add_cards"),
url(r"^(?P<resource_name>%s)/balance%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('balance'), name="add_cards"),
]
开发者ID:Gift2Redeem,项目名称:g2rver2,代码行数:35,代码来源:user_resource.py
示例18: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/login%s$" %(self._meta.resource_name,
trailing_slash()), self.wrap_view('login'), name="api_login"),
url(r"^(?P<resource_name>%s)/logout%s$" %(self._meta.resource_name,
trailing_slash()), self.wrap_view('logout'), name='api_logout'),
]
开发者ID:spoonman1982,项目名称:nexus-moble_backend,代码行数:7,代码来源:api.py
示例19: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<asset_id>[0-9a-f]{32,32})%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_detail'),
name="api_dispatch_detail"),
url(r"^(?P<resource_name>%s)/stories/(?P<story_id>[0-9a-f]{32,32})%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_list'),
name="api_dispatch_list"),
url(r"^(?P<resource_name>%s)/stories/(?P<story_id>[0-9a-f]{32,32})/featured%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_featured_list'),
kwargs={'featured': True},
name="api_dispatch_featured_list"),
url(r"^(?P<resource_name>%s)/stories/(?P<story_id>[0-9a-f]{32,32})/sections/none%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_list'),
kwargs={'no_section': True},
name="api_dispatch_list"),
url(r"^(?P<resource_name>%s)/sections/(?P<section_id>[0-9a-f]{32,32})%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_list'),
name="api_dispatch_list"),
]
开发者ID:patternleaf,项目名称:atlas,代码行数:25,代码来源:api.py
示例20: prepend_urls
def prepend_urls(self):
return [url(r"^(?P<resource_name>%s)/settings%s$"
% (self._meta.resource_name, trailing_slash()),
self.wrap_view('user_settings'), name="api_user_settings"),
url(r"^(?P<resource_name>%s)/find%s$"
% (self._meta.resource_name, trailing_slash()),
self.wrap_view('user_find'), name="api_user_find")
]
开发者ID:bramgeenen,项目名称:wevolver-server,代码行数:8,代码来源:api.py
注:本文中的tastypie.utils.trailing_slash函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论