This is an automated email from the ASF dual-hosted git repository.

gjm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bloodhound-core.git

commit 31f1b1d58d196cf91d04a794a04f31bb83bb58f2
Author: Gary Martin <g...@apache.org>
AuthorDate: Sun Oct 14 00:23:26 2018 +0000

    Adds a basic ticket view and update api
    
    git-svn-id: 
https://svn.apache.org/repos/asf/bloodhound/branches/bh_core_experimental@1843803
 13f79535-47bb-0310-9956-ffa450edef68
---
 trackers/serializers.py |  5 +++++
 trackers/urls.py        |  3 ++-
 trackers/views.py       | 10 +++++++---
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/trackers/serializers.py b/trackers/serializers.py
index 37c14f6..8d0a8d6 100644
--- a/trackers/serializers.py
+++ b/trackers/serializers.py
@@ -6,3 +6,8 @@ class TicketSerializer(serializers.ModelSerializer):
     class Meta:
         model = Ticket
         fields = '__all__'
+
+class ChangeEventSerializer(serializers.ModelSerializer):
+    class Meta:
+        model = ChangeEvent
+        fields = '__all__'
diff --git a/trackers/urls.py b/trackers/urls.py
index 7537b32..3987dd5 100644
--- a/trackers/urls.py
+++ b/trackers/urls.py
@@ -20,5 +20,6 @@ from . import views
 
 urlpatterns = [
     path('', views.home, name='home'),
-    path('ticket', views.TicketList.as_view()),
+    path('ticket/', views.TicketListCreate.as_view()),
+    path('ticket/<uuid:id>', views.TicketViewUpdate.as_view()),
 ]
diff --git a/trackers/views.py b/trackers/views.py
index 64d3c34..8aa474e 100644
--- a/trackers/views.py
+++ b/trackers/views.py
@@ -18,15 +18,19 @@
 from django.http import HttpResponse
 from django.shortcuts import render
 from rest_framework import generics
+from trackers.serializers import TicketSerializer
+from trackers.models import Ticket
 
 def home(request):
     return HttpResponse('<html><title>Bloodhound Trackers</title></html>')
 
 
-from trackers.serializers import TicketSerializer
-from trackers.models import Ticket
+class TicketListCreate(generics.ListCreateAPIView):
+    queryset = Ticket.objects.all()
+    serializer_class = TicketSerializer
 
 
-class TicketList(generics.ListCreateAPIView):
+class TicketViewUpdate(generics.RetrieveUpdateAPIView):
     queryset = Ticket.objects.all()
     serializer_class = TicketSerializer
+    lookup_field = 'id'

Reply via email to