# Path: shortener/links/validators.py
# def validate_five_characters(value):
#     if len(value) < 5:
#         msg = u"Custom identifiers must have at least 5 characters"
#         raise ValidationError(msg)


from django.core.urlresolvers import reverse, NoReverseMatch
from django.db import models
from django.utils.baseconv import base64
from django.utils.translation import ugettext_lazy as _
from amazonify import amazonify
from model_utils.models import TimeStampedModel
from .validators import validate_five_characters




class Link(TimeStampedModel):

    original_url = models.CharField(_("URL to be shortened"), max_length=255, unique=True)
    identifier = models.CharField(_("Identifier"),
                                    max_length=100,
                                    blank=True,

# Path: shortener/links/validators.py
# def validate_five_characters(value):
#     if len(value) < 5:
#         msg = u"Custom identifiers must have at least 5 characters"
#         raise ValidationError(msg)


# Path: shortener/links/models.py
from django.core.urlresolvers import reverse, NoReverseMatch
from django.db import models
from django.utils.baseconv import base64
from django.utils.translation import ugettext_lazy as _
from amazonify import amazonify
from model_utils.models import TimeStampedModel
from .validators import validate_five_characters





class Link(TimeStampedModel):

    original_url = models.CharField(_("URL to be shortened"), max_length=255, unique=True)
    identifier = models.CharField(_("Identifier"),
                                    max_length=100,
                                    blank=True,

                                    validators=[validate_five_characters],