Discussion:
svn commit: r1843805 - in /bloodhound/branches/bh_core_experimental/trackers: models.py serializers.py urls.py
Gary Martin
2018-10-14 15:44:12 UTC
Permalink
Hi everyone,

Last night I merged code that was worked on last month from the pyconuk sprints culminating in this commit. The significant changes from this were:

* adding django-rest-framework [1]
* adding django rest swagger [2]
* activation and registering the Ticket and ChangeEvent models with the admin site
* adding a new set of views:
* schema_view/ (the view of the api generated by swagger)
* field/ (a view to list and create ticket fields)
* ticket/ (a view to list and create tickets)
* ticket/<uuid:id> (a view of a specific ticket)
* ticket/<uuid:id>/event/ (a view to show ticket change events for a given ticket)

Cheers,
Gary

[1] https://www.django-rest-framework.org/
[2] https://django-rest-swagger.readthedocs.io/
Author: gjm
Date: Sun Oct 14 00:23:31 2018
New Revision: 1843805
URL: http://svn.apache.org/viewvc?rev=1843805&view=rev
Attempt to add links to api output for ticket list
bloodhound/branches/bh_core_experimental/trackers/models.py
bloodhound/branches/bh_core_experimental/trackers/serializers.py
bloodhound/branches/bh_core_experimental/trackers/urls.py
Modified: bloodhound/branches/bh_core_experimental/trackers/models.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/models.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/models.py
(original)
+++ bloodhound/branches/bh_core_experimental/trackers/models.py Sun Oct
14 00:23:31 2018
@@ -21,6 +21,7 @@ import logging
import uuid
from django.db import models
+from django.urls import reverse
logger = logging.getLogger(__name__)
title = models.CharField(max_length=200, null=True)
description = models.TextField(null=True)
+ return reverse('ticket_view', args=(self.id,))
+
last_event = self.changeevent_set.order_by('created').last()
return self.created if last_event is None else last_event.created
Modified: bloodhound/branches/bh_core_experimental/trackers/
serializers.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/serializers.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/serializers.py
(original)
+++ bloodhound/branches/bh_core_experimental/trackers/serializers.py Sun
Oct 14 00:23:31 2018
@@ -1,20 +1,25 @@
from rest_framework import serializers
-from trackers.models import Ticket, TicketField, ChangeEvent
+from trackers import models
+ api_url = serializers.SerializerMethodField()
+
- model = Ticket
+ model = models.Ticket
fields = '__all__'
+ return self.context['request'].build_absolute_uri(obj.api_url())
+
- model = TicketField
+ model = models.TicketField
fields = '__all__'
- model = ChangeEvent
+ model = models.ChangeEvent
fields = '__all__'
Modified: bloodhound/branches/bh_core_experimental/trackers/urls.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/urls.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/urls.py (original)
+++ bloodhound/branches/bh_core_experimental/trackers/urls.py Sun Oct 14
00:23:31 2018
@@ -23,6 +23,6 @@ urlpatterns = [
path('schema_view/', views.schema_view),
path('field/', views.TicketFieldListCreate.as_view()),
path('ticket/', views.TicketListCreate.as_view()),
- path('ticket/<uuid:id>', views.TicketViewUpdate.as_view()),
+ path('ticket/<uuid:id>', views.TicketViewUpdate.as_view(),
name='ticket_view'),
path('ticket/<uuid:id>/event/',
views.ChangeEventListCreate.as_view()),
]
Dammina Sahabandu
2018-10-14 17:01:46 UTC
Permalink
Hi Gary,

This is significant development on the new BH version. I will get these
updates now and play around with the new framework. And I believe as you
have suggested in an earlier thread it will be a great idea to get some
coders together to do some work to this up quickly, may be we can arrange
an unofficial/official hackathon over a weekend or in a certain time window
where most of our contributors are free to join.

And in the meantime I really appreciate the work you have done and I will
start contributing to the git branch.

