'Return a function mapping a field to an integer. The value of a
field is guaranteed to be strictly greater than the value of the
field\'s dependencies.'

@lazy_property
def field_sequence(self):

    dependents = {field: set((dep for (dep, _) in model._field_triggers[field] if (dep != field))) for model in self.itervalues() for field in model._fields.itervalues()}
    mapping = {field: num for (num, field) in enumerate(reversed(topological_sort(dependents)))}
    return mapping.get
