Skip to content
Snippets Groups Projects
Unverified Commit 16a6de58 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

[DJ1.9] Remove warning of not declaring explicit app_label

Example:

RemovedInDjango19Warning: Model class helios.models.Voter doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.

(cherry picked from commit 693acef9e4c3b093d5bf2bc1655e6f53a6dd4007)
parent fb7f98fd
No related branches found
No related tags found
No related merge requests found
from django.apps import AppConfig
class HeliosConfig(AppConfig):
name = 'helios'
verbose_name = "Helios"
......@@ -145,6 +145,9 @@ class Election(HeliosModel):
# downloadable election info
election_info_url = models.CharField(max_length=300, null=True)
class Meta:
app_label = 'helios'
# metadata for the election
@property
def metadata(self):
......@@ -650,6 +653,7 @@ class Election(HeliosModel):
return prettified_result
class ElectionLog(models.Model):
"""
a log of events for an election
......@@ -663,6 +667,9 @@ class ElectionLog(models.Model):
log = models.CharField(max_length=500)
at = models.DateTimeField(auto_now_add=True)
class Meta:
app_label = 'helios'
##
## UTF8 craziness for CSV
##
......@@ -702,6 +709,9 @@ class VoterFile(models.Model):
processing_finished_at = models.DateTimeField(auto_now_add=False, null=True)
num_voters = models.IntegerField(null=True)
class Meta:
app_label = 'helios'
def itervoters(self):
if self.voter_file_content:
if type(self.voter_file_content) == unicode:
......@@ -780,7 +790,6 @@ class VoterFile(models.Model):
return num_voters
class Voter(HeliosModel):
election = models.ForeignKey(Election)
......@@ -813,6 +822,7 @@ class Voter(HeliosModel):
class Meta:
unique_together = (('election', 'voter_login_id'))
app_label = 'helios'
def __init__(self, *args, **kwargs):
super(Voter, self).__init__(*args, **kwargs)
......@@ -1003,6 +1013,9 @@ class CastVote(HeliosModel):
# auditing purposes, like too many votes from the same IP, if it isn't expected
cast_ip = models.GenericIPAddressField(null=True)
class Meta:
app_label = 'helios'
@property
def datatype(self):
return self.voter.datatype.replace('Voter', 'CastVote')
......@@ -1091,6 +1104,9 @@ class AuditedBallot(models.Model):
vote_hash = models.CharField(max_length=100)
added_at = models.DateTimeField(auto_now_add=True)
class Meta:
app_label = 'helios'
@classmethod
def get(cls, election, vote_hash):
return cls.objects.get(election = election, vote_hash = vote_hash)
......@@ -1108,6 +1124,7 @@ class AuditedBallot(models.Model):
return query
class Trustee(HeliosModel):
election = models.ForeignKey(Election)
......@@ -1140,6 +1157,7 @@ class Trustee(HeliosModel):
class Meta:
unique_together = (('election', 'email'))
app_label = 'helios'
def save(self, *args, **kwargs):
"""
......
from django.apps import AppConfig
class HeliosAuthConfig(AppConfig):
name = 'helios_auth'
verbose_name = "Helios Authentication"
......@@ -35,6 +35,7 @@ class User(models.Model):
class Meta:
unique_together = (('user_type', 'user_id'),)
app_label = 'helios_auth'
@classmethod
def _get_type_and_id(cls, user_type, user_id):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment