Skip to content

Commit

Permalink
updated creation of system messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetaeye committed Jan 25, 2021
1 parent bbf5397 commit 61b45fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions freppledb/common/models.py
Expand Up @@ -886,8 +886,6 @@ class Meta:

@classmethod
def add(cls, msg, database=None):
admin = User.objects.get(username="admin")
ct = ContentType.objects.get_for_model(cls)
if database:
scenarios = [database]
else:
Expand All @@ -901,11 +899,13 @@ def add(cls, msg, database=None):
for db in scenarios:
c = Comment(
type="comment",
content_type=ct,
content_type=ContentType.objects.using(db).get(
app_label="common", model="systemmessage"
),
object_pk="",
object_repr="",
comment=msg,
user=admin,
user=User.objects.using(db).get(username="admin"),
processed=True,
)
c.save(using=db)
Expand Down

0 comments on commit 61b45fa

Please sign in to comment.