Bases: openPLM.plmapp.controllers.plmobject.PLMObjectController
A PLMObjectController which manages Document
It provides methods to add or delete files, (un)lock them and attach a Document to a Part.
Returns True if settings.ENABLE_NATIVE_FILE_MANAGEMENT is True and exists a document that contains a standard locked file related to the file we want to add.
We use it to avoid to add a native file while a related standard locked file is present in the document.
Paramètres: | new_filename – name of the added file |
---|
Lock doc_file so that it can not be modified or deleted if doc_file has a native related file this will be deprecated
Exceptions raised: | |
---|---|
|
|
Paramètres: | doc_file (DocumentFile) – |
Unlock doc_file so that it can be modified or deleted
Exceptions raised: | |
---|---|
|
|
Paramètres: | doc_file (DocumentFile) – |
Adds file f to the document. f should be a File with an attribute name (like an UploadedFile).
If update_attributes is True (the default), handle_added_file() will be called with f as parameter.
Retourne: | the DocumentFile created. |
---|---|
Raises : | PermissionError if _user is not the owner of object |
Raises : | PermissionError if object is not editable. |
Raises : | ValueError if the file size is superior to settings.MAX_FILE_SIZE |
Raises : | ValueError if we try to add a native file while a relate standar file locked is present in the Document |
Sets thumnail_file as the thumbnail of doc_file. thumbnail_file should be a File with an attribute name (like an UploadedFile).
Exceptions raised: | |
---|---|
|
Deletes doc_file, the file attached to doc_file is physically removed.
Exceptions raised: | |
---|---|
|
|
Paramètres: | doc_file (DocumentFile) – the file to be deleted |
Method called when adding a file (method add_file()) with updates_attributes set to True.
This method may be overridden to updates attributes with data from doc_file. The default implementation does nothing.
Paramètres: | doc_file (DocumentFile) – |
---|
Returns a QuerySet of parts a user may want to attach to a future revision.
Updates doc_file with data from new_file. doc_file.thumbnail is deleted if it is present.
Exceptions raised: | |
---|---|
|
|
Paramètres: |
|
Updates related part informations with data from formset
Paramètres: | formset (a modelfactory_formset of ModifyRelPartForm) – |
---|
Updates uploaded file informations with data from formset
Paramètres: | formset (a modelfactory_formset of ModifyFileForm) – |
---|---|
Raises : | PermissionError if _user is not the owner of object |
Raises : | PermissionError if object is not editable. |
Cancels the object:
Clones the object :
- calls PLMObjectController.clone()
- duplicates all DocumentFile in self.object
Paramètres: | parts – list of Part selected to be attached to the new document |
---|