To create documents programmatically, the following must be done:
Have the initial parameters, path of the binary and title. If the document to be created has no binary, path can contain the empty string.
path = '/var/www/athentose/media/uploads/ejemplo.pdf'
title = 'Ejemplo titulo.pdf'
Have the space and type of document available:
serie = Serie.objects.get(name='facturas')
doctype = DocumentType.objects.get(name='tipo_factura')
Create the document
doc = serie.load_file(path, title, doctype)
The returned object shall be a document (File entity).
Comments
0 comments
Please sign in to leave a comment.