# -*- coding: utf-8 -*-
from datetime import datetime

from django.db import models
from django.utils.translation import gettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class ACL(models.Model):
    acl_list = {}
    resource = models.CharField(
        _("Resource name"),
        max_length=255,
        db_index=True,
    )
    display = models.CharField(
        _("displayed name"),
        max_length=255,
        null=True,
        blank=True,
    )
    created_at = models.DateTimeField(
        _("Creation time"),
        default=datetime.now(),
    )
    is_available = models.BooleanField(
        _("Is available to assign"),
        default=True,
    )

    class Meta:
        app_label = 'yaacl'

    def __str__(self):
        if self.display:
            return "%s (%s)" % (self.display, self.resource)
        else:
            return self.resource

# -*- coding: utf-8 -*-
from datetime import datetime

from django.db import models
from django.utils.translation import gettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class ACL(models.Model):
    acl_list = {}
    resource = models.CharField(
        _("Resource name"),
        max_length=255,
        db_index=True,
    )
    display = models.CharField(
        _("displayed name"),
        max_length=255,
        null=True,
        blank=True,
    )
    created_at = models.DateTimeField(
        _("Creation time"),
        auto_now_add=True,
    )
    is_available = models.BooleanField(
        _("Is available to assign"),
        default=True,
    )

    class Meta:
        app_label = 'yaacl'

    def __str__(self):
        if self.display:
            return "%s (%s)" % (self.display, self.resource)
        else:
            return self.resource

Use `auto_now_add` to make ACL.created_at timezone aware
Use `auto_now_add` to make ACL.created_at timezone aware
