Table des matières

Sujet précédent

2.2. How to add a model (django application)

Sujet suivant

4. http_api — HTTP-API

Cette page

Autres langues

3. Cookbook

3.1. Models

3.1.1. Non editable model

class MyModel(Part):

    @classmethod
    def excluded_modification_fields(cls):
        return cls().attributes

3.1.2. Condition on promotion

class MyModel(Part):

    def is_promotable(self):
        if condition_is_respected:
            return super(MyModel, self).is_promotable()
        else:
            return False

3.2. Controllers

3.2.1. Creation of a part using a controller

ctrl = PartController.create("Part_00011", "Part", "a", user, {"group":group})

3.3. Tests

3.4. Others

3.4.1. Get next state of a PLMObject

lcs = obj.lifecycle.to_states_list()
next_state = lcs.next_state(obj.state.name)