Thank you for the response. I should have said: the subclass is not part of the model, and thus is not reflected in database tables. I declare the subclass in one of my view functions. Without getting into the particulars of my app, I am trying to display a "list of cars" on a web page, along with some calculated information for each "car," which I have called the "comment" field.
Thanks again. On Sep 5, 5:11 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 6 sep, 01:54, Alex Chun <[EMAIL PROTECTED]> wrote: > > > How can I subclass a model class, > > http://www.djangoproject.com/documentation/model-api/#model-inheritance > > > in order to add a temporary field? > > "temporary" ? > > > For example, say I have a class Car, and I want to subclass it to > > TempCar, and add a comment field. > > > class TempCar(Car): > > comment = models.CharField(max_length = 200) > > Inheritance may not be the only nor necessarily the best solution. To > be true, in the above example, it would even be a design mistake IMHO. > Have you considered a related "comment" model ? > > > The trouble arises when I try to get a QuerySet by doing something > > like, > > > redCars = TempCar.objects.filter(color='red') > > > Django gives me a programming error 1146, table > > myproject.myapp.TempCar doesn't exist. > > Did you run ./manage.py syncdb ? > > 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 -~----------~----~----~----~------~----~------~--~---