Table des matières

Sujet précédent

5.17.3. units — Units

Sujet suivant

5.19. widgets — Form widgets

Cette page

Autres langues

5.18. views — Views

5.18.1. views.base — Functions common to all views

plmapp.views.base.get_obj(obj_type, obj_ref, obj_revi, user)[source]

Get type, reference and revision of an object and return the related controller

Paramètres:
Retourne:

a PLMObjectController or a UserController

plmapp.views.base.secure_required(view_func)[source]

Decorator which makes sure URL is accessed over https.

plmapp.views.base.json_view(func, API_VERSION='')[source]

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.

plmapp.views.base.get_obj_by_id(obj_id, user)[source]

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

plmapp.views.base.get_obj_from_form(form, user)[source]

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

plmapp.views.base.object_to_dict(plmobject)[source]

Returns a dictionary representing plmobject. The returned dictionary respects the format described in Object fields

plmapp.views.base.handle_errors(func=None, undo='..', restricted_access=True, no_cache=True)[source]

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.

plmapp.views.base.init_ctx(init_type_, init_reference, init_revision)[source]

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:
  • init_type (str) – type of the object
  • init_reference (str) – reference of the object
  • init_revision (str) – revision of the object
Retourne:

a dictionnary

plmapp.views.base.update_navigation_history(request, obj, type_, reference, revision)[source]
plmapp.views.base.get_generic_data(request, type_='-', reference='-', revision='-', search=True, load_all=False)[source]

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:

a PLMObjectController or a UserController

Retourne:

ctx

Retourne:

request.session

plmapp.views.base.get_navigate_data(request, obj_type, obj_ref, obj_revi)[source]
plmapp.views.base.register_creation_view(type_, view)[source]

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.

plmapp.views.base.get_creation_view(type_)[source]

Returns a registed view for type_ (a subclass of PLMObject) or None if no views are registered.

plmapp.views.base.get_id_card_data(doc_ids)[source]

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
  • thumbnails
    list of tuple (document,thumbnail)
  • num_files
    list of tuple (document, number of file)
plmapp.views.base.get_pagination(request, object_list, type)[source]

Returns a dictionary with pagination data.

Called in view which returns a template where object id cards are displayed.

5.18.2. views.ajax — Ajax views

Ajax views.

plmapp.views.ajax.ajax_creation_form(request, *args, **kwargs)[source]

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.

plmapp.views.ajax.ajax_autocomplete(request, *args, **kwargs)[source]

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:
  • obj_type (str) – a valid typename (like "part")
  • field (str) – a valid field (like "name")
plmapp.views.ajax.ajax_thumbnails(request, *args, **kwargs)[source]

Ajax view to get files and thumbnails of a document.

Paramètres:
plmapp.views.ajax.ajax_navigate(request, *args, **kwargs)[source]
plmapp.views.ajax.ajax_add_child(request, *args, **kwargs)[source]
plmapp.views.ajax.ajax_can_add_child(request, *args, **kwargs)[source]
plmapp.views.ajax.ajax_attach(request, *args, **kwargs)[source]
plmapp.views.ajax.ajax_can_attach(request, *args, **kwargs)[source]
plmapp.views.ajax.ajax_richtext_preview(request, *args, **kwargs)[source]

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.

5.18.3. views.api — api

This modules contains all stuff related to the api

Voir aussi

The public api http_api,

plmapp.views.api.API_VERSION = '1.1'

Version of the API (value: '1.1')

plmapp.views.api.api_login_required(view_func)

Decorator whichs requires that the user is login

plmapp.views.api.need_login(request, *args, **kwargs)[source]

Helper function for api_login_required()

plmapp.views.api.login_json(func)[source]

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.

plmapp.views.api.get_all_types(*args, **kwargs)[source]

Returns all the subtypes of PLMObject managed by the server.

Implements :http_api.types()
plmapp.views.api.get_all_docs(*args, **kwargs)[source]

Returns all the types of Document managed by the server.

Implements :http_api.docs()
plmapp.views.api.get_all_parts(*args, **kwargs)[source]

Returns all the types of Part managed by the server.

Implements :http_api.parts()
plmapp.views.api.search(*args, **kwargs)[source]

Returns all objects matching a query.

Paramètres:
  • editable_only – if "true" (the default), returns only editable objects
  • with_file_only – if "true" (the default), returns only documents with at least one file
Implements :

http_api.search()

plmapp.views.api.create(*args, **kwargs)[source]

Creates a PLMObject and returns it

Implements :http_api.create()
plmapp.views.api.get_files(*args, **kwargs)[source]

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 :

http_api.files()

Paramètres:
  • request – the request
  • doc_id – id of a Document
  • all_files – boolean, False if only unlocked files should be returned
Returned fields:
 

files, a list of files (see File fields)

plmapp.views.api.check_out(*args, **kwargs)[source]

Locks the DocumentFile identified by df_id from the Document identified by doc_id.

Implements :

http_api.lock()

Paramètres:
Returned fields:
 

None

plmapp.views.api.check_in(*args, **kwargs)[source]

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

plmapp.views.api.is_locked(*args, **kwargs)[source]

Returns True if the DocumentFile identified by df_id from the Document identified by doc_id is locked.

Implements :

http_api.is_locked()

Paramètres:
Returned fields:
 

locked, True if the file is locked.

plmapp.views.api.unlock(*args, **kwargs)[source]

Unlocks the DocumentFile identified by df_id from the Document identified by doc_id.

Implements :

http_api.unlock()

Paramètres:
Returned fields:
 

None

plmapp.views.api.field_to_type(field)[source]

Converts field (a django FormField) to a type as described in Available types.

plmapp.views.api.get_fields_from_form(form)[source]

Returns a list of fields from form converted to the format described in Query fields.

plmapp.views.api.get_search_fields(*args, **kwargs)[source]

Returns search fields associated to typename.

Implements :http_api.search_fields()
plmapp.views.api.get_creation_fields(*args, **kwargs)[source]

Returns creation fields associated to typename

Implements :http_api.creation_fields()
plmapp.views.api.api_login(*args, **kwargs)[source]

Authenticates the user

Implements :http_api.login()
plmapp.views.api.test_login(*args, **kwargs)[source]

Tests if user is authenticated

Implement :http_api.testlogin()
plmapp.views.api.next_revision(*args, **kwargs)[source]

Returns a possible new revision for the Document identified by doc_id.

Implements :

http_api.next_revision()

Paramètres:
  • request – the request
  • doc_id – id of a Document
Returned fields:
 

revision, the new revision (may be an empty string)

Voir aussi

utils.get_next_revision() for possible results

plmapp.views.api.revise(*args, **kwargs)[source]

Makes a new revision of the Document identified by doc_id.

Implements :

http_api.revise()

Paramètres:
  • request – the request
  • doc_id – id of a Document
Returned fields:
 
plmapp.views.api.is_revisable(*args, **kwargs)[source]

Returns True if the Document identified by doc_id can be revised.

Implements :

http_api.is_revisable()

Paramètres:
  • request – the request
  • doc_id – id of a Document
Returned fields:
 

revisable, True if it can be revised

plmapp.views.api.attach_to_part(*args, **kwargs)[source]

Links the Document identified by doc_id with the Part identified by part_id.

Implements :

http_api.attach_to_part()

Paramètres:
  • request – the request
  • doc_id – id of a Document
  • part_id – id of a Part
Returned fields:
 

None

plmapp.views.api.add_file(*args, **kwargs)[source]

Adds a file to the Document identified by doc_id.

Implements :

http_api.add_file()

Paramètres:
  • request – the request
  • doc_id – id of a Document
Returned fields:
 

doc_file, the file that has been had, see File fields.

plmapp.views.api.add_thumbnail(*args, **kwargs)[source]

Adds a thumbnail to the DocumentFile identified by df_id from the Document identified by doc_id.

Implements :

http_api.add_thumbnail()

Paramètres:
Returned fields:
 

None

plmapp.views.api.get_object(*args, **kwargs)[source]

Introduit dans la version 1.3.

Returns basic fields of the PLMObject identified by obj_id.

Implements :

http_api.get()

Paramètres:
  • request – the request
  • obj_id – id of a PLMObject
Returned fields:
 

object, a dictionary of object fields

plmapp.views.api.get_attached_parts(*args, **kwargs)[source]

Introduit dans la version 1.3.

Returns parts attached to the Document identified by doc_id.

