mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 08:15:27 +01:00
fixes #125
This commit is contained in:
parent
0b7ffa31d1
commit
4f14e0f425
2 changed files with 21 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ from django.contrib.admin.models import ADDITION, LogEntry
|
|||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models, DatabaseError
|
||||
from django.db.models import Q
|
||||
from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
from filelock import FileLock
|
||||
|
|
@ -121,11 +122,14 @@ def set_tags(sender,
|
|||
classifier=None,
|
||||
replace=False,
|
||||
**kwargs):
|
||||
|
||||
if replace:
|
||||
document.tags.clear()
|
||||
current_tags = set([])
|
||||
else:
|
||||
current_tags = set(document.tags.all())
|
||||
document.tags.exclude(
|
||||
Q(is_inbox_tag=True) |
|
||||
(Q(match="") & ~Q(matching_algorithm=Tag.MATCH_AUTO))
|
||||
).delete()
|
||||
|
||||
current_tags = set(document.tags.all())
|
||||
|
||||
matched_tags = matching.match_tags(document.content, classifier)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue