def dynamic_fields(self): data = self.data or self.initial if 'key' in data: rule_class = site.get_rule_class(data['key']) self.set_dynamic_field_initial(rule_class) return rule_class.fields return {}
def run_action(self, obj, *args, **kwargs): """ Obj is any object to be passed to the rule class. It can then be used to determine whether or not the rule applies to that object. """ rule_class = site.get_rule_class(self.key) rule_class(self, obj).run(*args, **kwargs)