summaryrefslogtreecommitdiff
path: root/isotests/models.py
blob: bffb2d94b20829691be8ffc5dfb7fc1fe203f01b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from django.db import models
from django.db.models import Max

class IsoOption(models.Model):
    class Meta:
        abstract = True

    name = models.CharField(max_length=200)

    def __unicode__(self):
        return str(self.name)

    def get_success_test(self):
        test = self.test_set.filter(success=True).annotate(Max('iso__id'))
        if test:
            return test[0].iso.name
        return None

    def get_failed_test(self):
        test = self.test_set.filter(success=False).annotate(Max('iso__id'))
        if test:
            return test[0].iso.name
        return None

class Iso(models.Model):
    name = models.CharField(max_length=500)
    active = models.BooleanField(default=True)

    def __unicode__(self):
        return self.name

class Architecture(IsoOption):
    pass

class IsoType(IsoOption):
    pass

class BootType(IsoOption):
    pass

class HardwareType(IsoOption):
    pass

class InstallType(IsoOption):
    pass

class Source(IsoOption):
    pass

class ClockChoice(IsoOption):
    pass

class Filesystem(IsoOption):
    pass

class Module(IsoOption):
    pass

class Bootloader(IsoOption):
    pass

class Test(models.Model):
    user_name = models.CharField(max_length=500)
    user_email = models.EmailField()
    iso = models.ForeignKey(Iso)
    architecture = models.ForeignKey(Architecture)
    iso_type = models.ForeignKey(IsoType)
    boot_type = models.ForeignKey(BootType)
    hardware_type = models.ForeignKey(HardwareType)
    install_type = models.ForeignKey(InstallType)
    source = models.ForeignKey(Source)
    clock_choice = models.ForeignKey(ClockChoice)
    filesystem = models.ForeignKey(Filesystem)
    modules = models.ManyToManyField(Module, null=True, blank=True)
    rollback = models.BooleanField()
    rollback_filesystem = models.ForeignKey(Filesystem,
            related_name="rollback_test", null=True, blank=True)
    rollback_modules = models.ManyToManyField(Module,
            related_name="rollback_test", null=True, blank=True)
    bootloader = models.ForeignKey(Bootloader)
    success = models.BooleanField()
    comments = models.TextField(null=True, blank=True)