from django.db import models


class DBMutex(models.Model):
    """
    Models a mutex lock with a ``lock_id`` and a ``creation_time``.

    :type lock_id: str
    :param lock_id: A unique CharField with a max length of 256

    :type creation_time: datetime
    :param creation_time: The creation time of the mutex lock
    """
    lock_id = models.CharField(max_length=256, unique=True)
    creation_time = models.DateTimeField(auto_now_add=True)

from django.db import models


class DBMutex(models.Model):
    """
    Models a mutex lock with a ``lock_id`` and a ``creation_time``.

    :type lock_id: str
    :param lock_id: A unique CharField with a max length of 256

    :type creation_time: datetime
    :param creation_time: The creation time of the mutex lock
    """
    lock_id = models.CharField(max_length=256, unique=True)
    creation_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        app_label = 'db_mutex'

Declare app_label in model Meta class to work with Django 1.9
Declare app_label in model Meta class to work with Django 1.9

Fixes RemovedInDjango19Warning:

Model class db_mutex.models.DBMutex 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.

Credit: https://github.com/minervaproject/django-db-mutex/commit/429d701cce7ad2cf8fb77f169c4af6f2f27562fd