Thanks,
Dammina
Post by Gary Martin
Hi everyone,
Last night I merged code that was worked on last month from the pyconuk
* adding django-rest-framework [1]
* adding django rest swagger [2]
* activation and registering the Ticket and ChangeEvent models with the admin site
* schema_view/ (the view of the api generated by swagger)
* field/ (a view to list and create ticket fields)
* ticket/ (a view to list and create tickets)
* ticket/<uuid:id> (a view of a specific ticket)
* ticket/<uuid:id>/event/ (a view to show ticket change events for a given ticket)
Cheers,
Gary
[1] https://www.django-rest-framework.org/
[2] https://django-rest-swagger.readthedocs.io/
Author: gjm
Date: Sun Oct 14 00:23:31 2018
New Revision: 1843805
URL: http://svn.apache.org/viewvc?rev=1843805&view=rev
Attempt to add links to api output for ticket list
bloodhound/branches/bh_core_experimental/trackers/models.py
bloodhound/branches/bh_core_experimental/trackers/serializers.py
bloodhound/branches/bh_core_experimental/trackers/urls.py
Modified: bloodhound/branches/bh_core_experimental/trackers/models.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/models.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/models.py
(original)
+++ bloodhound/branches/bh_core_experimental/trackers/models.py Sun Oct
14 00:23:31 2018
@@ -21,6 +21,7 @@ import logging
import uuid
from django.db import models
+from django.urls import reverse
logger = logging.getLogger(__name__)
title = models.CharField(max_length=200, null=True)
description = models.TextField(null=True)
+ return reverse('ticket_view', args=(self.id,))
+
last_event = self.changeevent_set.order_by('created').last()
return self.created if last_event is None else
last_event.created
Modified: bloodhound/branches/bh_core_experimental/trackers/
serializers.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/serializers.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/serializers.py
(original)
+++ bloodhound/branches/bh_core_experimental/trackers/serializers.py Sun
Oct 14 00:23:31 2018
@@ -1,20 +1,25 @@
from rest_framework import serializers
-from trackers.models import Ticket, TicketField, ChangeEvent
+from trackers import models
+ api_url = serializers.SerializerMethodField()
+
- model = Ticket
+ model = models.Ticket
fields = '__all__'
+ return self.context['request'].build_absolute_uri(obj.api_url())
+
- model = TicketField
+ model = models.TicketField
fields = '__all__'
- model = ChangeEvent
+ model = models.ChangeEvent
fields = '__all__'
Modified: bloodhound/branches/bh_core_experimental/trackers/urls.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/urls.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/urls.py (original)
+++ bloodhound/branches/bh_core_experimental/trackers/urls.py Sun Oct 14
00:23:31 2018
@@ -23,6 +23,6 @@ urlpatterns = [
path('schema_view/', views.schema_view),
path('field/', views.TicketFieldListCreate.as_view()),
path('ticket/', views.TicketListCreate.as_view()),
- path('ticket/<uuid:id>', views.TicketViewUpdate.as_view()),
+ path('ticket/<uuid:id>', views.TicketViewUpdate.as_view(),
name='ticket_view'),
path('ticket/<uuid:id>/event/',
views.ChangeEventListCreate.as_view()),
]
--
Dammina Sahabandu
PMC & Committer, Apache Software Foundation
AMIE (SL)
Bsc Eng Hons (Moratuwa)
+65 881 129 81
Gary Martin
2018-10-14 17:39:57 UTC
Permalink
Hi Dammina,

I suppose you must be talking about the sprint I was talking about at pyconuk this year. But yeah, it is a nice idea to get at least some of us together to do some more sprints. There is probably still a need to discuss ideas and plans to start with but progress with the code should also be possible. Perhaps we could also look at making this a regular event!

Thanks for suggesting this :)

