On 25 nov, 10:17, sajal <[EMAIL PROTECTED]> wrote:
> David/Daniel,
>
> Thanks a lot for the prompt responses, ill use the method as specified
> by Daniel.
>
> I had use methods earlier for get_absolute_url and stuff, but didnt
> realize i could use methods to do anything I wanted...

Well... This is the whole point of a model layer : centralizing model-
related stuff where it belongs. Also note that Python being highly
dynamic, you can add new methods at runtime to an existing class,
which is very handy when using third-part applications:

# mymodel.py
from thirdpart.model import Person

def get_age(self):
    return calculate_age(self.birth_date)

Person.get_age = get_age


HTH
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to