django.shortcuts.get_object_or_404.model_class

Here are the examples of the python api django.shortcuts.get_object_or_404.model_class taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: djep Source File: views.py
    def get(self, request, pk):
        if not request.user.is_staff:
            return HttpResponseForbidden()
        ctype = get_object_or_404(ContentType.objects, pk=pk).model_class()
        if not issubclass(ctype, Ticket):
            raise Http404()
        result = [{'name': name, 'label': unicode(ctype._meta.get_field(name).verbose_name)} for name in ctype.get_fields()]
        return HttpResponse(json.dumps(result),
                content_type='text/json')