On 12/03/2013 5:09pm, Doug S wrote:
I'm considering using django properties on some models that are mostly tabulated numerical data. I'm want to derive some numerical scores from some of the columns of data I'm using as input. If I use properties for these derived scores, what is actually happening. Does Django put these into my models as fields and compute each score when a model instance is saved,
You would need to do that yourself probably by over-riding the model's save() method to compute whatever you want.
Or is simply calling the
property function when I ask for the property? Or is is evaluated when a query set is evaluated? i am dealing with a large amount of data so efficiency is important I may not need to score every row in my DB, But being able to have indexed lookup by my derived scores would be nice
If the derived score relates to the data instance then yes it should be in a database record. Whether it is in the actual data record or another record related to it depends on your design.
Should I define these scores as fields in my model to I thinks so.
get them into the DB Or will propterties do something like this for me? Are properties anything else than python functions defined on a Class Or does django build in some special functionality for them?
Django is just Python. Mike
Doug
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

