summaryrefslogtreecommitdiffstats
path: root/isotests/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'isotests/views.py')
-rw-r--r--isotests/views.py64
1 files changed, 54 insertions, 10 deletions
diff --git a/isotests/views.py b/isotests/views.py
index cb7f23c..61d95e5 100644
--- a/isotests/views.py
+++ b/isotests/views.py
@@ -1,15 +1,22 @@
-from django.http import HttpResponse, HttpResponseRedirect
+from django.forms import ModelChoiceField, CharField, TextInput
from django.forms import ModelForm, RadioSelect, CheckboxSelectMultiple
-from django.forms import ModelChoiceField
+from django.forms import ModelMultipleChoiceField, BooleanField
+from django.http import HttpResponse, HttpResponseRedirect
+from django.template import Context, loader
+from django.views.generic.simple import direct_to_template
+
from isotests.models import Iso, Architecture, IsoType, BootType
from isotests.models import HardwareType, InstallType, Source, Test
from isotests.models import ClockChoice, Filesystem, Module, Bootloader
-from django.template import Context, loader
-from django.views.generic.simple import direct_to_template
class TestForm(ModelForm):
class Meta:
model = Test
+ fields = ("user_name", "user_email", "iso", "architecture",
+ "iso_type", "boot_type", "hardware_type",
+ "install_type", "source", "clock_choice", "filesystem",
+ "modules", "rollback_filesystem", "rollback_modules",
+ "bootloader", "success", "comments")
widgets = {
"architecture": RadioSelect(),
"iso_type": RadioSelect(),
@@ -18,20 +25,35 @@ class TestForm(ModelForm):
"install_type": RadioSelect(),
"source": RadioSelect(),
"clock_choice": RadioSelect(),
- "filesystem": RadioSelect(),
- "rollback_filesystem": RadioSelect(),
"bootloader": RadioSelect(),
"modules": CheckboxSelectMultiple(),
- "rollback_modules": CheckboxSelectMultiple(),
}
+ success = BooleanField(help_text="Only check this if everything went fine. " \
+ "If you you ran into any errors please specify them in the " \
+ "comments.", required=False)
iso = ModelChoiceField(queryset=Iso.objects.filter(active=True))
+ filesystem = ModelChoiceField(queryset=Filesystem.objects.all(),
+ help_text="Check the installed system, including fstab.",
+ widget=RadioSelect())
+ modules = ModelMultipleChoiceField(queryset=Module.objects.all(),
+ help_text="", widget=CheckboxSelectMultiple(), required=False)
+ rollback_filesystem = ModelChoiceField(queryset=Filesystem.objects.all(),
+ help_text="If you did a rollback followed by a new attempt to setup " \
+ "your lockdevices/filesystems, select which option you took here.",
+ widget=RadioSelect(), required=False)
+ rollback_modules = ModelMultipleChoiceField(queryset=Module.objects.all(),
+ help_text="If you did a rollback followed b a new attempt to setup " \
+ "your lockdevices/filesystems, select which option you took here.",
+ widget=CheckboxSelectMultiple(), required=False)
+ website = CharField(label='',
+ widget=TextInput(attrs={'style': 'display:none;'}), required=False)
def add_result(request):
- if request.method == 'POST':
+ if request.POST:
form = TestForm(request.POST)
- if form.is_valid():
+ if form.is_valid() and request.POST['website'] == '':
form.save()
- return HttpResponseRedirect('/isotests')
+ return HttpResponseRedirect('/isotests/thanks/')
else:
form = TestForm()
@@ -64,3 +86,25 @@ def view_results(request):
'bootloader_list': bootloader_list,
})
return HttpResponse(t.render(c))
+
+def view_results_iso(request, isoid):
+ iso = Iso.objects.get(pk=isoid)
+ test_list = Test.objects.filter(iso__pk=isoid)
+ context = {
+ 'iso_name': iso.name,
+ 'test_list': test_list
+ }
+ return direct_to_template(request, 'isotests/result_list.html', context)
+
+def view_results_for(request, option, value):
+ kwargs = {option: value}
+ test_list = Test.objects.filter(**kwargs).order_by("iso__name", "pk")
+ context = {
+ 'option': option,
+ 'value': value,
+ 'test_list': test_list
+ }
+ return direct_to_template(request, 'isotests/result_list.html', context)
+
+def thanks(request):
+ return direct_to_template(request, "isotests/thanks.html", None)