Karen,

Aghh - was editing a backup copy of the file, so django quite happy to
use abstract models from other apps.

However, my cunning plan does not work because of the many to many
relationships within microformats - can't have a many to many
relationship with an abstract model obviously.

Time to do some strategic copy and paste.

Thanks for your interest.

Phoebe.


On Oct 1, 6:21 pm, phoebebright <phoebebri...@spamcop.net> wrote:
> Karen,
>
> Am wanting to use the standard in django-microformats (with an s!) but
> want additional fields, so rather than change the models within
> microformats I thought I could be clever and make them all abstract
> and inherit them.  My suspicion is django doesn't like inheriting from
> another app, and maybe it shouldn't.  I can do some more exploration,
> but thought I would check I going in the right direction before
> proceeding.
>
> Phoebe.
>
> On Oct 1, 5:04 pm, Karen Tracey <kmtra...@gmail.com> wrote:
>
>
>
> > On Thu, Oct 1, 2009 at 10:59 AM, phoebebright 
> > <phoebebri...@spamcop.net>wrote:
>
> > > I am trying to use use a hCalendar model from django-microformats as
> > > the base class for events in my own app,
>
> > > microformat.models.py
>
> > Is that really microformat.models.py or microformats.models.py?  I'm unsure
> > what you are using here, as searching on django-microformats brings up more
> > than one possibility.
>
> > > class hCalendar(LocationAwareMicroformat):
> > >    ...
> > >    class Meta:
>
> > >        abstract = True
>
> > This class here looks like it matches what you are using:
>
> >http://github.com/ntoll/microformats/blob/master/models.py#L638
>
> > Except it does not specify abstract=True in its class Meta:
>
> >http://github.com/ntoll/microformats/blob/master/models.py#L705
>
> > Are you using something else or have you modified this?
>
> > web.models.py
>
> > > class Event(hCalendar):
>
> > >    owner = models.ForeignKey(Account)
> > >    created = models.DateTimeField(default=datetime.now)
> > >    last_update = models.DateTimeField(auto_now = True)
>
> > > It doesn't seem to want to recognise the abstract = True, or is the
> > > problem with multi-inheritance?  The table generated is:
>
> > > CREATE TABLE `web_event` (
> > >  `hcalendar_ptr_id` int(11) NOT NULL,
> > >  `owner_id` int(11) NOT NULL,
> > >  `created` datetime NOT NULL,
> > >  `last_update` datetime NOT NULL,
> > >  PRIMARY KEY  (`hcalendar_ptr_id`),
> > >  KEY `web_event_owner_id` (`owner_id`),
> > >  CONSTRAINT `owner_id_refs_id_3952a136` FOREIGN KEY (`owner_id`)
> > > REFERENCES `web_account` (`id`)
> > > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
>
> > > Is this expected behaviour?
>
> > These models:
>
> > class Abs1(models.Model):
> >    abs1f = models.IntegerField()
> >    class Meta:
> >       abstract = True
>
> > class Abs2(Abs1):
> >    abs2f = models.IntegerField()
> >    class Meta:
> >       abstract = True
>
> > class Concrete(Abs2):
> >    pass
>
> > produce SQL:
>
> > BEGIN;
> > CREATE TABLE "ttt_concrete" (
> >     "id" integer NOT NULL PRIMARY KEY,
> >     "abs1f" integer NOT NULL,
> >     "abs2f" integer NOT NULL
> > )
> > ;
> > COMMIT;
>
> > so multiple levels of abstract models seems to work fine.
>
> > Karen
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to