I see, hmm, now the try except makes sense.  Even sot, can you update it so
we either assume pk exists (no `get`) or not?
On Jan 16, 2014 11:31 AM, "ukanga" <notifications@github.com> wrote:

> In onadata/apps/api/viewsets/xform_viewset.py:
>
> > @@ -285,16 +372,16 @@ class XFormViewSet(mixins.MultiLookupMixin, ModelViewSet):
> >      extra_lookup_fields = None
> >      permission_classes = [permissions.DjangoModelPermissions, ]
> >
> > -    def create(self, request, *args, **kwargs):
> > -        survey = utils.publish_xlsform(request, request.user)
> > -        if isinstance(survey, XForm):
> > -            xform = XForm.objects.get(pk=survey.pk)
> > -            serializer = serializers.XFormSerializer(
> > -                xform, context={'request': request})
> > -            headers = self.get_success_headers(serializer.data)
> > -            return Response(serializer.data, status=status.HTTP_201_CREATED,
> > -                            headers=headers)
> > -        return Response(survey, status=status.HTTP_400_BAD_REQUEST)
> > +    def get_object(self, queryset=None):
> > +        owner, pk = self.lookup_fields
> > +        try:
>
> pk always comes in as a string i.e pk = "323" or pk="tutorial", when we
> are given an int value, we need to use pk, if it is a string then we can
> use id_string as a last resort.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/onaio/onadata/pull/117/files#r8937424>
> .
>