From feac15e4ef6d5ea1cbd0cbc609179986cd011899 Mon Sep 17 00:00:00 2001
From: Shirlei Chaves <shirlei@gmail.com>
Date: Mon, 2 May 2016 21:50:40 -0300
Subject: [PATCH] Add castvote cast_ip field

---
 helios/migrations/0002_castvote_cast_ip.py | 20 ++++++++++++++++++++
 helios/models.py                           |  3 +++
 2 files changed, 23 insertions(+)
 create mode 100644 helios/migrations/0002_castvote_cast_ip.py

diff --git a/helios/migrations/0002_castvote_cast_ip.py b/helios/migrations/0002_castvote_cast_ip.py
new file mode 100644
index 0000000..47db5b1
--- /dev/null
+++ b/helios/migrations/0002_castvote_cast_ip.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('helios', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='castvote',
+            name='cast_ip',
+            field=models.GenericIPAddressField(null=True),
+            preserve_default=True,
+        ),
+    ]
diff --git a/helios/models.py b/helios/models.py
index 80d12ba..9331cb3 100644
--- a/helios/models.py
+++ b/helios/models.py
@@ -980,6 +980,9 @@ class CastVote(HeliosModel):
   verified_at = models.DateTimeField(null=True)
   invalidated_at = models.DateTimeField(null=True)
   
+  # auditing purposes, like too many votes from the same IP, if it isn't expected
+  cast_ip = models.GenericIPAddressField(null=True)
+
   @property
   def datatype(self):
     return self.voter.datatype.replace('Voter', 'CastVote')
-- 
GitLab