Models

class document_catalogue.models.Document(*args, **kwargs)[source]

A file and the meta-data describing that file in the catalogue.

exception DoesNotExist
exception MultipleObjectsReturned
class PrivateFileField(*args, **kwargs)

Filefield with private storage, custom filename and size checks.

Extra settings: - upload_subfolder: a lambda to find the subfolder, depending on the instance. - content_types: list of allowed content types. - max_file_size: maximum file size.

clean(*args, **kwargs)

Convert the value’s type and run validation. Validation errors from to_python() and validate() are propagated. Return the correct value if no error is raised.

generate_filename(instance, filename)

Apply (if callable) or prepend (if a string) upload_to to the filename, then delegate further processing of the name to the storage backend. Until the storage layer, all file paths are expected to be Unix style (with forward slashes).

class document_catalogue.models.DocumentCategory(*args, **kwargs)[source]

A hierarchical category system for assets

exception DoesNotExist
exception MultipleObjectsReturned
get_document_count()[source]

Return the total number of documents uploaded for this category

has_children()[source]

Return true if this DocumentCategory has dependent objects lower in the hierarchy

class document_catalogue.models.DocumentManager[source]

Manager for Document model with all methods from DocumentQuerySet.

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

class document_catalogue.models.DocumentQueryset(model=None, query=None, using=None, hints=None)[source]

Custom query set for Document model

class document_catalogue.models.PublishedDocumentManager[source]

Published documents only

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

document_catalogue.models.document_upload_path_callback(instance, filename)[source]

Dynamic upload path based on file instance