summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2017-03-12 16:32:07 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2017-03-12 16:32:07 +0100
commit577085c1660f9584d224b89e41324e5433d479a8 (patch)
tree0a08d8cad18aa03a9a5693f483a455b900d79a5a
parent2a5bb9afb2cea4e10aae0e3187e5361869e4109c (diff)
downloadarchivist-577085c1660f9584d224b89e41324e5433d479a8.tar.gz
archivist-577085c1660f9584d224b89e41324e5433d479a8.tar.bz2
archivist-577085c1660f9584d224b89e41324e5433d479a8.zip
Removed description, added name; also as special prefix
-rw-r--r--archivist/model.py2
-rw-r--r--archivist/prefixes.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/archivist/model.py b/archivist/model.py
index 6d452b4..56ef89e 100644
--- a/archivist/model.py
+++ b/archivist/model.py
@@ -76,7 +76,7 @@ class Document(BaseModel):
content = ForeignKeyField(DocumentContent, related_name = 'document')
created = DateField(default=datetime.date.today)
inserted = DateTimeField(default=datetime.datetime.now)
- description = CharField(null=True)
+ name = CharField(null=True)
original_path = CharField(null=True)
mimetype = CharField(null=True)
direction = EnumField(Direction, null=True)
diff --git a/archivist/prefixes.py b/archivist/prefixes.py
index c85d833..5e28207 100644
--- a/archivist/prefixes.py
+++ b/archivist/prefixes.py
@@ -19,6 +19,7 @@ def _create_prefixes():
FieldPseudoPrefix('direction', 'In- or outgoing', Document.direction)
FieldPseudoPrefix('date', 'Date of creation', Document.created)
FieldPseudoPrefix('mime', 'Mime Type', Document.mimetype)
+ ContainsFieldPseudoPrefix('name', 'Name/description of document', Document.name)
for part in ('day', 'month', 'year'):
FieldPartPseudoPrefix(part, part.capitalize() + ' of creation', Document.created, part)
@@ -61,6 +62,10 @@ class FieldPseudoPrefix(PseudoPrefix):
def as_query(self, value):
return self._field == value
+class ContainsFieldPseudoPrefix(FieldPseudoPrefix):
+ def as_query(self, value):
+ return self._field.contains(value)
+
class FieldPartPseudoPrefix(PseudoPrefix):
def __init__(self, name, description, field, part):
self._field = field