From b5be7d6fd60ade6af2fb9379fa43e3e93e60736e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 28 Apr 2011 15:04:45 -0500 Subject: isotests: record submission IP address Helps a lot if we start seeing bogus submissions to track down and suppress the issue. Signed-off-by: Dan McGee --- isotests/models.py | 3 +++ isotests/views.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/isotests/models.py b/isotests/models.py index 55c1bd0d..1267fe85 100644 --- a/isotests/models.py +++ b/isotests/models.py @@ -99,7 +99,9 @@ class Bootloader(IsoOption): class Test(models.Model): user_name = models.CharField(max_length=500) user_email = models.EmailField() + ip_address = models.IPAddressField() created = models.DateTimeField(editable=False) + iso = models.ForeignKey(Iso) architecture = models.ForeignKey(Architecture) iso_type = models.ForeignKey(IsoType) @@ -115,6 +117,7 @@ class Test(models.Model): rollback_modules = models.ManyToManyField(Module, related_name="rollback_test_set", null=True, blank=True) bootloader = models.ForeignKey(Bootloader) + success = models.BooleanField() comments = models.TextField(null=True, blank=True) diff --git a/isotests/views.py b/isotests/views.py index 1d118d3a..d9882128 100644 --- a/isotests/views.py +++ b/isotests/views.py @@ -50,7 +50,9 @@ def add_result(request): if request.POST: form = TestForm(request.POST) if form.is_valid() and request.POST['website'] == '': - form.save() + test = form.save(commit=False) + test.ip_address = request.META.get("REMOTE_ADDR", None) + test.save() return HttpResponseRedirect('/isotests/thanks/') else: form = TestForm() -- cgit v1.2.3-54-g00ecf