diff options
Diffstat (limited to '')
-rw-r--r-- | archivist/model.py | 2 | ||||
-rw-r--r-- | archivist/prefixes.py | 5 |
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 |