~qajenkinsbot/qa-dashboard/production

« back to all changes in this revision

Viewing changes to memevent/api.py

  • Committer: Joe Talbott
  • Date: 2013-07-03 19:55:15 UTC
  • mto: (1.1.484 qa-dashboard)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: joe.talbott@canonical.com-20130703195515-akweyl9opr6jk0ss
memevent - Add Memory Event Testing views.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# QA Dashboard
 
2
# Copyright 2013 Canonical Ltd.
 
3
 
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU Affero General Public License version 3, as
 
6
# published by the Free Software Foundation.
 
7
 
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
# PURPOSE.  See the GNU Affero General Public License for more details.
 
12
 
 
13
# You should have received a copy of the GNU Affero General Public License
 
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 
 
16
 
 
17
from django.views.decorators.http import require_GET
 
18
 
 
19
from common.utils import (
 
20
    JSONResponse,
 
21
    MySerializer,
 
22
)
 
23
 
 
24
from memevent.models import (
 
25
    MemoryEventDetail,
 
26
    MemoryEventImage,
 
27
    MemoryEventMachine,
 
28
)
 
29
 
 
30
 
 
31
@require_GET
 
32
def detail_overview(request, build_number):
 
33
 
 
34
    details = MemoryEventDetail.objects.filter(
 
35
        publish=True,
 
36
        image__build_number=build_number,
 
37
    )
 
38
 
 
39
    serializer = MySerializer()
 
40
    data = serializer.serialize(details)
 
41
 
 
42
    return JSONResponse(data)
 
43
 
 
44
 
 
45
@require_GET
 
46
def machine_overview(request):
 
47
 
 
48
    details = MemoryEventMachine.objects.filter(
 
49
        publish=True,
 
50
    )
 
51
 
 
52
    serializer = MySerializer()
 
53
    data = serializer.serialize(details)
 
54
 
 
55
    return JSONResponse(data)
 
56
 
 
57
 
 
58
@require_GET
 
59
def image_overview(request):
 
60
 
 
61
    details = MemoryEventImage.objects.filter(
 
62
        publish=True,
 
63
    )
 
64
 
 
65
    serializer = MySerializer()
 
66
    data = serializer.serialize(details)
 
67
 
 
68
    return JSONResponse(data)