示例#1
0
文件: rest.py 项目: alatteri/informer
    def _pre_init(self, request, new_model, data):
        """
        Associates a resource with shot and project specified in URI
        """
        # TODO: specifiy form_class in urls.py to verify data
        project_name = Project.getNameFromRequest(request)
        project = Project.getProject(project_name, create=True)

        shot_name = Shot.getNameFromRequest(request)
        shot = Shot.getShot(shot_name, project, create=True)

        # associate with the shot
        new_model.shot = shot
示例#2
0
文件: rest.py 项目: alatteri/informer
    def read(self, request):
        project_name = Project.getNameFromRequest(request)
        project = get_object_or_404(Project, name=project_name)

        shot_name = Shot.getNameFromRequest(request)
        shot = get_object_or_404(Shot, project=project, name=shot_name)

        filtered_set = self.queryset._clone()
        filtered_set = filtered_set.filter(shot=shot)

        return self.responder.list(request, filtered_set)