# Path: endorsements/models.py
# class Candidate(models.Model):
#     endorser_link = models.OneToOneField(Endorser)
#     name = models.CharField(max_length=50)
#     description = models.TextField()
#     color = models.CharField(max_length=6)
#     rgb = models.CharField(max_length=13)
#     still_running = models.BooleanField(default=False)
#     position = models.OneToOneField('Position', blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Endorsement(models.Model):
#     endorser = models.ForeignKey(Endorser)
#     quote = models.ForeignKey(Quote)
#     position = models.ForeignKey(Position)
#     confirmed = models.BooleanField(default=True)
#     notes = models.TextField(null=True, blank=True)
# 
#     class Meta:
#         ordering = ['-quote']
# 
#     def get_date(self):
#         return self.quote.date
# 
#     def __unicode__(self):
#         return unicode(self.position)
# 
#     def get_truncated_quote(self):
#         if len(self.quote.text) > 100:
#             return self.quote.text[:100] + '...'
#         else:
#             return self.quote.text
# 
# class Source(models.Model):
#     date = models.DateField(null=True, blank=True)
#     url = models.URLField(unique=True, blank=True, max_length=300)
#     name = models.CharField(max_length=100, default='')
# 
#     class Meta:
#         ordering = ['url', '-date']
# 
#     def get_date_display(self):
#         if self.date:
#             return self.date.strftime('%b %d, %Y')
# 
#     def __unicode__(self):
#         return "{url} on {date}".format(
#             url=self.url,
#             date=self.date,
#         )
# 
# class Position(models.Model):
#     colour = models.CharField(max_length=20, blank=True)
#     past_tense_prefix = models.CharField(max_length=10, blank=True)
#     present_tense_prefix = models.CharField(max_length=10, blank=True)
#     suffix = models.CharField(max_length=30)
#     slug = models.SlugField()
#     show_on_load = models.BooleanField(default=False)
# 
#     def __unicode__(self):
#         return self.get_name_display()
# 
#     def get_name_display(self):
#         if self.present_tense_prefix:
#             return "{present} {suffix}".format(
#                 present=self.present_tense_prefix,
#                 suffix=self.suffix
#             )
#         else:
#             return self.suffix
# 
#     def get_present_display(self):
#         if self.present_tense_prefix:
#             return self.present_tense_prefix + ' ' + self.suffix
#         else:
#             return self.suffix
# 
#     def get_past_display(self):
#         if self.past_tense_prefix:
#             return self.past_tense_prefix + ' ' + self.suffix
#         else:
#             return self.suffix
# 
# class Tag(models.Model):
#     name = models.CharField(max_length=50)
#     description = models.TextField(blank=True)
#     is_personal = models.BooleanField(default=True)
#     category = models.ForeignKey(Category, null=True, blank=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     class Meta:
#         ordering = ['name']
# 
#     def get_mode(self):
#         allow_personal = self.category.allow_personal
#         allow_org = self.category.allow_org
#         if allow_personal and allow_org:
#             return 'none'
#         elif allow_personal:
#             return 'personal'
#         else:
#             return 'organization'
# 
# class Event(models.Model):
#     name = models.CharField(max_length=50)
#     description = models.TextField(blank=True)
#     start_date = models.DateField()
#     end_date = models.DateField()
# 
#     def __unicode__(self):
#         return self.name


from django import forms
from endorsements.models import Candidate, Endorsement, Source, Position, \
                                Tag, Event



class Html5DateInput(forms.DateInput):
    input_type = 'date'


class SourceForm(forms.ModelForm):
    class Meta:
        model = Source
        exclude = ('name',)
        widgets = {
            'date': Html5DateInput(),
        }


class PersonalTagForm(forms.Form):
    tag = forms.ModelChoiceField(

# Path: endorsements/models.py
# class Candidate(models.Model):
#     endorser_link = models.OneToOneField(Endorser)
#     name = models.CharField(max_length=50)
#     description = models.TextField()
#     color = models.CharField(max_length=6)
#     rgb = models.CharField(max_length=13)
#     still_running = models.BooleanField(default=False)
#     position = models.OneToOneField('Position', blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Endorsement(models.Model):
#     endorser = models.ForeignKey(Endorser)
#     quote = models.ForeignKey(Quote)
#     position = models.ForeignKey(Position)
#     confirmed = models.BooleanField(default=True)
#     notes = models.TextField(null=True, blank=True)
# 
#     class Meta:
#         ordering = ['-quote']
# 
#     def get_date(self):
#         return self.quote.date
# 
#     def __unicode__(self):
#         return unicode(self.position)
# 
#     def get_truncated_quote(self):
#         if len(self.quote.text) > 100:
#             return self.quote.text[:100] + '...'
#         else:
#             return self.quote.text
# 
# class Source(models.Model):
#     date = models.DateField(null=True, blank=True)
#     url = models.URLField(unique=True, blank=True, max_length=300)
#     name = models.CharField(max_length=100, default='')
# 
#     class Meta:
#         ordering = ['url', '-date']
# 
#     def get_date_display(self):
#         if self.date:
#             return self.date.strftime('%b %d, %Y')
# 
#     def __unicode__(self):
#         return "{url} on {date}".format(
#             url=self.url,
#             date=self.date,
#         )
# 
# class Position(models.Model):
#     colour = models.CharField(max_length=20, blank=True)
#     past_tense_prefix = models.CharField(max_length=10, blank=True)
#     present_tense_prefix = models.CharField(max_length=10, blank=True)
#     suffix = models.CharField(max_length=30)
#     slug = models.SlugField()
#     show_on_load = models.BooleanField(default=False)
# 
#     def __unicode__(self):
#         return self.get_name_display()
# 
#     def get_name_display(self):
#         if self.present_tense_prefix:
#             return "{present} {suffix}".format(
#                 present=self.present_tense_prefix,
#                 suffix=self.suffix
#             )
#         else:
#             return self.suffix
# 
#     def get_present_display(self):
#         if self.present_tense_prefix:
#             return self.present_tense_prefix + ' ' + self.suffix
#         else:
#             return self.suffix
# 
#     def get_past_display(self):
#         if self.past_tense_prefix:
#             return self.past_tense_prefix + ' ' + self.suffix
#         else:
#             return self.suffix
# 
# class Tag(models.Model):
#     name = models.CharField(max_length=50)
#     description = models.TextField(blank=True)
#     is_personal = models.BooleanField(default=True)
#     category = models.ForeignKey(Category, null=True, blank=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     class Meta:
#         ordering = ['name']
# 
#     def get_mode(self):
#         allow_personal = self.category.allow_personal
#         allow_org = self.category.allow_org
#         if allow_personal and allow_org:
#             return 'none'
#         elif allow_personal:
#             return 'personal'
#         else:
#             return 'organization'
# 
# class Event(models.Model):
#     name = models.CharField(max_length=50)
#     description = models.TextField(blank=True)
#     start_date = models.DateField()
#     end_date = models.DateField()
# 
#     def __unicode__(self):
#         return self.name


# Path: endorsements/forms.py
from django import forms
from endorsements.models import Candidate, Endorsement, Source, Position, \
                                Tag, Event




class Html5DateInput(forms.DateInput):
    input_type = 'date'


class SourceForm(forms.ModelForm):
    class Meta:
        model = Source
        exclude = ('name',)
        widgets = {
            'date': Html5DateInput(),
        }


class PersonalTagForm(forms.Form):
    tag = forms.ModelChoiceField(

        Tag.objects.filter(is_personal=True)