Cheers,
Gary
Post by Dammina Sahabandu
Hi Gary,
This is significant development on the new BH version. I will get these
updates now and play around with the new framework. And I believe as you
have suggested in an earlier thread it will be a great idea to get some
coders together to do some work to this up quickly, may be we can arrange
an unofficial/official hackathon over a weekend or in a certain time window
where most of our contributors are free to join.
And in the meantime I really appreciate the work you have done and I will
start contributing to the git branch.
Thanks,
Dammina
Post by Gary Martin
Hi everyone,
Last night I merged code that was worked on last month from the pyconuk
* adding django-rest-framework [1]
* adding django rest swagger [2]
* activation and registering the Ticket and ChangeEvent models with the admin site
* schema_view/ (the view of the api generated by swagger)
* field/ (a view to list and create ticket fields)
* ticket/ (a view to list and create tickets)
* ticket/<uuid:id> (a view of a specific ticket)
* ticket/<uuid:id>/event/ (a view to show ticket change events for a given ticket)
Cheers,
Gary
[1] https://www.django-rest-framework.org/
[2] https://django-rest-swagger.readthedocs.io/
Author: gjm
Date: Sun Oct 14 00:23:31 2018
New Revision: 1843805
URL: http://svn.apache.org/viewvc?rev=1843805&view=rev
Attempt to add links to api output for ticket list
bloodhound/branches/bh_core_experimental/trackers/models.py
bloodhound/branches/bh_core_experimental/trackers/serializers.py
bloodhound/branches/bh_core_experimental/trackers/urls.py
Modified: bloodhound/branches/bh_core_experimental/trackers/models.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/models.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/models.py
(original)
+++ bloodhound/branches/bh_core_experimental/trackers/models.py Sun Oct
14 00:23:31 2018
@@ -21,6 +21,7 @@ import logging
import uuid
from django.db import models
+from django.urls import reverse
logger = logging.getLogger(__name__)
title = models.CharField(max_length=200, null=True)
description = models.TextField(null=True)
+ return reverse('ticket_view', args=(self.id,))
+
last_event = self.changeevent_set.order_by('created').last()
return self.created if last_event is None else
last_event.created
Modified: bloodhound/branches/bh_core_experimental/trackers/
serializers.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/serializers.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/serializers.py
(original)
+++ bloodhound/branches/bh_core_experimental/trackers/serializers.py Sun
Oct 14 00:23:31 2018
@@ -1,20 +1,25 @@
from rest_framework import serializers
-from trackers.models import Ticket, TicketField, ChangeEvent
+from trackers import models
+ api_url = serializers.SerializerMethodField()
+
- model = Ticket
+ model = models.Ticket
fields = '__all__'
+ return self.context['request'].build_absolute_uri(obj.api_url())
+
- model = TicketField
+ model = models.TicketField
fields = '__all__'
- model = ChangeEvent
+ model = models.ChangeEvent
fields = '__all__'
Modified: bloodhound/branches/bh_core_experimental/trackers/urls.py
http://svn.apache.org/viewvc/bloodhound/branches/bh_core_experimental/trackers/urls.py?rev=1843805&r1=1843804&r2=1843805&view=diff
==============================================================================
--- bloodhound/branches/bh_core_experimental/trackers/urls.py (original)
+++ bloodhound/branches/bh_core_experimental/trackers/urls.py Sun Oct 14
00:23:31 2018
@@ -23,6 +23,6 @@ urlpatterns = [
path('schema_view/', views.schema_view),
path('field/', views.TicketFieldListCreate.as_view()),
path('ticket/', views.TicketListCreate.as_view()),
- path('ticket/<uuid:id>', views.TicketViewUpdate.as_view()),
+ path('ticket/<uuid:id>', views.TicketViewUpdate.as_view(),
name='ticket_view'),
path('ticket/<uuid:id>/event/',
views.ChangeEventListCreate.as_view()),
]
--
Dammina Sahabandu
PMC & Committer, Apache Software Foundation
AMIE (SL)
Bsc Eng Hons (Moratuwa)
+65 881 129 81
--
Cheers,
Gary
Loading...