Rules is very important part of every auction.
Rules declared inside Auction class and play "role" of encapsulation of some business data from users. More about existing schematics base roles you may find here
Auction roles in must cases uses in bundle with
AuctionStatusRole that allow to apply roles for specific states of auction. [example]
To implement custom role you must create role class and extends from
schematics.role and implement init method with
pass body, and
__call__ method with conditions to describe or not to describe data.
class MyCustomRole(schematics.role): def __init__(self, *args, **kwargs): pass def __call__(self, name, value, context): if name == 'name_of_value_to_hide': return return value
name - name of the field.
value - value that contains in the object by key
context - auction contains that defined inside Auction class and contains data of auction that will helm in some
To add some custom context - you should to redifine
to_primitive method of auction [example]