Skip to content
Permalink
Browse files
Add djangorestframework and register admin pages
  • Loading branch information
Gary Martin committed Oct 14, 2018
1 parent 367f219 commit d3dc9d90cd70508e7c6898ae69b572a04aab47ef
Showing 7 changed files with 85 additions and 49 deletions.
@@ -10,6 +10,7 @@ PyYAML = "*"

[packages]
django = ">=2.0.0"
djangorestframework = "*"

[requires]
python_version = "3.6"

Some generated files are not rendered by default. Learn more.

@@ -36,5 +36,5 @@

urlpatterns = [
path('', include('trackers.urls')),
# path('admin/', admin.site.urls),
path('admin/', admin.site.urls),
]
@@ -19,3 +19,7 @@
from django.contrib import admin

# Register your models here.
from trackers.models import Ticket, ChangeEvent

admin.site.register(Ticket)
admin.site.register(ChangeEvent)
@@ -32,6 +32,8 @@ class Meta:
abstract = True

class Ticket(ModelCommon):
title = models.CharField(max_length=200, null=True)
description = models.TextField(null=True)

def last_update(self):
last_event = self.changeevent_set.order_by('created').last()
@@ -0,0 +1,8 @@
from rest_framework import serializers
from trackers.models import Ticket


class TicketSerializer(serializers.ModelSerializer):
class Meta:
model = Ticket
fields = '__all__'
@@ -17,6 +17,16 @@

from django.http import HttpResponse
from django.shortcuts import render
from rest_framework import generics

def home(request):
return HttpResponse('<html><title>Bloodhound Trackers</title></html>')


from trackers.serializers import TicketSerializer
from trackers.models import Ticket


class PlanetList(generics.ListCreateAPIView):
queryset = Ticket.objects.all()
serializer_class = TicketSerializer

0 comments on commit d3dc9d9

Please sign in to comment.