Пример #1
0
Файл: views.py Проект: aidjek/TS
def project_view(request, pk=None):
    pr = ProjectResource()
    project = pr.obj_get(pk=pk)

    pr_bundle = pr.build_bundle(obj=project, request=request)

    return render_to_response(
        "rundb/data/modal_project_details.html",
        {
            # Other things here.
            "project_json":
            pr.serialize(None, pr.full_dehydrate(pr_bundle),
                         'application/json'),
            "project":
            project,
            "method":
            "GET",
            "readonly":
            True,
            'action':
            reverse('api_dispatch_detail',
                    kwargs={
                        'resource_name': 'project',
                        'api_name': 'v1',
                        'pk': int(pk)
                    },
                    args={'format': 'json'})
        })
Пример #2
0
Файл: views.py Проект: aidjek/TS
def project_edit(request, pk=None):
    pr = ProjectResource()
    project = pr.obj_get(pk=pk)
    pr_bundle = pr.build_bundle(obj=project, request=request)

    otherList = [p.name for p in Project.objects.all()]
    return render_to_response(
        "rundb/data/modal_project_details.html",
        {
            # Other things here.
            "project_json":
            pr.serialize(None, pr.full_dehydrate(pr_bundle),
                         'application/json'),
            "project":
            project,
            "id":
            pk,
            'otherList':
            json.dumps(otherList),
            "method":
            "PATCH",
            'methodDescription':
            'Edit',
            "readonly":
            True,
            'action':
            reverse('api_dispatch_detail',
                    kwargs={
                        'resource_name': 'project',
                        'api_name': 'v1',
                        'pk': int(pk)
                    })
        })
Пример #3
0
def project_edit(request, pk=None):
    pr = ProjectResource()
    project = pr.obj_get(pk=pk)
    pr_bundle = pr.build_bundle(obj=project, request=request)

    otherList = [p.name for p in Project.objects.all()]
    return render_to_response("rundb/data/modal_project_details.html", {
        # Other things here.
        "project_json": pr.serialize(None, pr.full_dehydrate(pr_bundle), 'application/json'), "project": project, "id": pk, 'otherList': json.dumps(otherList), "method": "PATCH", 'methodDescription': 'Edit', "readonly": True, 'action': reverse('api_dispatch_detail', kwargs={'resource_name': 'project', 'api_name': 'v1', 'pk': int(pk)})
    })
Пример #4
0
def project_view(request, pk=None):
    pr = ProjectResource()
    project = pr.obj_get(pk=pk)

    pr_bundle = pr.build_bundle(obj=project, request=request)

    return render_to_response("rundb/data/modal_project_details.html", {
        # Other things here.
        "project_json": pr.serialize(None, pr.full_dehydrate(pr_bundle), 'application/json'), "project": project, "method": "GET", "readonly": True, 'action': reverse('api_dispatch_detail', kwargs={'resource_name': 'project', 'api_name': 'v1', 'pk': int(pk)}, args={'format': 'json'})
    })
Пример #5
0
def project_view(request, pk=None):
    pr = ProjectResource()
    project = pr.obj_get(pk=pk)

    pr_bundle = pr.build_bundle(obj=project, request=request)

    return render_to_response(
        "rundb/data/modal_project_details.html",
        {
            # Other things here.
            "project_json": pr.serialize(None, pr.full_dehydrate(pr_bundle), "application/json"),
            "project": project,
            "method": "GET",
            "readonly": True,
            "action": reverse(
                "api_dispatch_detail",
                kwargs={"resource_name": "project", "api_name": "v1", "pk": int(pk)},
                args={"format": "json"},
            ),
        },
    )