I assume you are using the queryset-refactoring branch, otherwise if you are
able to do this it is just a fluke. However QS-RF does provide a great way
to create abstract classes and multiple inheritance and in the brief time (4
days) since I have been messing around with it, it has been an out of body
experience (or just the medicine i sampled from the medicine cabinet).

Either way here is the documentation for exactly what you want to do
http://code.djangoproject.com/browser/django/branches/queryset-refactor/docs/model-api.txt#L2085

and I think we all owe Malcolm for getting this branch really close to a
merge state.

Hope that helps,

Michael

On Tue, Apr 15, 2008 at 9:33 PM, Jon <[EMAIL PROTECTED]> wrote:

>
> I wanted to share some fields and functionality in several tables
> without having to recode all of the field definitions in each table.
> Obviously, this is an inheritance problem.  So I did what I figured
> was the logical thing:
>
> class MyModel (models.Model):
>  date_created = models.DateTimeField(auto_now_add=True,blank=True)
>  date_updated = models.DateTimeField(auto_now=True,blank=True)
>
> class Poll(MyModel):
>  <poll fields munched...>
>
> class Choice(MyModel):
>  <choice fields munched...>
>
> I ran manage.py syncdb and THREE tables were created: mysite_choice,
> mysite_poll and mysite_mymodel.
>
> It appears (although I haven't yet fully tested it) that as expected,
> the fields from MyModel are implicitly included in the other two
> tables (precisely what I wanted to happen!)  I haven't explored all
> options, but it appears the two poll tables work correctly and have
> the extra fields in the database just as I wanted.
>
> The question then is can you SUPPRESS the creation of the "abstract
> class" table MyModel with some flag or option that I don't know
> about?  My review of the django book revealed nothing but I am new to
> this and may have overlooked something.
>
> Having the table isn't an awful thing, I can drop it if I want or
> certainly just ignore it.  However, it really shouldn't be created at
> all and the ideal thing would be to be able to declare an option for
> an abstract model class that would suppress the creation of any table
> for that class.
>
> Thanks!
>
> Jon Rosen
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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