mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Fix AC-1155, make sure we check for anonymous user because that's what will come back through the rest api
This commit is contained in:
parent
064dd6dc08
commit
3876e06a8d
@ -14,6 +14,7 @@ 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
|
||||
@ -290,7 +291,7 @@ class PrimordialModel(CreatedModifiedModel):
|
||||
def save(self, *args, **kwargs):
|
||||
update_fields = kwargs.get('update_fields', [])
|
||||
user = get_current_user()
|
||||
if user and not user.pk:
|
||||
if user and (user == AnonymousUser or not user.pk):
|
||||
user = None
|
||||
if not self.pk and not self.created_by:
|
||||
self.created_by = user
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user