Last active
September 13, 2018 09:51
-
-
Save maracuja/94ef95de32ff47d17dbe795ec15a5acb to your computer and use it in GitHub Desktop.
doc_uploads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| LOAN_PACKAGE_STEPS = [ | |
| ('la', 'LA',), | |
| ('ddq', 'DDQ'), | |
| ] | |
| class DocumentCategory(models.Model): | |
| name = models.CharField(max_length=255) | |
| short_name = models.CharField(max_length=255, db_index=True) | |
| parent = models.ForeignKey('lookups.DocumentCategory', blank=True, null=True) | |
| order = models.IntegerField() | |
| tags = models.TextField() | |
| class DocumentUpload(models.Model): | |
| file_name = models.CharField(max_length=255) | |
| file_type = models.ForeignKey('lookups.Option', related_name='file_type', db_index=True) | |
| refnum = models.CharField(max_length=11, blank=True, null=True, db_index=True) | |
| loan_package_step = models.CharField( | |
| choices=LOAN_PACKAGE_STEPS, max_length=40, | |
| help_text='At what point in the process was the document uploaded') | |
| question = models.CharField( | |
| max_length=255, blank=True, null=True, | |
| help_text='The label of the question the document was uploaded against') | |
| category = models.ForeignKey('lookups.DocumentCategory', related_name='category', blank=True, null=True) | |
| upload_file = models.FileField(upload_to='somewhere', max_length=150) | |
| created = models.DateTimeField(auto_now_add=True) | |
| modified = models.DateTimeField(auto_now=True, blank=True, null=True) | |
| def __unicode__(self): | |
| return self.file_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rest_framework.renderers import JSONRenderer | |
| class JSONAsPlainTextRenderer(JSONRenderer): | |
| """ | |
| Sends JSON as plain text (for IE compatibility) | |
| """ | |
| media_type = 'text/plain' | |
| class AbstractDocumentProxyAttachmentIEViewSet(AbstractDocumentProxyAttachmentViewSet): | |
| renderer_classes = (JSONAsPlainTextRenderer,) | |
| permission_classes = ['etc'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "docTypes": { | |
| {% option "Financial Information - Financial Records" "Document Types" as document_type %} | |
| "financial_statements": {{ document_type.pk|stringformat:"d" }}, | |
| "historical_budgets": {{ document_type.pk|stringformat:"d" }}, | |
| {% option "Commercial Information - Other Commercial Information" "Document Types" as document_type %} | |
| "customer_analysis": {{ document_type.pk|stringformat:"d" }}, | |
| "employee_breakdown": {{ document_type.pk|stringformat:"d" }}, | |
| "employee_cvs": {{ document_type.pk|stringformat:"d" }}, | |
| "industry_reports": {{ document_type.pk|stringformat:"d" }}, | |
| "market_share_analysis": {{ document_type.pk|stringformat:"d" }}, | |
| {% option "Legal Information - Key Contracts" "Document Types" as document_type %} | |
| "customer_contracts": {{ document_type.pk|stringformat:"d" }}, | |
| "supplier_contracts": {{ document_type.pk|stringformat:"d" }}, | |
| } |
Author
Author
Also check if we still need to implement an IE version of the API to spit everything out as plain text LOL@IE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm thinking maybe the
refnumandloan_package_stepare just text fields as it means retrieving the documents out of the DB is easily filterable, you can get everything for1-1234-5678or get everything for a1-1234-5678 and DDQ, if you upload a document through the doc library screen then it has noloan_package_step- i dunno just an ideaThe
upload_labelis intended to be the label of the field in the LA/DDQ that the document is being uploaded to, ie the employee CVs (see upload_label_examples.html)