Implements :

http_api.attached_parts()

Paramètres:
  • request – the request
  • doc_id – id of a Document
Returned fields:
 

parts, a list of dictionaries describing attached parts

plmapp.views.api.get_attached_documents(*args, **kwargs)[source]

Introduit dans la version 1.3.

Returns documents attached to the Part identified by part_id.

Implements :

http_api.attached_documents()

Paramètres:
  • request – the request
  • part_id – id of a Part
Returned fields:
 

documents, a list of dictionaries describing attached documents

plmapp.views.api.lock_files(*args, **kwargs)[source]

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()

5.18.4. views.main — Main views

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.

plmapp.views.main.set_language(request)[source]

A wrapper arround django.views.i18n.set_language() that stores the language in the user profile.

plmapp.views.main.comment_post_wrapper(request, *args, **kwargs)[source]
plmapp.views.main.display_home_page(request, *args, **kwargs)[source]

Home page view.

Url :/home/

Template:

home.html

Context:

RequestContext

pending_invitations_owner
QuerySet of pending invitations to groups owned by the user
pending_invitations_guest
QuerySet of pending invitations to groups that the user can joined
plmapp.views.main.render_attributes(obj, attrs)[source]
plmapp.views.main.display_object_attributes(request, *args, **kwargs)[source]

Attributes view of the given object.

Url :/object/obj_type/obj_ref/obj_revi/attributes/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

attribute.html

Context:

RequestContext

object_attributes
list of tuples(verbose attribute name, value)
plmapp.views.main.display_object(request, *args, **kwargs)[source]

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/
plmapp.views.main.redirect_history(request, type, hid)[source]

Redirects to the history page that contains the history item numbered hid.

