Re: How to add a non database item to a python model

2007-09-05 Thread shabda
Traceback (most recent call last): File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "C:\Python24\lib\site-packages\django\contrib\auth\decorators.py" in _checklogin 14. return view_func(re

Re: How to add a non database item to a python model

2007-09-05 Thread Alex Koshelev
Show all exception dump --~--~-~--~~~---~--~~ 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 P

Re: How to add a non database item to a python model

2007-09-05 Thread shabda
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

Re: How to add a non database item to a python model

2007-09-05 Thread shabda
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_

Re: How to add a non database item to a python model

2007-09-04 Thread Iapain
> 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 re

Re: How to add a non database item to a python model

2007-09-03 Thread Alex Koshelev
http://www.djangoproject.com/documentation/models/custom_methods/ On 4 сент, 07:21, shabda <[EMAIL PROTECTED]> wrote: > I have a python model > > class MyModel(models.Model): > fld1 = models.TextField() > fld1 = models.TextField() > > I want to have a non database item in this mod

Re: How to add a non database item to a python model

2007-09-03 Thread Ben Ford
If you want to add things to an instance in a view you could just use setattr. Is this what you're asking? Ben On 04/09/07, shabda <[EMAIL PROTECTED]> wrote: > > > I have a python model > > class MyModel(models.Model): > fld1 = models.TextField() > fld1 = models.TextField() > > I w

How to add a non database item to a python model

2007-09-03 Thread shabda
I have a python model class MyModel(models.Model): fld1 = models.TextField() fld1 = models.TextField() 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. --~--~-~--~~~---