This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
You also need to create initial migration for guardian app! | |
""" | |
from django.contrib.contenttypes.models import ContentType | |
from guardian.models import UserObjectPermission, GroupObjectPermission | |
def is_user(obj): | |
return obj._meta.model_name == 'user' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
fmt = '%Y%m%d%H%M%S' # ex. 20110104172008 -> Jan. 04, 2011 5:20:08pm | |
now_str = datetime.datetime.now().strftime(fmt) | |
now_datetime = datetime.datetime.strptime(now_str, fmt) |