Oh shucks, since I want to recalculate this attribute each time, I would need this to be in the view function. Still how would I override __init__ in django Models?
On Sep 5, 11:10 pm, shabda <[EMAIL PROTECTED]> wrote: > That seems too easy to be true. :). > I have one more query, where should I add this code? Considering this > attribute would be used in many views, I am trying to override > __init__. > > def __init__(self, *vargs): > models.Model.__init__(self, *vargs) > self.my_item_that_doesnt_exist_in_model = 'my value' > ..... > > I am getting "Exception Type: TypeError". What am I missing? > > On Sep 4, 12:58 pm, Iapain <[EMAIL PROTECTED]> wrote: > > > > I want to have a non database item in this model class, which I can > > > populate in the views. What is the recommended way to do this. > > > its quite simple: > > > myObject.my_item_that_doesnt_exist_in_model = 'my value' #incase of > > model object --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---