start endpoint with ^
diff --git a/xos/api/service/vbng/debug.py b/xos/api/service/vbng/debug.py
index da22d96..8a7f69e 100644
--- a/xos/api/service/vbng/debug.py
+++ b/xos/api/service/vbng/debug.py
@@ -39,9 +39,9 @@
serializer_class = CordDebugIdSerializer
@classmethod
- def get_urlpatterns(self, api_path=""):
+ def get_urlpatterns(self, api_path="^"):
patterns = []
- patterns.append( url("^" + api_path + "debug/vbng_dump/$", self.as_view({"get": "get_vbng_dump"}), name="vbng_dump"))
+ patterns.append( url(api_path + "debug/vbng_dump/$", self.as_view({"get": "get_vbng_dump"}), name="vbng_dump"))
return patterns
# contact vBNG service and dump current list of mappings
diff --git a/xos/api/tenant/cord/subscriber.py b/xos/api/tenant/cord/subscriber.py
index ac19420..12fc4e9 100644
--- a/xos/api/tenant/cord/subscriber.py
+++ b/xos/api/tenant/cord/subscriber.py
@@ -121,7 +121,7 @@
return subscriber.vcpe
@classmethod
- def get_urlpatterns(self, api_path=""):
+ def get_urlpatterns(self, api_path="^"):
patterns = super(CordSubscriberViewSet, self).get_urlpatterns(api_path=api_path)
patterns.append( self.detail_url("vcpe_synced/$", {"get": "get_vcpe_synced"}, "vcpe_synced") )
patterns.append( self.detail_url("url_filter/$", {"get": "get_url_filter"}, "url_filter") )
diff --git a/xos/api/xosapi_helpers.py b/xos/api/xosapi_helpers.py
index 69156af..98b5a5c 100644
--- a/xos/api/xosapi_helpers.py
+++ b/xos/api/xosapi_helpers.py
@@ -6,6 +6,13 @@
from rest_framework import viewsets
from django.conf.urls import patterns, url
+if hasattr(serializers, "ReadOnlyField"):
+ # rest_framework 3.x
+ ReadOnlyField = serializers.ReadOnlyField
+else:
+ # rest_framework 2.x
+ ReadOnlyField = serializers.Field
+
""" PlusSerializerMixin
Implements Serializer fields that are common to all OpenCloud objects. For
@@ -33,23 +40,23 @@
@classmethod
def detail_url(self, pattern, viewdict, name):
- return url(r'^' + self.api_path + self.method_name + r'/(?P<pk>[a-zA-Z0-9\-]+)/' + pattern,
+ return url(self.api_path + self.method_name + r'/(?P<pk>[a-zA-Z0-9\-]+)/' + pattern,
self.as_view(viewdict),
name=self.base_name+"_"+name)
@classmethod
def list_url(self, pattern, viewdict, name):
- return url(r'^' + self.api_path + self.method_name + r'/' + pattern,
+ return url(self.api_path + self.method_name + r'/' + pattern,
self.as_view(viewdict),
name=self.base_name+"_"+name)
@classmethod
- def get_urlpatterns(self, api_path=""):
+ def get_urlpatterns(self, api_path="^"):
self.api_path = api_path
patterns = []
- patterns.append(url(r'^' + self.api_path + self.method_name + '/$', self.as_view({'get': 'list'}), name=self.base_name+'_list'))
- patterns.append(url(r'^' + self.api_path + self.method_name + '/(?P<pk>[a-zA-Z0-9\-]+)/$', self.as_view({'get': 'retrieve', 'put': 'update', 'post': 'update', 'delete': 'destroy', 'patch': 'partial_update'}), name=self.base_name+'_detail'))
+ patterns.append(url(self.api_path + self.method_name + '/$', self.as_view({'get': 'list'}), name=self.base_name+'_list'))
+ patterns.append(url(self.api_path + self.method_name + '/(?P<pk>[a-zA-Z0-9\-]+)/$', self.as_view({'get': 'retrieve', 'put': 'update', 'post': 'update', 'delete': 'destroy', 'patch': 'partial_update'}), name=self.base_name+'_detail'))
return patterns