Table Of Contents

Previous topic

2.2. How to add a model (django application)

Next topic

4. http_api — HTTP-API

This Page


Previous versions


3. Cookbook

3.1. Models

3.1.1. Non editable model

class MyModel(Part):

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