django - Parsing integerfields as integer values -


i'm looking way parse value of integerfields , returning value.

scorechans = models.integerfield(0) scorechansset = models.booleanfield(false) scoreyatzy = models.integerfield(0) scoreyatzyset = models.booleanfield(false)   scoretotal = scorechans + scoreyatzy 

but gives: typeerror: unsupported operand type(s) +: 'integerfield' , 'integerfield'

is there way fetch values these fields?

you can fetch values on instantiated model.

i assume want have computed property? like:

class mymodel(models.model):     score_a = models.integerfield()     score_b = models.integerfield()      @property     def total_score(self):         return self.score_a + self.score_b 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -