Changes between Version 19 and Version 20 of ModelInheritance


Ignore:
Timestamp:
Feb 27, 2006, 5:48:46 PM (18 years ago)
Author:
cell@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ModelInheritance

    v19 v20  
    120120||    || python                                    || result ||
    121121|| A. || {{{Place.objects.count()}}}               || 3 ||
     122
    122123|| B. || {{{Restaurant.objects.count()}}}          || 2   ||
    123124|| C. || {{{ItalianRestaurant.objects.count()}}}   || 1   ||
     
    181182
    182183}}}
     184
     185We can then add all of the parent fields to the new class like so:
     186
     187{{{
     188        for parent in new_class._meta.parents:
     189            for field in parent._meta.fields:
     190                field.contribute_to_class(new_class, field.name)
     191}}}
Back to Top