Contents
Get type, reference and revision of an object and return the related controller
Paramètres: |
|
---|---|
Retourne: | a PLMObjectController or a UserController |
Decorator which makes sure URL is accessed over https.
Decorator which converts the result from func into a json response.
The result from func must be serializable by json
This decorator automatically adds a result field to the response if it was not present. Its value is 'ok' if no exception was raised, and else, it is 'error'. In that case, a field 'error' is added with a short message describing the exception.
Returns an adequate controller for the object identify by obj_id. The returned controller is instanciate with user as the user who modify the object.
Paramètres: |
|
---|---|
Retourne: | a subinstance of a PLMObjectController |
Returns an adequate controller for the object identify by form. The returned controller is instanciate with user as the user who modify the object.
Paramètres: |
|
---|---|
Retourne: | a subinstance of a PLMObjectController |
Returns a dictionary representing plmobject. The returned dictionary respects the format described in Object fields
Decorators which ensures that the user is connected and handles exceptions raised by a controller.
If an exception of type django.http.Http404 is raised, the exception is re-raised.
If an exception of type ControllerError is raised, a django.http.HttpResponse is returned with an explanation message.
If settings.DEBUG is False and another exception is raised, a django.http.HttpResponseServerError is returned.
Initiate the context dictionnary we used to transfer parameters to html pages. Get type, reference and revision of an object and return a dictionnary with them plus current time, settings.THUMBNAILS_URL the begining of the URL to get thumbnail of a file and settings.LANGUAGES.
Example:
>>> init_ctx('BiosOs','BI-0044','1.4.3')
{'THUMBNAILS_URL': '/media/thumbnails',
'object_reference': 'BI-0044',
'object_revision': '1.4.3',
'object_type': 'BiosOs'}
Paramètres: | |
---|---|
Retourne: | a dictionnary |
Get a request and return a controller, a context dictionnary with elements common to all pages (search form, search data, search results, ...) and another dictionnary to update the request.session dictionnary.
Paramètres: |
|
---|---|
Retourne: | |
Retourne: | ctx |
Retourne: | request.session |
Register a creation view for type_ (a subclass of PLMObject).
Most of the applications does not need to call this function which is available for special cases which cannot be handled by create_object().
Note
You must ensure that the module that calls this function has been imported. For example, you can import it in your urls.py file.
Returns a registed view for type_ (a subclass of PLMObject) or None if no views are registered.
Get informations to display in the id-cards of all Document which id is in doc_ids
Paramètres: | doc_ids – list of Document ids to treat |
---|---|
Retourne: | a dictionary which contains the following data
|
Ajax views.
Simple view which returns the html of a creation form with the data of request.GET as initial values.
The request must contains a get parameter type with a valid type, otherwise, a HttpResponseForbidden is returned.
Simple ajax view for JQquery.UI.autocomplete. This returns the possible completions (in JSON format) for field. The request must contains a get parameter named term which should be the string used to filter the results. obj_type must be a valid typename.
Paramètres: |
---|
Ajax view to get files and thumbnails of a document.
Paramètres: |
|
---|
Ajax view to get an HTML preview of a raw content (in richtext syntax).
GET paramerer:
- content
- raw content to be rendered
This view returns a JSON response with one key, html, the rendered content that can be included in a div element.
This modules contains all stuff related to the api
Voir aussi
The public api http_api,
Version of the API (value: '1.1')
Decorator whichs requires that the user is login
Helper function for api_login_required()
Decorator which requires a login user and converts returned value into a json response.
This also checks if the user agent is "openplm" and, if not, returns a 403 HTTP RESPONSE.
Returns all the subtypes of PLMObject managed by the server.
Implements : | http_api.types() |
---|
Returns all the types of Document managed by the server.
Implements : | http_api.docs() |
---|
Returns all the types of Part managed by the server.
Implements : | http_api.parts() |
---|
Returns all objects matching a query.
Paramètres: |
|
---|---|
Implements : |
Creates a PLMObject and returns it
Implements : | http_api.create() |
---|
Returns the list of files of the Document identified by doc_id. If all_files is False (the default), only unlocked files are returned.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
files, a list of files (see File fields) |
Locks the DocumentFile identified by df_id from the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
None |
Checks-in the DocumentFile identified by df_id from the Document identified by doc_id
Implements : | http_api.check_in() |
---|---|
Paramètres: |
|
Returned fields: | |
None |
Returns True if the DocumentFile identified by df_id from the Document identified by doc_id is locked.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
locked, True if the file is locked. |
Unlocks the DocumentFile identified by df_id from the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
None |
Converts field (a django FormField) to a type as described in Available types.
Returns a list of fields from form converted to the format described in Query fields.
Returns search fields associated to typename.
Implements : | http_api.search_fields() |
---|
Returns creation fields associated to typename
Implements : | http_api.creation_fields() |
---|
Authenticates the user
Implements : | http_api.login() |
---|
Tests if user is authenticated
Implement : | http_api.testlogin() |
---|
Returns a possible new revision for the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
revision, the new revision (may be an empty string) |
Voir aussi
utils.get_next_revision() for possible results
Makes a new revision of the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
|
Returns True if the Document identified by doc_id can be revised.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
revisable, True if it can be revised |
Links the Document identified by doc_id with the Part identified by part_id.
Implements : | |
---|---|
Paramètres: | |
Returned fields: | |
None |
Adds a file to the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
doc_file, the file that has been had, see File fields. |
Adds a thumbnail to the DocumentFile identified by df_id from the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
None |
Introduit dans la version 1.3.
Returns basic fields of the PLMObject identified by obj_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
object, a dictionary of object fields |
Introduit dans la version 1.3.
Returns parts attached to the Document identified by doc_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
parts, a list of dictionaries describing attached parts |
Introduit dans la version 1.3.
Returns documents attached to the Part identified by part_id.
Implements : | |
---|---|
Paramètres: |
|
Returned fields: | |
documents, a list of dictionaries describing attached documents |
Introduit dans la version 1.3.
Locks several files in one transactional block.
Files are set by a POST parameter, files which must be a json list of ids of DocumentFile to be locked.
If one file can not be locked, no files are locked.
Implements : | http_api.lock_files() |
---|
This module contains all “html” views, i.e. views that renders an HTML page from a standard (not ajax) HTTP request. Ajax views are in ajax and API views are in api
Most of the views are decorated with handle_errors() and render HTML with the django template engine.
A wrapper arround django.views.i18n.set_language() that stores the language in the user profile.
Home page view.
Url : | /home/ |
---|
Template:
home.html
Context:
RequestContext
Attributes view of the given object.
Url : | /object/obj_type/obj_ref/obj_revi/attributes/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
attribute.html
Context:
RequestContext
Generic object view.
Permanently redirects to the attribute page of the given object if it is a part, a user or a group and to the files page if it is a document.
Url : | /object/obj_type/obj_ref/obj_revi/ |
---|
Redirects to the history page that contains the history item numbered hid.
History view.
This view displays a history of the selected object and its revisions.
Url : | /object/obj_type/obj_ref/obj_revi/history/ |
---|---|
Url : | /user/username/history/ |
Url : | /group/group_name/history/ |
Url : | /timeline/ |
Paramètres: |
|
---|---|
Retourne: |
Template:
history.html
Context:
RequestContext
View to create a PLMObject or a GroupInfo.
Url : | /object/create/ |
---|
Requests (POST and GET) must contain a type variable that validates a TypeForm.
POST requests must validate the creation form, fields depend on the given type. If the creation form is valid, an object is created and in case of success, this view redirects to the created object.
Requests may contain a __next__ variable. A successful creation will redirect to this URL. Some special strings are replaced:
- ##type## with the created object’s type
- ##ref## with the created object’s reference
- ##rev## with the created object’s reference
Requests may also contain other special variables (at most one of them):
- related_doc
- Id of a document. The created part will be attached to this document. Object’s type is restricted to part types. Two context variables (related_doc and related) are set to the document controller.
- related_part
- Id of a part. The created document will be attached to this part. Object’s type is restricted to document types. Two context variables (related_part and related) are set to the part controller.
- related_parent
- Id of a part. Object’s type is restricted to part types. Two context variables (related_parent and related) are set to the part controller.
Note
If from_registered_view is False, this view delegates its treatment to a registered view that handles creation of objects of the given type. (see get_creation_view() and register_creation_view())
Paramètres: |
|
---|
Template:
create.html
Context:
RequestContext
creation_form
Manage html page for the modification of the selected object. It computes a context dictionary based on
Paramètres: |
|
---|---|
Retourne: |
Manage html page which displays a graphical picture the different links between User and models.PLMObject. This function uses Graphviz (http://graphviz.org/). Some filters let user defines which type of links he/she wants to display. It computes a context dictionary based on
Paramètres: |
|
---|---|
Retourne: |
Manage page to import a csv file.
View that display a preview of an uploaded csv file.
Bases: haystack.views.SearchView
Bases: django.contrib.admin.filters.DateFieldListFilter
Introduit dans la version 1.1.
Public view of the given object, this view is accessible to anonymous users. The object must be a published part or document.
Redirects to the login page if the object is not published and the user is not authenticated.
Url : | /object/obj_type/obj_ref/obj_revi/public/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
public.html
Context:
RequestContext
Lifecycle data of the given object (a part or a document).
Url : | /object/obj_type/obj_ref/obj_revi/lifecycle/[apply/] |
---|
Paramètres: |
|
---|---|
Retourne: |
POST requests must have a “demote”, “promote”, “publish” or “unpublish” key and must validate the ConfirmPasswordForm form. If the form is valid, the object is promoted, demoted, published, unpublished according to the request.
Template:
lifecycle.html
Context:
RequestContext
Returns a dictionary containing lifecycle data of obj.
Dictionary content
Returns a dictionary containing management data for obj.
Paramètres: | user – User who runs the request |
---|
Dictionary content
If user does not own obj:
- is_notified
- True if user receives notifications when obj changes
- remove_notify_link
- (set if is_notified is True) Notification PLMObjectUserLink between obj and user
- can_notify
- True if user can ask to receive notifications when obj changes
- notify_self_form
- (set if can_notify is True) form to notify user
View that displays the revisions of the given object (a part or a document) and shows a form to make a new revision.
Url : | /object/obj_type/obj_ref/obj_revi/revisions/ |
---|
Paramètres: |
|
---|---|
Retourne: |
This view returns the result of revise_document() if the object is a document and the result of revise_part() if the object is a part.
View to revise a document.
Paramètres: |
|
---|
This view can create a new revision of the document, it required the following POST parameters:
Post params: |
|
---|
A revised document may be attached to some parts. These parts are given by DocumentController.get_suggested_parts(). If there is at least one suggested part, a confirmation of which parts will be attached to the new document is required.
Template:
documents/revisions.html
Context:
RequestContext
View to revise a part.
Paramètres: |
|
---|
This view can create a new revision of the part, it required the following POST parameters:
Post params: |
|
---|
A revised part may be attached to some documents. These documents are given by PartController.get_suggested_documents(). A revised part may also have some children from the original revision. A revised part may also replace some parts inside a parent BOM. These parents are given by PartController.get_suggested_parents().
If there is at least one suggested object, a confirmation is required.
Template:
parts/revisions.html
Context:
RequestContext
View to replace a manager (owner, signer, reader...) by another one.
Url : | /object/obj_type/obj_ref/obj_revi/management/replace/link_id/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
management_replace.html
Context:
RequestContext
View to add a manager (notified user or restricted reader).
Url : | /object/obj_type/obj_ref/obj_revi/management/add/ |
---|
or
Url : | /object/obj_type/obj_ref/obj_revi/management/add-reader/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
management_replace.html
Context:
RequestContext
View to remove a notified user or a restricted user.
Url : | /object/obj_type/obj_ref/obj_revi/management/delete/ |
---|
The request must be a POST request containing the key link_id. It should be the id of one of the PLMObjectUserLink related to the object. The role of this link must be ROLE_NOTIFIED or ROLE_READER.
Redirects to /object/obj_type/obj_ref/obj_revi/management/lifecycle/ in case of a success.
View to download all files from a document/part.
Paramètres: |
|
---|---|
Retourne: |
Manage html page to display the cloning form of the selected object (part or document) or clone it.
Url : | /object/obj_type/obj_ref/obj_revi/clone/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
clone.html
Paramètres: | creation_form – the creation form that will be used to clone the object |
---|
If the object is a part :
Post params: |
|
---|
A cloned part may be attached to some documents. These documents are given by PartController.get_suggested_documents(). A cloned part may also have some children from the original revision.
If the object is a document :
Post params: |
|
---|
A cloned document may be attached to some parts, given by DocumentController.get_suggested_parts().
Context:
RequestContext
Analyze the formsets in data to return list of selected children and documents.
Paramètres: |
|
---|---|
Retourne: |
|
Analyze the formsets in data to return list of selected parts.
Paramètres: |
|
---|---|
Retourne: |
|
BOM view.
That view displays the children of the selected object that must be a part.
Url : | /object/obj_type/obj_ref/obj_revi/bom-child/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/bom.html
Context:
RequestContext
extension_data
View to edit a BOM.
Url : | /object/obj_type/obj_ref/obj_revi/bom-child/edit/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/bom_edit.html
Context:
RequestContext
View to replace a child by another one.
Url : | /object/obj_type/obj_ref/obj_revi/bom-child/replace/link_id/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/bom_replace.html
Context:
RequestContext
View to add a child to a part.
Url : | /object/obj_type/obj_ref/obj_revi/bom-child/add/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/bom_add.html
Context:
RequestContext
Parents view.
That view displays the parents of the selected object that must be a part.
Url : | /object/obj_type/obj_ref/obj_revi/parents/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/parents.html
Context:
RequestContext
Attached documents view.
That view displays the documents attached to the selected object that must be a part.
Url : | /object/obj_type/obj_ref/obj_revi/doc-cad/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/doccad.html
Context:
RequestContext
View to attach a document to a part.
Url : | /object/obj_type/obj_ref/obj_revi/doc-cad/add/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
parts/doccad_add.html
Context:
RequestContext
View to detach a document referred by the POST parameter plmobject.
Url : | /object/obj_type/obj_ref/obj_revi/doc-cad/delete/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Attached parts view.
That view displays the parts attached to the selected object that must be a document.
Url : | /object/obj_type/obj_ref/obj_revi/parts/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
documents/parts.html
Context:
RequestContext
View to attach a part to a document.
Url : | /object/obj_type/obj_ref/obj_revi/parts/add/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
documents/parts_add.html
Context:
RequestContext
View to detach a part referred by the POST parameter plmobject.
Url : | /object/obj_type/obj_ref/obj_revi/parts/delete/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Files view.
That view displays files of the given document.
Url : | /object/obj_type/obj_ref/obj_revi/files/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
documents/files.html
Context:
RequestContext
That view displays the form to upload a file.
Note
This view show a simple form (no javascript) and is here
Url : | /object/obj_type/obj_ref/obj_revi/files/add/ |
---|
Paramètres: |
|
---|---|
Retourne: |
Template:
documents/files_add_noscript.html
Context:
RequestContext
This view process the file(s) upload.
The upload is done asynchronously.
Url : | /object/obj_type/obj_ref/obj_revi/files/up/ |
---|
Paramètres: |
|
---|---|
Retourne: | |
Post params: |
|
Get params: | list of pair (filename, id) |
The response contains “failed” if the submitted form is not valid.
Show upload progress for a given progress_id
Url : | /object/obj_type/obj_ref/obj_revi/files/_up/ |
---|
Paramètres: |
|
---|---|
Retourne: | |
Get params: |
|
The response contains the uploaded size and a status :
- waiting if the corresponding file has not been created yet
- writing if the file is being written
- linking if the size of the uploaded file equals the size of the original
Process to the checkin asynchronously in order to show progress when the checked-in file is uploaded.
Calls checkin_file() .
Manage html page for the files (DocumentFile) checkin in the selected object. It computes a context dictionary based on
Paramètres: |
|
---|---|
Retourne: | |
Retourne: |
View to download a document file.
Paramètres: |
|
---|---|
Retourne: |
Manage html page for the files (DocumentFile) checkout from the selected object. It locks the DocumentFile and, after, calls views.download()
Paramètres: |
|
---|---|
Retourne: |
View to download a document file.
Paramètres: |
|
---|---|
Retourne: |
View to download a published document file.
It returns an :class: HttpResponseForbidden if the document is not published.
Paramètres: |
|
---|---|
Retourne: |
Returns the 5 last objects edited by user. It returns a list of the most recent history entries associated to these objects.
View listing the related parts and documents of the selected User.
Paramètres: |
|
---|---|
Retourne: |
Delegation view.
This view displays all delegations of the given user.
Manage html page for delegations modification of the selected User. It computes a context dictionary based on
Paramètres: |
|
---|---|
Retourne: |
View of the groups page of a user.
Manage html page for the modification of the selected User. It computes a context dictionary based on
Paramètres: |
|
---|---|
Retourne: |
Manage html page for the modification of the selected User password. It computes a context dictionary based on
Paramètres: |
|
---|---|
Retourne: |
View of the user page of a group.
View of the Add user page of a group.
View of the user join page of a group
View of the objects page of a group.
Manage page to accept invitation or request to join a group.