Application Reference Document¶
The reference_document application handles the management of all the documents used in the EMERGEN-DB project.
Templates¶
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¶
admin.py¶
- class apps.reference_document.admin.ExternalReportAdmin(model, admin_site)¶
- class apps.reference_document.admin.ExternalReportCategoryAdmin(model, admin_site)¶
model.py¶
- class apps.reference_document.models.ReferenceDocument(*args, **kwargs)¶
Reference document model table
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- filename()¶
The function returns the base name of a file.
- Renvoie
The code is returning the base name of the file associated with the docfile attribute.
test.py¶
- class apps.reference_document.tests.TestPage(methodName='runTest')¶
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- tearDown()¶
Hook method for deconstructing the test fixture after testing it.
- test_ref_documents()¶
The above function is a test case that checks the functionality of retrieving and sending reference documents in a web application.
view.py¶
- apps.reference_document.views.ref_documents_page(request)¶
The function ref_documents_page renders a template called « reference_documents.html » and passes a queryset of ReferenceDocumentCategory objects to the template context.
- Paramètres
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
- Renvoie
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.
- Paramètres
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
- Renvoie
a FileResponse object.