From 78e208dcdbadd8daefaa0fc30e5b12cd8e4ad51a Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 7 Apr 2014 17:10:48 -0400 Subject: [PATCH] Use id instead of pk or checking for anonymous user --- awx/main/models/base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/awx/main/models/base.py b/awx/main/models/base.py index 691bafa5eb..dda2574369 100644 --- a/awx/main/models/base.py +++ b/awx/main/models/base.py @@ -14,7 +14,6 @@ from django.db import models from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from django.utils.timezone import now -from django.contrib.auth.models import AnonymousUser # Django-JSONField from jsonfield import JSONField @@ -291,7 +290,7 @@ class PrimordialModel(CreatedModifiedModel): def save(self, *args, **kwargs): update_fields = kwargs.get('update_fields', []) user = get_current_user() - if user and (user == AnonymousUser or not user.pk): + if user and not user.id: user = None if not self.pk and not self.created_by: self.created_by = user