One way to do this, using python properties:
class WebSvc(models.Model):
...
def _get_state():
return self.cast().get_state()
state = property(_get_state)
Advantages: will only run when the property is needed.
Possible disadvantage: when you call the property multiple times, the web service will be called anew (can be required behaviour but I doubt it). You can cache using memoization.
Other way, just do it by overriding init:
class WebSvc(models.Model):
...
def __init__(*args, **kwargs):
super(WebSvc, self).__init__(*args,**kwargs)
self.state = self.caste().get_state()
Advantages: Will only be computed once per instance without need for memoization.
Possible disadvantage: will be calculated for each instantiated object.
In most typical django cases however, you will only run once over properties of an object and you will probably not instantiate object where you won't use the .state property on. So in these cases the approaches are more or less similar in 'performance'.