plmapp.views.main.display_object_history(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

history.html

Context:

RequestContext

object_history
list of AbstractHistory
show_revisions
True if the template should show the revision of each history row
show_identifiers
True if the template should show the type, reference and revision of each history row
plmapp.views.main.create_object(request, *args, **kwargs)[source]

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:
  • from_registered_view – True if this function is called by another creation view
  • creation_form – a creation form that will be used instead of the default one

Template:

create.html

Context:

RequestContext

creation_form

creation_type_form
TypeForm to select the type of the created object
object_type
type of the created object
next
value of the __next__ request variable if given
plmapp.views.main.modify_object(request, *args, **kwargs)[source]

Manage html page for the modification of the selected object. It computes a context dictionary based on

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.main.navigate(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

plmapp.views.main.import_csv_init(request, *args, **kwargs)[source]

Manage page to import a csv file.

plmapp.views.main.import_csv_apply(request, *args, **kwargs)[source]

View that display a preview of an uploaded csv file.

plmapp.views.main.import_csv_done(request, *args, **kwargs)[source]
class plmapp.views.main.OpenPLMSearchView(template=None, load_all=True, form_class=None, searchqueryset=None, context_class=<class 'django.template.context.RequestContext'>, results_per_page=None)[source]

Bases: haystack.views.SearchView

extra_context()[source]
get_query()[source]
get_results()[source]
class plmapp.views.main.SimpleDateFilter(field, request, model, field_path)[source]

Bases: django.contrib.admin.filters.DateFieldListFilter

template = 'snippets/time_filter.html'
filters()[source]
queryset(request, queryset)[source]
plmapp.views.main.browse(request, *args, **kwargs)[source]
plmapp.views.main.public(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

public.html

Context:

RequestContext

obj
the controller
object_attributes
list of tuples(verbose attribute name, value)
revisions
list of published related revisions
attached
list of published attached documents and parts

Perform search_request asynchronously

5.18.5. views.plmobject — PLMObject related views

plmapp.views.plmobject.redirect_from_name(request, *args, **kwargs)[source]
plmapp.views.plmobject.display_object_lifecycle(request, *args, **kwargs)[source]

Lifecycle data of the given object (a part or a document).

Url :/object/obj_type/obj_ref/obj_revi/lifecycle/[apply/]
Paramètres:
Retourne:

a django.http.HttpResponse

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

action
Only for unsuccessful POST requests. Name of the action (“demote” or “promote”) that the user tries to do.
plmapp.views.plmobject.get_lifecycle_data(obj)[source]

Returns a dictionary containing lifecycle data of obj.

Dictionary content

object_lifecycle
List of tuples (state name, boolean, signer role). The boolean is True if the state name equals to the current state. The signer role is a dict {“role” : name of the role, “user__username” : name of the signer}
is_signer
True if the current user has the permission to promote this object
is_signer_dm
True if the current user has the permission to demote this object
signers_data
List of tuple (signer, nb_signer). The signer is a dict which contains management data for the signer and indicates wether a signer exists or not.
password_form
A form to ask the user password
cancelled_revisions
List of plmobjects that will be cancelled if the object is promoted
deprecated_revisions
List of plmobjects that will be deprecated if the object is promoted
plmapp.views.plmobject.get_management_data(obj, user)[source]

Returns a dictionary containing management data for obj.

Paramètres:user – User who runs the request

Dictionary content

notified_list
List of notification PLMObjectUserLink related to obj
owner_list
List of owner PLMObjectUserLink related to obj
reader_list
List of restricted reader PLMObjectUserLink related to obj

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
plmapp.views.plmobject.display_object_revisions(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

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.

plmapp.views.plmobject.revise_document(obj, ctx, request)[source]

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:
revision

new revision of the document

a valid SelectPartFormset

Only required if confirmation is True, see below.

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

confirmation
True if a confirmation is required to revise the document.
revisions
list of revisions of the document
add_revision_form
form to revise the document. Only set if the document is revisable.
part_formset
a SelectPartFormset of parts that the new revision may be attached to. Only set if confirmation is True.
plmapp.views.plmobject.revise_part(obj, ctx, request)[source]

View to revise a part.

Paramètres:
  • obj (PartController) – displayed part
  • ctx (dict) – initial context
  • request – riven request

This view can create a new revision of the part, it required the following POST parameters:

Post params:
revision

new revision of the part

a valid SelectParentFormset

Only required if confirmation is True, see below.

a valid SelectDocumentFormset

Only required if confirmation is True, see below.

a valid SelectParentFormset

Only required if confirmation is True, see below.

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

confirmation
True if a confirmation is required to revise the part.
revisions
list of revisions of the part
add_revision_form
form to revise the part. Only set if the document is revisable.
doc_formset
a SelectDocmentFormset of documents that the new revision may be attached to. Only set if confirmation is True.
children_formset
a SelectChildFormset of parts that the new revision will be composed of. Only set if confirmation is True.
parents_formset
a SelectParentFormset of parts that the new revision will be added to, it will replace the previous revisions in the parent’s BOM. Only set if confirmation is True.
plmapp.views.plmobject.replace_management(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

management_replace.html

Context:

RequestContext

replace_manager_form
a form to select the new manager (a user)
link_creation
Set to True
role
role of the link being replace
attach
set to (obj, "add_role")
plmapp.views.plmobject.add_management(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

management_replace.html

Context:

RequestContext

replace_manager_form
a form to select the new manager (a user)
link_creation
Set to True
role
role of the new user (ROLE_NOTIFIED or ROLE_READER)
attach
set to (obj, "add_role")
plmapp.views.plmobject.delete_management(request, *args, **kwargs)[source]

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.

plmapp.views.plmobject.download_archive(request, *args, **kwargs)[source]

View to download all files from a document/part.

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.plmobject.clone(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

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 valid SelectDocumentFormset

Only required if is_linked is True, see below.

a valid SelectChildFormset

Only required if is_linked is True, see below.

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 valid SelectPartFormset

Only required if is_linked is True, see below.

A cloned document may be attached to some parts, given by DocumentController.get_suggested_parts().

Context:

RequestContext

is_linked
True if the object is linked (attached) to other object , at least one.
creation_form
form to clone the object. Fields in this form are set according to the current object.
doc_formset
a SelectDocmentFormset of documents that the new object, if it is a part, may be attached to. Only set if is_linked is True.
children_formset
a SelectChildFormset of parts that the new object, if it is a part, may be linked with. Only set if is_linked is True.
parts_formset
a SelectPartFormset of parts that the new object, if it is a document, may be attached to. Only set if is_linked is True.
plmapp.views.plmobject.clone_part(user, data, children, documents)[source]

Analyze the formsets in data to return list of selected children and documents.

Paramètres:
  • user – user who is cloning the part
  • data – posted data (see post params in clone())
  • children – list of children linked to the originial part
  • documents – list of documents attached to the original part
Retourne:

valid_forms

True if all formsets are valid

selected_children

list of children to add to the new part

selected_documents

list of documents to attach to the new part

plmapp.views.plmobject.clone_document(user, data, parts)[source]

Analyze the formsets in data to return list of selected parts.

Paramètres:
  • user – user who is cloning the document
  • data – posted data (see post params in clone())
  • parts – list of parts attached to the original document
Retourne:

valid_forms

True if all formsets are valid

selected_parts

list of parts to attach to the new document

5.18.6. views.part — Part related views

plmapp.views.part.display_children(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

parts/bom.html

Context:

RequestContext

children
a list of Child
display_form
a DisplayChildrenForm
extra_columns
a list of extra columns that are displayed

extension_data

decomposition_msg
a html message to decompose the part (may be empty)
decomposable_children
a set of child part ids that are decomposable
plmapp.views.part.edit_children(request, *args, **kwargs)[source]

View to edit a BOM.

Url :/object/obj_type/obj_ref/obj_revi/bom-child/edit/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

parts/bom_edit.html

Context:

RequestContext

children_formset
a formset to edit the BOM
extra_columns
a list of extra columns that are displayed
extra_fields
a list of extra fields that are editable
plmapp.views.part.replace_child(request, *args, **kwargs)[source]

View to replace a child by another one.

Url :/object/obj_type/obj_ref/obj_revi/bom-child/replace/link_id/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

parts/bom_replace.html

Context:

RequestContext

replace_child_form
a form to select the replacement part
link
ParentChildLink being replaced
link_creation
Set to True
attach
set to (obj, “add_child”)
plmapp.views.part.add_child(request, *args, **kwargs)[source]

View to add a child to a part.

Url :/object/obj_type/obj_ref/obj_revi/bom-child/add/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

parts/bom_add.html

Context:

RequestContext

add_child_form
a form to add a child (AddChildForm)
link
ParentChildLink being replaced
link_creation
Set to True
attach
set to (obj, “add_child”)
plmapp.views.part.compare_bom(request, obj_type, obj_ref, obj_revi)[source]
plmapp.views.part.display_parents(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

parts/parents.html

Context:

RequestContext

parents
a list of Parents
display_form
a DisplayChildrenForm
plmapp.views.part.alternates(request, *args, **kwargs)[source]
plmapp.views.part.add_alternate(request, *args, **kwargs)[source]
plmapp.views.part.delete_alternate(request, *args, **kwargs)[source]
plmapp.views.part.display_doc_cad(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

parts/doccad.html

Context:

RequestContext

documents
a queryset of DocumentPartLink bound to the part
archive_formats
list of available archive formats
docs_formset
a formset to detach documents
forms
a dictionary (link_id -> form) to get the form related to a link (a document may not be “detachable”)
plmapp.views.part.add_doc_cad(request, *args, **kwargs)[source]

View to attach a document to a part.

Url :/object/obj_type/obj_ref/obj_revi/doc-cad/add/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

parts/doccad_add.html

Context:

RequestContext

add_doc_cad_form
a form to attach a document (AddDocCadForm)
link_creation
Set to True
attach
set to (obj, “attach_doc”)
plmapp.views.part.delete_doc_cad(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

5.18.7. views.document — Document related views

plmapp.views.document.display_parts(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

documents/parts.html

Context:

RequestContext

parts
a queryset of DocumentPartLink bound to the document
parts_formset
a formset to detach parts
forms
a dictionary (link_id -> form) to get the form related to a link (a part may not be “detachable”)
plmapp.views.document.add_part(request, *args, **kwargs)[source]

View to attach a part to a document.

Url :/object/obj_type/obj_ref/obj_revi/parts/add/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

documents/parts_add.html

Context:

RequestContext

add_part_form
a form to attach a part (AddPartForm)
link_creation
Set to True
attach
set to (obj, “attach_part”)
plmapp.views.document.delete_part(request, *args, **kwargs)[source]

View to detach a part referred by the POST parameter plmobject.

Url :/object/obj_type/obj_ref/obj_revi/parts/delete/
Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.document.display_files(request, *args, **kwargs)[source]

Files view.

That view displays files of the given document.

Url :/object/obj_type/obj_ref/obj_revi/files/
Paramètres:
Retourne:

a django.http.HttpResponse

Template:

documents/files.html

Context:

RequestContext

file_formset
a formset to remove files
archive_formats
list of available archive formats
add_file_form
form to add a file
plmapp.views.document.upload_and_create(request, *args, **kwargs)[source]
plmapp.views.document.add_file(request, *args, **kwargs)[source]

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:

a django.http.HttpResponse

Template:

documents/files_add_noscript.html

Context:

RequestContext

add_file_form
form to add a file
plmapp.views.document.up_file(*args, **kwargs)[source]

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:

a django.http.HttpResponse

Post params:
files

uploaded files

Get params:

list of pair (filename, id)

The response contains “failed” if the submitted form is not valid.

plmapp.views.document.up_progress(request, *args, **kwargs)[source]

Show upload progress for a given progress_id

Url :/object/obj_type/obj_ref/obj_revi/files/_up/
Paramètres:
Retourne:

a django.http.HttpResponse

Get params:
X-Progress-ID

progress id to search

f_size

size of the original file

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
plmapp.views.document.get_checkin_file(*args, **kwargs)[source]

Process to the checkin asynchronously in order to show progress when the checked-in file is uploaded.

Calls checkin_file() .

plmapp.views.document.checkin_file(request, *args, **kwargs)[source]

Manage html page for the files (DocumentFile) checkin in the selected object. It computes a context dictionary based on

Paramètres:
Retourne:

a django.http.HttpResponse

Retourne:

a django.http.HttpResponse

plmapp.views.document.file_revisions(request, *args, **kwargs)[source]

View to download a document file.

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.document.checkout_file(request, *args, **kwargs)[source]

Manage html page for the files (DocumentFile) checkout from the selected object. It locks the DocumentFile and, after, calls views.download()

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.document.download(request, *args, **kwargs)[source]

View to download a document file.

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.document.public_download(request, *args, **kwargs)[source]

View to download a published document file.

It returns an :class: HttpResponseForbidden if the document is not published.

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.document.serve(ctrl, doc_file, view=False)[source]

5.18.8. views.user — User related views

plmapp.views.user.get_last_edited_objects(user)[source]

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:

a django.http.HttpResponse

plmapp.views.user.display_delegation(request, *args, **kwargs)[source]

Delegation view.

This view displays all delegations of the given user.

plmapp.views.user.delegate(request, *args, **kwargs)[source]

Manage html page for delegations modification of the selected User. It computes a context dictionary based on

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.user.display_groups(request, *args, **kwargs)[source]

View of the groups page of a user.

plmapp.views.user.sponsor(request, *args, **kwargs)[source]

View of the sponsor page.

plmapp.views.user.create_user(request, *args, **kwargs)[source]
plmapp.views.user.sponsor_resend_mail(request, *args, **kwargs)[source]
plmapp.views.user.modify_user(request, *args, **kwargs)[source]

Manage html page for the modification of the selected User. It computes a context dictionary based on

Paramètres:
Retourne:

a django.http.HttpResponse

plmapp.views.user.change_user_password(request, *args, **kwargs)[source]

Manage html page for the modification of the selected User password. It computes a context dictionary based on

Paramètres:
Retourne:

a django.http.HttpResponse

5.18.9. views.group — Group related views

plmapp.views.group.display_users(request, *args, **kwargs)[source]

View of the user page of a group.

plmapp.views.group.group_add_user(request, *args, **kwargs)[source]

View of the Add user page of a group.

plmapp.views.group.group_ask_to_join(request, *args, **kwargs)[source]

View of the user join page of a group

plmapp.views.group.display_plmobjects(request, *args, **kwargs)[source]

View of the objects page of a group.

plmapp.views.group.accept_invitation(request, *args, **kwargs)[source]

Manage page to accept invitation or request to join a group.

plmapp.views.group.refuse_invitation(request, *args, **kwargs)[source]

Manage page to refuse invitation or request to join a group.

plmapp.views.group.send_invitation(request, *args, **kwargs)[source]

Views to (re)send an invitation.

Paramètres:
  • obj_ref – name of the group
  • token – token that identify the invitation