# Path: accounts/models.py
# class WhaleUser(User, AbstractBaseUser):
#     objects = WhaleUserManager()
#     email = models.EmailField(verbose_name=_('Email address *'), max_length=255, unique=True)
#     is_active = models.BooleanField(default=True)
#     is_admin = models.BooleanField(default=False)
# 
# 
#     USERNAME_FIELD = 'email'
#     REQUIRED_FIELDS = ['nickname']
# 
#     def get_full_name(self):
#         return self.nickname
# 
#     def get_short_name(self):
#         return self.nickname
# 
#     def __str__(self):             
#         return self.nickname
# 
# class User(PolymorphicModel):
# 
#     id = models.CharField(max_length=100, primary_key=True, default=uuid.uuid4, editable=False)
#     nickname = models.CharField(verbose_name=_('Nickname *'), max_length=30)
# 
# Path: accounts/models.py
# class WhaleUser(User, AbstractBaseUser):
#     objects = WhaleUserManager()
#     email = models.EmailField(verbose_name=_('Email address *'), max_length=255, unique=True)
#     is_active = models.BooleanField(default=True)
#     is_admin = models.BooleanField(default=False)
# 
# 
#     USERNAME_FIELD = 'email'
#     REQUIRED_FIELDS = ['nickname']
# 
#     def get_full_name(self):
#         return self.nickname
# 
#     def get_short_name(self):
#         return self.nickname
# 
#     def __str__(self):             
#         return self.nickname


import uuid
from datetime import date, timedelta
from django.db import models
from accounts.models import WhaleUser,User
from django.utils.translation import ugettext_lazy as _
from polymorphic.models import PolymorphicModel
from django.contrib.contenttypes.models import ContentType
from accounts.models import WhaleUser
            matrix = self.majority_margin_matrix()
            yield 'nbVoters', self.nb_voters()
            yield 'matrix', matrix
        else:
            yield 'votes', 'Unknown aggregation method: ' + aggregate


class Candidate(PolymorphicModel):
    poll = models.ForeignKey(VotingPoll,on_delete=models.CASCADE,related_name='candidates')
    candidate = models.CharField(max_length=50,verbose_name= _('candidate'))

    class Meta: 
        ordering=['id']

    def __str__(self):
        return str(self.candidate)


class DateCandidate(Candidate):
    date = models.DateField(verbose_name= _("date"))

    class Meta: 
        ordering=['date','id']

    def __str__(self):
        return str(self.date) + "#" + str(self.candidate)


class VotingScore(models.Model):
    candidate = models.ForeignKey(Candidate,on_delete=models.CASCADE)

# Path: accounts/models.py
# class WhaleUser(User, AbstractBaseUser):
#     objects = WhaleUserManager()
#     email = models.EmailField(verbose_name=_('Email address *'), max_length=255, unique=True)
#     is_active = models.BooleanField(default=True)
#     is_admin = models.BooleanField(default=False)
# 
# 
#     USERNAME_FIELD = 'email'
#     REQUIRED_FIELDS = ['nickname']
# 
#     def get_full_name(self):
#         return self.nickname
# 
#     def get_short_name(self):
#         return self.nickname
# 
#     def __str__(self):             
#         return self.nickname
# 
# class User(PolymorphicModel):
# 
#     id = models.CharField(max_length=100, primary_key=True, default=uuid.uuid4, editable=False)
#     nickname = models.CharField(verbose_name=_('Nickname *'), max_length=30)
# 
# Path: accounts/models.py
# class WhaleUser(User, AbstractBaseUser):
#     objects = WhaleUserManager()
#     email = models.EmailField(verbose_name=_('Email address *'), max_length=255, unique=True)
#     is_active = models.BooleanField(default=True)
#     is_admin = models.BooleanField(default=False)
# 
# 
#     USERNAME_FIELD = 'email'
#     REQUIRED_FIELDS = ['nickname']
# 
#     def get_full_name(self):
#         return self.nickname
# 
#     def get_short_name(self):
#         return self.nickname
# 
#     def __str__(self):             
#         return self.nickname


# Path: polls/models.py
import uuid
from datetime import date, timedelta
from django.db import models
from accounts.models import WhaleUser,User
from django.utils.translation import ugettext_lazy as _
from polymorphic.models import PolymorphicModel
from django.contrib.contenttypes.models import ContentType
from accounts.models import WhaleUser

            matrix = self.majority_margin_matrix()
            yield 'nbVoters', self.nb_voters()
            yield 'matrix', matrix
        else:
            yield 'votes', 'Unknown aggregation method: ' + aggregate


class Candidate(PolymorphicModel):
    poll = models.ForeignKey(VotingPoll,on_delete=models.CASCADE,related_name='candidates')
    candidate = models.CharField(max_length=50,verbose_name= _('candidate'))

    class Meta: 
        ordering=['id']

    def __str__(self):
        return str(self.candidate)


class DateCandidate(Candidate):
    date = models.DateField(verbose_name= _("date"))

    class Meta: 
        ordering=['date','id']

    def __str__(self):
        return str(self.date) + "#" + str(self.candidate)


class VotingScore(models.Model):
    candidate = models.ForeignKey(Candidate,on_delete=models.CASCADE)

    voter = models.ForeignKey(User,on_delete=models.CASCADE, verbose_name= _("voter"))