diff --git a/helios/forms.py b/helios/forms.py index d2c887087bcafcf5a3586fb68a4b81c06b2f40cb..d54553a90cf534f3fc4013d73feb3821c06da278 100644 --- a/helios/forms.py +++ b/helios/forms.py @@ -13,8 +13,8 @@ class ElectionForm(forms.Form): description = forms.CharField(max_length=2000, widget=forms.Textarea(attrs={'cols': 70, 'wrap': 'soft'})) election_type = forms.ChoiceField(label="type", choices = Election.ELECTION_TYPES) use_voter_aliases = forms.BooleanField(required=False, initial=False, help_text='if selected, voter identities will be replaced with aliases, e.g. "V12", in the ballot tracking center') - use_advanced_audit_features = forms.BooleanField(required=False, initial=True, help_text='disable this only if you want a simple election with reduced security but a simpler user interface') - private_p = forms.BooleanField(required=False, initial=False, label="Private?", help_text='a private election is only visible to registered/eligible voters') + #use_advanced_audit_features = forms.BooleanField(required=False, initial=True, help_text='disable this only if you want a simple election with reduced security but a simpler user interface') + #private_p = forms.BooleanField(required=False, initial=False, label="Private?", help_text='a private election is only visible to registered/eligible voters') class ElectionTimesForm(forms.Form): diff --git a/helios/migrations/0002_v3_1_new_election_and_voter_fields.py b/helios/migrations/0002_v3_1_new_election_and_voter_fields.py index 56bd20b9d90cdb3d76ed4693ad02cc91a6e72b84..1bb39198f65b77c9e88110ac13f660f9430393d6 100644 --- a/helios/migrations/0002_v3_1_new_election_and_voter_fields.py +++ b/helios/migrations/0002_v3_1_new_election_and_voter_fields.py @@ -24,7 +24,7 @@ class Migration(SchemaMigration): db.add_column('helios_voter', 'voter_email', self.gf('django.db.models.fields.CharField')(max_length=250, null=True), keep_default=False) # Adding field 'Election.datatype' - db.add_column('helios_election', 'datatype', self.gf('django.db.models.fields.CharField')(default='2011/01/Election', max_length=250), keep_default=False) + db.add_column('helios_election', 'datatype', self.gf('django.db.models.fields.CharField')(default='legacy/Election', max_length=250), keep_default=False) # Adding field 'Election.election_type' db.add_column('helios_election', 'election_type', self.gf('django.db.models.fields.CharField')(default='election', max_length=250), keep_default=False) @@ -108,7 +108,7 @@ class Migration(SchemaMigration): 'archived_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), 'cast_url': ('django.db.models.fields.CharField', [], {'max_length': '500'}), 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'datatype': ('django.db.models.fields.CharField', [], {'default': "'2011/01/election'", 'max_length': '250'}), + 'datatype': ('django.db.models.fields.CharField', [], {'default': "'legacy/Election'", 'max_length': '250'}), 'description': ('django.db.models.fields.TextField', [], {}), 'election_type': ('django.db.models.fields.CharField', [], {'default': "'election'", 'max_length': '250'}), 'eligibility': ('auth.jsonfield.JSONField', [], {'null': 'True'}), diff --git a/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py b/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py index 30f0fe04bf1166ffe65d1c4db31ab8ab457a2c55..518356d70e15f82fd1ce84841ebb24031605fe6f 100644 --- a/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py +++ b/helios/migrations/0003_v3_1_election_specific_voters_with_passwords.py @@ -88,7 +88,7 @@ class Migration(DataMigration): 'archived_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), 'cast_url': ('django.db.models.fields.CharField', [], {'max_length': '500'}), 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'datatype': ('django.db.models.fields.CharField', [], {'default': "'2011/01/Election'", 'max_length': '250'}), + 'datatype': ('django.db.models.fields.CharField', [], {'default': "'legacy/Election'", 'max_length': '250'}), 'description': ('django.db.models.fields.TextField', [], {}), 'election_type': ('django.db.models.fields.CharField', [], {'default': "'election'", 'max_length': '250'}), 'eligibility': ('auth.jsonfield.JSONField', [], {'null': 'True'}), diff --git a/helios/migrations/0004_v3_1_remove_voter_fields.py b/helios/migrations/0004_v3_1_remove_voter_fields.py index 1a11aeb3c853e9ffa378056e27f77c9202450cd0..620152e8f04feab1a5ff763c986bd6817e39e5b9 100644 --- a/helios/migrations/0004_v3_1_remove_voter_fields.py +++ b/helios/migrations/0004_v3_1_remove_voter_fields.py @@ -68,7 +68,7 @@ class Migration(SchemaMigration): 'archived_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), 'cast_url': ('django.db.models.fields.CharField', [], {'max_length': '500'}), 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'datatype': ('django.db.models.fields.CharField', [], {'default': "'2011/01/election'", 'max_length': '250'}), + 'datatype': ('django.db.models.fields.CharField', [], {'default': "'legacy/Election'", 'max_length': '250'}), 'description': ('django.db.models.fields.TextField', [], {}), 'election_type': ('django.db.models.fields.CharField', [], {'default': "'election'", 'max_length': '250'}), 'eligibility': ('auth.jsonfield.JSONField', [], {'null': 'True'}), diff --git a/helios/migrations/0005_add_quarantine_fields.py b/helios/migrations/0005_add_quarantine_fields.py index 42f113820e76c2a434b2dc564d9e35107d114785..51cfc99d3b9831bac837930e8fe1696fbdb0029c 100644 --- a/helios/migrations/0005_add_quarantine_fields.py +++ b/helios/migrations/0005_add_quarantine_fields.py @@ -69,7 +69,7 @@ class Migration(SchemaMigration): 'cast_url': ('django.db.models.fields.CharField', [], {'max_length': '500'}), 'complaint_period_ends_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}), 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'datatype': ('django.db.models.fields.CharField', [], {'default': "'2011/01/election'", 'max_length': '250'}), + 'datatype': ('django.db.models.fields.CharField', [], {'default': "'legacy/Election'", 'max_length': '250'}), 'description': ('django.db.models.fields.TextField', [], {}), 'election_type': ('django.db.models.fields.CharField', [], {'default': "'election'", 'max_length': '250'}), 'eligibility': ('auth.jsonfield.JSONField', [], {'null': 'True'}), diff --git a/helios/models.py b/helios/models.py index c6e806920a93f0c39db7b97e0ff9748b6be1a9e5..14f52f2bcb49da1e680899e289fb48d3383f999e 100644 --- a/helios/models.py +++ b/helios/models.py @@ -38,9 +38,10 @@ class Election(HeliosModel): # keep track of the type and version of election, which will help dispatch to the right # code, both for crypto and serialization - # v3 and prior have a datatype of "legacy/election" - # v3.1 and above have a specific datatype of "2011/01/election" - datatype = models.CharField(max_length=250, null=False, default="2011/01/Election") + # v3 and prior have a datatype of "legacy/Election" + # v3.1 will still use legacy/Election + # later versions, at some point will upgrade to "2011/01/Election" + datatype = models.CharField(max_length=250, null=False, default="legacy/Election") short_name = models.CharField(max_length=100) name = models.CharField(max_length=250) diff --git a/helios/views.py b/helios/views.py index 0298b0ba2866bf2ee278808a6843f7075acf3fad..195eb36f9be39cb9ebbedfe228dea65eadcdb9c9 100644 --- a/helios/views.py +++ b/helios/views.py @@ -109,7 +109,7 @@ def admin_autologin(request): user = users[0] request.session['user'] = {'type' : user.user_type, 'user_id' : user.user_id} - return HttpResponseRedirect(reverse(home)) + return HttpResponseRedirect("/") ## ## General election features @@ -557,7 +557,7 @@ def one_election_cast_confirm(request, election): issues = None # status update this vote - if voter and user and user.can_update_status(): + if voter and voter.user.can_update_status(): status_update_label = voter.user.update_status_template() % "your smart ballot tracker" status_update_message = "I voted in %s - my smart tracker is %s.. #heliosvoting" % (get_election_url(election),cast_vote.vote_hash[:10]) else: @@ -1034,7 +1034,7 @@ def voters_list_pretty(request, election): if election.use_voter_aliases: voters = voters.filter(alias__icontains = q) else: - voters = voters.filter(name__icontains = q) + voters = voters.filter(voter_name__icontains = q) voter_paginator = Paginator(voters, limit) voters_page = voter_paginator.page(page) diff --git a/reset.sh b/reset.sh index 46de573b7081eb87b8e4ce59cae9a71ddeb65d7d..c409b735f33ecd741ffc0a7664f593ea29eab05f 100755 --- a/reset.sh +++ b/reset.sh @@ -3,4 +3,4 @@ dropdb helios createdb helios python manage.py syncdb python manage.py migrate -echo "from auth.models import User; User.objects.create(user_type='google',user_id='ben@adida.net', info={})" | python manage.py shell \ No newline at end of file +echo "from auth.models import User; User.objects.create(user_type='google',user_id='ben@adida.net', info={'name':'Ben Adida'})" | python manage.py shell \ No newline at end of file