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

On Sun, Oct 14, 2018 at 11:44 PM Gary Martin <[email protected]>
wrote:

> 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/
>
> On Sun, 14 Oct 2018, at 1:23 AM, [email protected] wrote:
> > Author: gjm
> > Date: Sun Oct 14 00:23:31 2018
> > New Revision: 1843805
> >
> > URL: http://svn.apache.org/viewvc?rev=1843805&view=rev
> > Log:
> > Attempt to add links to api output for ticket list
> >
> > Modified:
> >     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
> > URL:
> >
> 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__)
> >
> > @@ -37,6 +38,9 @@ class Ticket(ModelCommon):
> >      title = models.CharField(max_length=200, null=True)
> >      description = models.TextField(null=True)
> >
> > +    def api_url(self):
> > +        return reverse('ticket_view', args=(self.id,))
> > +
> >      def last_update(self):
> >          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
> > URL:
> >
> 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
> >
> >
> >  class TicketSerializer(serializers.ModelSerializer):
> > +    api_url = serializers.SerializerMethodField()
> > +
> >      class Meta:
> > -        model = Ticket
> > +        model = models.Ticket
> >          fields = '__all__'
> >
> > +    def get_api_url(self, obj):
> > +        return self.context['request'].build_absolute_uri(obj.api_url())
> > +
> >
> >  class TicketFieldSerializer(serializers.ModelSerializer):
> >      class Meta:
> > -        model = TicketField
> > +        model = models.TicketField
> >          fields = '__all__'
> >
> >
> >  class ChangeEventSerializer(serializers.ModelSerializer):
> >      class Meta:
> > -        model = ChangeEvent
> > +        model = models.ChangeEvent
> >          fields = '__all__'
> >
> > Modified: bloodhound/branches/bh_core_experimental/trackers/urls.py
> > URL:
> >
> 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

Reply via email to