summaryrefslogtreecommitdiff
path: root/isotests
diff options
context:
space:
mode:
Diffstat (limited to 'isotests')
-rw-r--r--isotests/admin.py4
-rw-r--r--isotests/fixtures/architecture.json30
-rw-r--r--isotests/fixtures/boottype.json23
-rw-r--r--isotests/fixtures/clockchoices.json23
-rw-r--r--isotests/fixtures/isotypes.json16
-rw-r--r--isotests/models.py110
-rw-r--r--isotests/urls.py6
-rw-r--r--isotests/views.py42
8 files changed, 212 insertions, 42 deletions
diff --git a/isotests/admin.py b/isotests/admin.py
index 03b5fbab..b03ddea3 100644
--- a/isotests/admin.py
+++ b/isotests/admin.py
@@ -2,9 +2,13 @@ from isotests.models import *
from django.contrib import admin
admin.site.register(Iso)
+admin.site.register(Architecture)
+admin.site.register(Isotype)
+admin.site.register(Boottype)
admin.site.register(Hardware)
admin.site.register(InstallType)
admin.site.register(Source)
+admin.site.register(Clockchoice)
admin.site.register(Filesystem)
admin.site.register(Module)
admin.site.register(Bootloader)
diff --git a/isotests/fixtures/architecture.json b/isotests/fixtures/architecture.json
new file mode 100644
index 00000000..a21100ba
--- /dev/null
+++ b/isotests/fixtures/architecture.json
@@ -0,0 +1,30 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "dual, option i686"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "dual, option x86_64"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "i686"
+ }
+ },
+ {
+ "pk": 4,
+ "model": "isotests.architecture",
+ "fields": {
+ "name": "x86_64"
+ }
+ }
+]
diff --git a/isotests/fixtures/boottype.json b/isotests/fixtures/boottype.json
new file mode 100644
index 00000000..5d87ef15
--- /dev/null
+++ b/isotests/fixtures/boottype.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.boottype",
+ "fields": {
+ "name": "optical"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.boottype",
+ "fields": {
+ "name": "usb"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.boottype",
+ "fields": {
+ "name": "pxe"
+ }
+ }
+]
diff --git a/isotests/fixtures/clockchoices.json b/isotests/fixtures/clockchoices.json
new file mode 100644
index 00000000..2c078128
--- /dev/null
+++ b/isotests/fixtures/clockchoices.json
@@ -0,0 +1,23 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.clockchoice",
+ "fields": {
+ "name": "default"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.clockchoice",
+ "fields": {
+ "name": "configured manually"
+ }
+ },
+ {
+ "pk": 3,
+ "model": "isotests.clockchoice",
+ "fields": {
+ "name": "NTP"
+ }
+ }
+]
diff --git a/isotests/fixtures/isotypes.json b/isotests/fixtures/isotypes.json
new file mode 100644
index 00000000..760e3738
--- /dev/null
+++ b/isotests/fixtures/isotypes.json
@@ -0,0 +1,16 @@
+[
+ {
+ "pk": 1,
+ "model": "isotests.isotype",
+ "fields": {
+ "name": "core"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "isotests.isotype",
+ "fields": {
+ "name": "net"
+ }
+ }
+]
diff --git a/isotests/models.py b/isotests/models.py
index 1eaca163..d9cfc78c 100644
--- a/isotests/models.py
+++ b/isotests/models.py
@@ -1,4 +1,6 @@
from django.db import models
+from django.db.models import Max
+from datetime import datetime
# Create your models here.
class Iso(models.Model):
@@ -7,81 +9,125 @@ class Iso(models.Model):
def __unicode__(self):
return str(self.date)
+class Architecture(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
+class Isotype(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
+class Boottype(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
class Hardware(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class InstallType(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Source(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
+
+class Clockchoice(models.Model):
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Filesystem(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Module(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Bootloader(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
+ def get_success_test(self):
+ return self.test_set.filter(success=True).aggregate(Max('iso__date'))['iso__date__max']
+ def get_failed_test(self):
+ return self.test_set.filter(success=False).aggregate(Max('iso__date'))['iso__date__max']
class Test(models.Model):
- ARCH_CHOICES = (
- ('d86', 'dual, option i686'),
- ('d64', 'dual, option x86_64'),
- ('x86', 'i686'),
- ('x64', 'x86_64')
- )
-
- ISOTYPE_CHOICES = (
- ('c', 'core'),
- ('n', 'net')
- )
-
- BOOTTYPE_CHOICES = (
- ('o', 'optical'),
- ('u', 'usb'),
- ('p', 'pxe')
- )
-
- CLOCK_CHOICES = (
- ('d', 'default'),
- ('m', 'configured manually'),
- ('n', 'NTP')
- )
-
user_name = models.CharField(max_length=500)
user_email = models.EmailField()
iso = models.ForeignKey(Iso)
- arch = models.CharField(max_length=3, choices=ARCH_CHOICES)
- isotype = models.CharField(max_length=1, choices=ISOTYPE_CHOICES)
- boottype = models.CharField(max_length=1, choices=BOOTTYPE_CHOICES)
+ arch = models.ForeignKey(Architecture)
+ isotype = models.ForeignKey(Isotype)
+ boottype = models.ForeignKey(Boottype)
hardwaretype = models.ForeignKey(Hardware)
installtype = models.ForeignKey(InstallType)
source = models.ForeignKey(Source)
- clock = models.CharField(max_length=1, choices=CLOCK_CHOICES)
+ clock = models.ForeignKey(Clockchoice)
filesystem = models.ForeignKey(Filesystem)
- ms = models.ManyToManyField(Module)
+ ms = models.ManyToManyField(Module, null=True, blank=True)
rollback = models.BooleanField()
- rollback_filesystem = models.ForeignKey(Filesystem, related_name="rollback_test")
- rollback_modules = models.ManyToManyField(Module, related_name="rollback_test")
+ 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()
+ comments = models.TextField(null=True, blank=True)
diff --git a/isotests/urls.py b/isotests/urls.py
index fdde9e3b..e28497aa 100644
--- a/isotests/urls.py
+++ b/isotests/urls.py
@@ -6,11 +6,11 @@ info_dict = {
}
urlpatterns = patterns('isotests.views',
- (r'^add/$', 'add_result')
-)
+ (r'^$', 'view_results'),
+ (r'^add/$', 'add_result')
+ )
urlpatterns += patterns('',
- (r'^$', 'django.views.generic.list_detail.object_list', info_dict)
)
# vim: set ts=4 sw=4 et:
diff --git a/isotests/views.py b/isotests/views.py
index 742be8ff..738fa90d 100644
--- a/isotests/views.py
+++ b/isotests/views.py
@@ -1,9 +1,9 @@
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
-from django.forms import ModelForm
-from isotests.models import Test
+from django.forms import ModelForm, DateField
+from isotests.models import *
from django.shortcuts import render_to_response
-from django.template import RequestContext
+from django.template import RequestContext, Context, loader
class TestForm(ModelForm):
class Meta:
@@ -18,7 +18,35 @@ def add_result(request):
else:
form = TestForm() # An unbound form
- return render_to_response('isotests/add.html', {
- 'form': form,
- },
- context_instance=RequestContext(request))
+ return render_to_response('isotests/add.html', { 'form': form, },
+ context_instance=RequestContext(request))
+
+def view_results(request):
+ result_success_list = Test.objects.filter(success=True)
+ result_failed_list = Test.objects.filter(success=False)
+
+ architecture_list = Architecture.objects.all()
+ isotype_list = Isotype.objects.all()
+ boottype_list = Boottype.objects.all()
+ hardware_list = Hardware.objects.all()
+ installtype_list = InstallType.objects.all()
+ source_list = Source.objects.all()
+ clockchoice_list = Clockchoice.objects.all()
+ module_list = Module.objects.all()
+ filesystem_list = Filesystem.objects.all()
+ bootloader_list = Bootloader.objects.all()
+
+ t = loader.get_template("isotests/results.html")
+ c = Context({
+ 'arch_choices': architecture_list,
+ 'isotype_choices': isotype_list,
+ 'boottype_choices': boottype_list,
+ 'hardware_list': hardware_list,
+ 'installtype_list': installtype_list,
+ 'source_list': source_list,
+ 'clock_choices': clockchoice_list,
+ 'filesystem_list': filesystem_list,
+ 'module_list': module_list,
+ 'bootloader_list': bootloader_list,
+ })
+ return HttpResponse(t.render(c))