本文整理汇总了Python中tastypie.utils.urls.trailing_slash函数的典型用法代码示例。如果您正苦于以下问题:Python trailing_slash函数的具体用法?Python trailing_slash怎么用?Python trailing_slash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trailing_slash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: override_urls
def override_urls(self):
return [
url(r'^(?P<resource_name>{0})/'
'(?P<role_resource_name>{1})/'
'schema{2}$'.format(self._meta.resource_name,
RoleResource._meta.resource_name,
trailing_slash()),
self.wrap_view('get_action_roles_schema'),
name='api_get_action_roles_schema'),
url(r'^(?P<resource_name>{0})/'
'(?P<action_id>\w[\w/-]*)/'
'(?P<role_resource_name>{1}){2}$'.format(self._meta.resource_name,
RoleResource._meta.resource_name,
trailing_slash()),
self.wrap_view('dispatch_list_action_roles'),
name='api_dispatch_list_action_roles'),
url(r'^(?P<resource_name>{0})/'
'(?P<action_id>\w[\w/-]*)/'
'(?P<role_resource_name>{1})/'
'(?P<role_id>\w[\w/-]*){2}$'.format(self._meta.resource_name,
RoleResource._meta.resource_name,
trailing_slash()),
self.wrap_view('dispatch_detail_action_roles'),
name='api_dispatch_detail_action_roles'),
]
开发者ID:socialdevices,项目名称:manager,代码行数:25,代码来源:resources_v3.py
示例2: base_urls
def base_urls(self):
"""
The standard URLs this ``Resource`` should respond to.
"""
# 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<slug_list>[\w\d_-]+)/$" % self._meta.resource_name,
self.wrap_view("get_multiple"),
name="api_get_multiple",
),
url(
r"^(?P<resource_name>%s)/(?P<slug>[\w\d_-]+)%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_detail"),
name="api_dispatch_detail",
),
]
开发者ID:ellissimani,项目名称:panda,代码行数:28,代码来源:utils.py
示例3: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/accumulation-report%s" % (self._meta.resource_name,
trailing_slash()),
self.wrap_view('accumulation_report'), name="accumulation_report"),
url(r"^(?P<resource_name>%s)/product-fitment%s" % (self._meta.resource_name,
trailing_slash()),
self.wrap_view('product_fitment'), name="product_fitment"),
]
开发者ID:ashish-srivastava92,项目名称:GladmindsAshish,代码行数:9,代码来源:loyalty_apis.py
示例4: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/coupons%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_product_coupons'), name="get_product_coupons" ),
url(r"^(?P<resource_name>%s)/(?P<product_id>[\d]+)/recycle%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('mail_products_details'), name="mail_products_details" ),
url(r"^(?P<resource_name>%s)/get-brands%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_brand_details'), name="get_brand_details" ),
url(r"^(?P<resource_name>%s)/accept-product%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('user_product_acceptance'), name="user_product_acceptance" ),
url(r"^(?P<resource_name>%s)/details%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('product_specifications'), name="product_specifications" ),
url(r"^(?P<resource_name>%s)/create%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('add_product'), name="add_product"),
url(r"^(?P<resource_name>%s)/brand-sync%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('brand_sync'), name="brand_sync"),
url(r"^(?P<resource_name>%s)/get-service-details%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_service_details'), name="get_service_details")
]
开发者ID:ashish-srivastava92,项目名称:GladmindsAshish,代码行数:11,代码来源:product_apis.py
示例5: prepend_urls
def prepend_urls(self):
return [
# loading GPX files
url(r"^(?P<resource_name>%s)/load-gpx%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('load_gpx'), name="api_load_gpx"),
# querying for the geojson result
url(r"^(?P<resource_name>%s)/load-gpx/result/(?P<task_id>[\w\d-]+)%s$" %
(self._meta.resource_name, trailing_slash()),
self.wrap_view('get_gpx_result'), name="api_get_geojson")
]
开发者ID:schocco,项目名称:mds-web,代码行数:11,代码来源:api.py
示例6: prepend_urls
def prepend_urls(self):
# TODO: create a custom mapper for schema before others to avoid
# complicated regex
return [
url( (r"^(?P<resource_name>%s)/log/(?P<apilog>\d+)%s$" )
% (self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_smallmolecule_apilog_view'),
name="api_dispatch_smallmolecule_apilog_view"),
url((r"^(?P<resource_name>%s)/(?P<sm_id>((?=(schema))__|(?!(schema))[^/]+))%s$"
) % (self._meta.resource_name, trailing_slash()),
self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:PerlJam,项目名称:1KM,代码行数:12,代码来源:api.py
示例7: override_urls
def override_urls(self):
"""
Add urls for search endpoint.
"""
from panda.api.data import DataResource
data_resource = DataResource(api_name=self._meta.api_name)
return [
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)/(?P<slug>[\w\d_-]+)%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_detail"),
name="api_dispatch_detail",
),
url(
r"^(?P<resource_name>%s)/(?P<slug>[\w\d_-]+)/import/(?P<upload_id>\d+)%s$"
% (self._meta.resource_name, trailing_slash()),
self.wrap_view("import_data"),
name="api_import_data",
),
url(
r"^(?P<resource_name>%s)/(?P<slug>[\w\d_-]+)/export%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("export_data"),
name="api_export_data",
),
url(
r"^(?P<resource_name>%s)/(?P<slug>[\w\d_-]+)/reindex%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("reindex_data"),
name="api_reindex_data",
),
# Nested urls for accessing data
url(
r"^(?P<dataset_resource_name>%s)/(?P<dataset_slug>[\w\d_-]+)/(?P<resource_name>%s)%s$"
% (self._meta.resource_name, data_resource._meta.resource_name, trailing_slash()),
data_resource.wrap_view("dispatch_list"),
name="api_dataset_data_list",
),
url(
r"^(?P<dataset_resource_name>%s)/(?P<dataset_slug>[\w\d_-]+)/(?P<resource_name>%s)/(?P<external_id>[\w\d_-]+)%s$"
% (self._meta.resource_name, data_resource._meta.resource_name, trailing_slash()),
data_resource.wrap_view("dispatch_detail"),
name="api_dataset_data_detail",
),
url(r"^data%s" % trailing_slash(), data_resource.wrap_view("search_all_data"), name="api_data_search"),
]
开发者ID:ellissimani,项目名称:panda,代码行数:50,代码来源:datasets.py
示例8: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/registration/phone%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('user_registration_phone'), name="user_registration_phone"),
url(r"^(?P<resource_name>%s)/registration/email%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('user_registration_email'), name="user_registration_email"),
url(r"^(?P<resource_name>%s)/activate-email%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('activate_email'), name="activate_email"),
url(r"^(?P<resource_name>%s)/phone-number/send-otp%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('sent_otp_user_phone_number'), name="sent_otp_user_phone_number"),
url(r"^(?P<resource_name>%s)/authenticate-email%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('authenticate_user_email_id'), name="authenticate_user_email_id"),
url(r"^(?P<resource_name>%s)/send-otp/forgot-password%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('authenticate_user_send_otp'), name="authenticate_user_send_otp"),
url(r"^(?P<resource_name>%s)/forgot-password/(?P<type>[a-zA-Z0-9.-]+)%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('change_user_password'), name="change_user_password"),
url(r"^(?P<resource_name>%s)/login%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('auth_login'), name="auth_login"),
url(r"^(?P<resource_name>%s)/validate-otp/phone%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('validate_otp_phone'), name="validate_otp_phone"),
url(r"^(?P<resource_name>%s)/validate-otp/email%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('validate_otp_email'), name="validate_otp_email"),
url(r"^(?P<resource_name>%s)/logout%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('logout'), name="logout"),
url(r"^(?P<resource_name>%s)/product-details%s" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_product_details'), name="get_product_details")
]
开发者ID:ashish-srivastava92,项目名称:GladmindsAshish,代码行数:15,代码来源:user_apis.py
示例9: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/count%s" % (self._meta.resource_name,trailing_slash()),
self.wrap_view('get_status_count'), name="get_status_count"),
url(r"^(?P<resource_name>%s)/submit/(?P<id>\d+)%s" % (self._meta.resource_name,trailing_slash()),
self.wrap_view('submit_indent'), name="submit_indent")
]
开发者ID:ashish-srivastava92,项目名称:GladmindsAshish,代码行数:7,代码来源:product_apis.py
示例10: override_urls
def override_urls(self):
"""
Add urls for search endpoint.
"""
return [
url(r'^(?P<resource_name>%s)/search%s$' % (self._meta.resource_name, trailing_slash()), self.wrap_view('search'), name='api_search'),
]
开发者ID:netconstructor,项目名称:panda,代码行数:7,代码来源:api.py
示例11: override_urls
def override_urls(self):
return [
#This is required since /schema can't be differentiated from the detail view.
url(r"^(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
#This will take into account the link_field attribute.
url(r"^(?P<resource_name>%s)/(?P<%s>\w[\w/-]*)%s$" % (self._meta.resource_name, self._lookup_field(), trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:xealot,项目名称:hp3,代码行数:7,代码来源:resources.py
示例12: urls
def urls(self):
"""
Provides URLconf details for the ``Api`` and all registered
``Resources`` beneath it.
"""
from django.conf.urls.defaults import url, include
from tastypie.utils.urls import trailing_slash
from client.views import checkin, checkout, login, logout, register, create_anonymous, delete_anonymous
pattern_list = [
url(r"^(?P<api_name>%s)%s$" % (self.api_name, trailing_slash()), self.wrap_view('top_level'), name="api_%s_top_level" % self.api_name),
]
for name in sorted(self._registry.keys()):
self._registry[name].api_name = self.api_name
pattern_list.append((r"^(?P<api_name>%s)/resources/" % self.api_name, include(self._registry[name].urls)))
## then add the actions
pattern_list.extend([
url(r"^%s/actions/create_anonymous/$" % self.api_name, create_anonymous, name="create_anonymous"),
url(r"^%s/actions/delete_anonymous/$" % self.api_name, delete_anonymous, name="delete_anonymous"),
url(r"^%s/actions/register/$" % self.api_name, register, name="register"),
url(r"^%s/actions/login/$" % self.api_name, login, name="login"),
url(r"^%s/actions/logout/$" % self.api_name, logout, name="logout"),
url(r"^%s/actions/checkin/$" % self.api_name, checkin, name="checkin"),
url(r"^%s/actions/checkout/$" % self.api_name, checkout, name="checkout")
])
urlpatterns = self.prepend_urls()
urlpatterns += patterns('',
*pattern_list
)
return urlpatterns
开发者ID:asorici,项目名称:envived,代码行数:35,代码来源:api.py
示例13: base_urls
def base_urls(self):
"""
The standard URLs this ``Resource`` should respond to.
"""
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)/(?P<%s>.*?)%s$" % (
self._meta.resource_name, self._meta.detail_uri_name,
trailing_slash()), self.wrap_view('dispatch_detail'),
name="api_dispatch_detail"),
]
开发者ID:hmsiccbl,项目名称:lims,代码行数:16,代码来源:api_base.py
示例14: override_urls
def override_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<username>[\@\w\d_.-:]+)/(?P<group_name_id>[\d]+)%s?" % (self._meta.resource_name,trailing_slash()),
self.wrap_view('list_memberships'), name="api_list_memberships"),
url(r"^(?P<resource_name>%s)/(?P<username>[\@\w\d_.-:]+)%s" % (self._meta.resource_name,trailing_slash()),
self.wrap_view('list_memberships'), name="api_list_memberships"),
url(r"^(?P<resource_name>%s)%s" % (self._meta.resource_name,trailing_slash()),
self.wrap_view('list_memberships'), name="api_list_memberships"),
]
开发者ID:leifj,项目名称:coip,代码行数:9,代码来源:people.py
示例15: prepend_urls
def prepend_urls(self):
array = []
array.append(
url(
r"^(?P<resource_name>%s)/project%s" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_project"),
name="api_dispatch_search",
)
)
return array
开发者ID:LittleFancy,项目名称:imaginationforpeople,代码行数:10,代码来源:search.py
示例16: prepend_urls
def prepend_urls(self):
array = []
array.append(
url(
r"^(?P<resource_name>%s)/(?P<language_code>[\w]+)/(?P<slug>[\w\d_.-]+)%s$"
% (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_detail"),
name="api_dispatch_detail",
)
)
array.append(
url(
r"^(?P<resource_name>%s)/bestof%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_bestof"),
name="api_dispatch_bestof",
)
)
array.append(
url(
r"^(?P<resource_name>%s)/latest%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_latest"),
name="api_dispatch_latest",
)
)
array.append(
url(
r"^(?P<resource_name>%s)/random%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_random"),
name="api_dispatch_random",
)
)
array.append(
url(
r"^(?P<resource_name>%s)/by-country/(?P<country_code>[\w]+)%s"
% (self._meta.resource_name, trailing_slash()),
self.wrap_view("dispatch_bycountry"),
name="api_dispatch_bycountry",
)
)
return array
开发者ID:LittleFancy,项目名称:imaginationforpeople,代码行数:40,代码来源:project.py
示例17: base_urls
def base_urls(self):
from django.conf.urls.defaults import url
from tastypie.utils.urls import trailing_slash
"""
The standard URLs this ``Resource`` should respond to.
"""
return [
url(r"^features/(?P<resource_name>%s)%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_list'), name="api_dispatch_list"),
url(r"^features/(?P<resource_name>%s)/schema%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_schema'), name="api_get_schema"),
url(r"^features/(?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"),
url(r"^features/(?P<resource_name>%s)/(?P<%s>\w[\w/-]*)%s$" % (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()), self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:asorici,项目名称:envived,代码行数:13,代码来源:api.py
示例18: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<hash>[a-fA-F0-9]{%d})%s$"
% (self._meta.resource_name, settings.YEARBOOK_HASH_LENGTH, trailing_slash()),
self.wrap_view('dispatch_list'), name="api_dispatch_list"),
url(r"^(?P<resource_name>%s)/(?P<hash>[a-fA-F0-9]{%d})/(?P<%s>\w[\w/-]*)/next/(?P<next_index>[\d]+)%s$"
% (self._meta.resource_name, settings.YEARBOOK_HASH_LENGTH, self._meta.detail_uri_name, trailing_slash()),
self.wrap_view('get_next'), name="api_get_next_photo"),
url(r"^(?P<resource_name>%s)/(?P<hash>[a-fA-F0-9]{%d})/(?P<%s>\w[\w/-]*)/next/(?P<next_index>[\d]+)/(?P<photo_index>[\d]+)%s$"
% (self._meta.resource_name, settings.YEARBOOK_HASH_LENGTH, self._meta.detail_uri_name, trailing_slash()),
self.wrap_view('get_next'), name="api_get_next_photo_number"),
url(r"^(?P<resource_name>%s)/(?P<hash>[a-fA-F0-9]{%d})/(?P<%s>\w[\w/-]*)%s$"
% (self._meta.resource_name, settings.YEARBOOK_HASH_LENGTH, self._meta.detail_uri_name, trailing_slash()),
self.wrap_view('dispatch_detail'), name="api_dispatch_detail"),
]
开发者ID:bcattle,项目名称:monkeybook,代码行数:19,代码来源:ajax.py
示例19: prepend_urls
def prepend_urls(self):
'''
Add our custom endpoints specific to set operations.
'''
return [
url(r"^(?P<resource_name>%s)/(?P<l_set_id>[0-9a-f]{32})/(?P<operation>union)/(?P<r_set_id>[0-9a-f]{32})%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_set_operation'), name="api_dispatch_union"), # @IgnorePep8
url(r"^(?P<resource_name>%s)/(?P<l_set_id>[0-9a-f]{32})/(?P<operation>intersection)/(?P<r_set_id>[0-9a-f]{32})%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_set_operation'), name="api_dispatch_intersection"), # @IgnorePep8
url(r"^(?P<resource_name>%s)/(?P<l_set_id>[0-9a-f]{32})/(?P<operation>difference)/(?P<r_set_id>[0-9a-f]{32})%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_set_operation'), name="api_dispatch_difference"), # @IgnorePep8
url(r"^(?P<resource_name>%s)/(?P<l_set_id>[0-9a-f]{32})/(?P<operation>sdifference)/(?P<r_set_id>[0-9a-f]{32})%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('dispatch_set_operation'), name="api_dispatch_sdifference"), # @IgnorePep8
url(r"^(?P<resource_name>%s)/(?P<%s>[0-9a-f]{32})/(?P<operation>cardinality)%s$" % (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()), self.wrap_view('dispatch_set_operation'), name="api_dispatch_sdifference"), # @IgnorePep8
url(r"^(?P<resource_name>%s)/(?P<%s>[0-9a-f]{32})/(?P<operation>members)%s$" % (self._meta.resource_name, self._meta.detail_uri_name, trailing_slash()), self.wrap_view('dispatch_set_operation'), name="api_dispatch_members"), # @IgnorePep8
]
开发者ID:tanwanirahul,项目名称:rest-on-sets,代码行数:12,代码来源:resources.py
示例20: prepend_urls
def prepend_urls(self):
return [
url(r"^(?P<resource_name>%s)/(?P<code>\S+)/join%s$" % (self._meta.resource_name, trailing_slash(),),
self.wrap_view('join_table'), name="api_join_table"),
url(r"^(?P<resource_name>%s)/(?P<code>\S+)/leave%s$" % (self._meta.resource_name, trailing_slash(),),
self.wrap_view('leave_table'), name="api_join_table"),
]
开发者ID:umutgultepe,项目名称:spoff,代码行数:7,代码来源:api.py
注:本文中的tastypie.utils.urls.trailing_slash函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论