Application Reference Document

The reference_document application handles the management of all the documents used in the EMERGEN-DB project.


The reference_document application contains one template :

  • reference_document.html : page that was structured to display all the reference documents (versions included) of the refrence documents.

Key files of the « reference_document » application

class apps.reference_document.admin.ExternalReportAdmin(model, admin_site)
class apps.reference_document.admin.ExternalReportCategoryAdmin(model, admin_site)

class apps.reference_document.models.ReferenceDocument(*args, **kwargs)

Reference document model table

exception DoesNotExist
exception MultipleObjectsReturned

The function returns the base name of a file.


The code is returning the base name of the file associated with the docfile attribute.

class apps.reference_document.models.ReferenceDocumentCategory(*args, **kwargs)

Reference document category model table

exception DoesNotExist
exception MultipleObjectsReturned

class apps.reference_document.tests.TestPage(methodName='runTest')

Hook method for setting up the test fixture before exercising it.


Hook method for deconstructing the test fixture after testing it.


The above function is a test case that checks the functionality of retrieving and sending reference documents in a web application.


The function ref_documents_page renders a template called « reference_documents.html » and passes a queryset of ReferenceDocumentCategory objects to the template context.


request – The request parameter is an object that represents the HTTP request made by the client. It contains information such as the request method, headers, user session, and more. It is typically passed to view functions in Django to handle the incoming request and generate an appropriate response


the rendered template « reference_document/reference_documents.html » with the context variable “ref_doc_cats”.

apps.reference_document.views.reference_document_send_file(response, filename)

The function sends a reference document file as a response.

  • response – The response parameter is the HTTP response object that will be used to send the file to the client

  • filename – The filename parameter is a string that represents the name of the file you want to send as a response


a FileResponse object.