# Path: common/mixins.py
# class TimestampMixin(models.Model):
#     """Mixin for date and timestamp. Inherits django's models.Model."""
# 
#     date_created = models.DateTimeField(auto_now_add=True)
#     date_modified = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         abstract = True
# 
# Path: common/utils.py
# def timestamp_seconds():
#     global LAST_TIMESTAMP
# 
#     timestamp = int(time())
#     LAST_TIMESTAMP = (LAST_TIMESTAMP + 1) if timestamp <= LAST_TIMESTAMP else timestamp
# 
#     return LAST_TIMESTAMP


from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from hashid_field import HashidField
from common.mixins import TimestampMixin
from common.utils import timestamp_seconds
from __future__ import unicode_literals





class ApiKey(TimestampMixin):
    """Model representing clients' api keys."""

    token = HashidField(
        min_length=32,
        alphabet='0123456789abcdef',

# Path: common/mixins.py
# class TimestampMixin(models.Model):
#     """Mixin for date and timestamp. Inherits django's models.Model."""
# 
#     date_created = models.DateTimeField(auto_now_add=True)
#     date_modified = models.DateTimeField(auto_now=True)
# 
#     class Meta:
#         abstract = True
# 
# Path: common/utils.py
# def timestamp_seconds():
#     global LAST_TIMESTAMP
# 
#     timestamp = int(time())
#     LAST_TIMESTAMP = (LAST_TIMESTAMP + 1) if timestamp <= LAST_TIMESTAMP else timestamp
# 
#     return LAST_TIMESTAMP


# Path: app/api/models.py
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _
from hashid_field import HashidField
from common.mixins import TimestampMixin
from common.utils import timestamp_seconds

from __future__ import unicode_literals





class ApiKey(TimestampMixin):
    """Model representing clients' api keys."""

    token = HashidField(
        min_length=32,
        alphabet='0123456789abcdef',

        default=timestamp_seconds,