Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #340 from CkuT/issue_334
Browse files Browse the repository at this point in the history
Fix LogEntry user when PAPERLESS_DISABLE_LOGIN is set to true
  • Loading branch information
danielquinn committed Apr 22, 2018
2 parents b733b32 + 3aafabb commit 00fd226
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/documents/migrations/0019_add_consumer_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-07-15 17:12
from __future__ import unicode_literals

from django.contrib.auth.models import User
from django.db import migrations


def forwards_func(apps, schema_editor):
User.objects.create(username="consumer")


def reverse_func(apps, schema_editor):
User.objects.get(username="consumer").delete()


class Migration(migrations.Migration):

dependencies = [
('documents', '0018_auto_20170715_1712'),
]

operations = [
migrations.RunPython(forwards_func, reverse_func),
]
2 changes: 1 addition & 1 deletion src/documents/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def cleanup_document_deletion(sender, instance, using, **kwargs):
def set_log_entry(sender, document=None, logging_group=None, **kwargs):

ct = ContentType.objects.get(model="document")
user = User.objects.first()
user = User.objects.get(username="consumer")

LogEntry.objects.create(
action_flag=ADDITION,
Expand Down
2 changes: 1 addition & 1 deletion src/documents/tests/test_matchables.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class TestDocumentConsumptionFinishedSignal(TestCase):

def setUp(self):
TestCase.setUp(self)
User.objects.create_user(username='testuser', password='12345')
User.objects.create_user(username='test_consumer', password='12345')
self.doc_contains = Document.objects.create(
content="I contain the keyword.", file_type="pdf")

Expand Down

0 comments on commit 00fd226

Please sign in to comment.