airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [3/4] airavata-django-portal git commit: Namespacing API urls
Date Tue, 19 Sep 2017 18:07:04 GMT
Namespacing API urls


Project: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/commit/e8e0fc44
Tree: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/tree/e8e0fc44
Diff: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/diff/e8e0fc44

Branch: refs/heads/master
Commit: e8e0fc44f4c7764dfb48d3f9a227a2ad7d5898f2
Parents: c975f46
Author: Marcus Christie <machrist@iu.edu>
Authored: Mon Sep 18 10:09:54 2017 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Mon Sep 18 10:09:54 2017 -0400

----------------------------------------------------------------------
 django_airavata/apps/api/serializers.py | 6 +++---
 django_airavata/apps/api/urls.py        | 1 +
 django_airavata/apps/api/views.py       | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/e8e0fc44/django_airavata/apps/api/serializers.py
----------------------------------------------------------------------
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 7f38bf1..12442dd 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -42,13 +42,13 @@ class GatewayIdDefaultField(serializers.CharField):
         self.default = settings.GATEWAY_ID
 
 class ProjectSerializer(serializers.Serializer):
-    url = FullyEncodedHyperlinkedIdentityField(view_name='project-detail', lookup_field='projectID',
lookup_url_kwarg='project_id')
+    url = FullyEncodedHyperlinkedIdentityField(view_name='django_airavata_api:project-detail',
lookup_field='projectID', lookup_url_kwarg='project_id')
     projectID = serializers.CharField(read_only=True)
     name = serializers.CharField(required=True)
     description = serializers.CharField(required=False)
     owner = GatewayUsernameDefaultField()
     gatewayId = GatewayIdDefaultField()
-    experiments = FullyEncodedHyperlinkedIdentityField(view_name='project-experiments', lookup_field='projectID',
lookup_url_kwarg='project_id')
+    experiments = FullyEncodedHyperlinkedIdentityField(view_name='django_airavata_api:project-experiments',
lookup_field='projectID', lookup_url_kwarg='project_id')
 
     def create(self, validated_data):
         return Project(**validated_data)
@@ -65,7 +65,7 @@ class ExperimentSerializer(serializers.Serializer):
 
     experimentId = serializers.CharField(read_only=True)
     projectId = serializers.CharField(required=True)
-    project = FullyEncodedHyperlinkedIdentityField(view_name='project-detail', lookup_field='projectId',
lookup_url_kwarg='project_id')
+    project = FullyEncodedHyperlinkedIdentityField(view_name='django_airavata_api:project-detail',
lookup_field='projectId', lookup_url_kwarg='project_id')
     gatewayId = GatewayIdDefaultField()
     experimentType = serializers.CharField(required=True)
     userName = GatewayUsernameDefaultField()

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/e8e0fc44/django_airavata/apps/api/urls.py
----------------------------------------------------------------------
diff --git a/django_airavata/apps/api/urls.py b/django_airavata/apps/api/urls.py
index 750e677..1c5e19b 100644
--- a/django_airavata/apps/api/urls.py
+++ b/django_airavata/apps/api/urls.py
@@ -12,6 +12,7 @@ logger = logging.getLogger(__name__)
 router = routers.SimpleRouter()
 router.register(r'projects', views.ProjectViewSet, base_name='project')
 
+app_name = 'django_airavata_api'
 urlpatterns = [
     url(r'^$', views.api_root),
     # url(r'^projects/$', views.ProjectList.as_view(), name='api_project_list'),

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/e8e0fc44/django_airavata/apps/api/views.py
----------------------------------------------------------------------
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 1181fa3..416fa5a 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -17,8 +17,8 @@ from django.views.decorators.csrf import csrf_exempt
 @api_view(['GET'])
 def api_root(request, format=None):
     return Response({
-        'projects': reverse('project-list', request=request, format=format),
-        'experiments': reverse('api_experiment_list', request=request, format=format)
+        'projects': reverse('django_airavata_api:project-list', request=request, format=format),
+        'experiments': reverse('django_airavata_api:api_experiment_list', request=request,
format=format)
     })
 
 class GenericAPIBackedViewSet(GenericViewSet):


Mime
View raw message