Paul,

> then generic keys may be the way to go.  If however, you are simply
> having one of your own apps depend on another I strongly suggest not
> using generic foreign keys, they have drawbacks that could hinder you
> down the road.

I suppose you mean in terms of performance? Could you please elaborate
on the disadvantages?

Guillermo



On Sep 27, 2:27 pm, pkenjora <pkenj...@gmail.com> wrote:
> Guillermo,
>
>   Having one application depend on another is OK.  If your are writing
> a generic reusable application that other can download and plug in
> then generic keys may be the way to go.  If however, you are simply
> having one of your own apps depend on another I strongly suggest not
> using generic foreign keys, they have drawbacks that could hinder you
> down the road.
>
> -Paul
>
> On Sep 27, 3:12 am, guillermooo <guillermo.lis...@googlemail.com>
> wrote:
>
>
>
> > Hi David,
>
> > I suppose that what you suggest would work too, but it would break the
> > reusability of the Todo application. I think what I need is rather a
> > GenericRelation/GenericForeignKey. Just found it in the docs.
>
> > Thanks,
>
> > Guillermo
>
> > On Sep 26, 10:21 pm, "djfis...@gmail.com" <dfisc...@ucsdmail.com>
> > wrote:
>
> > > Guillermo,
>
> > > It is possible to have a model in one application have a foreign key
> > > to another application as of Django 1.0.
>
> > > From:http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
> > > -------------------
> > > To refer to models defined in another application, you can explicitly
> > > specify a model with the full application label. For example, if the
> > > Manufacturer model above is defined in another application called
> > > production, you'd need to use:
>
> > > class Car(models.Model):
> > >     manufacturer = models.ForeignKey('production.Manufacturer')
>
> > > This sort of reference can be useful when resolving circular import
> > > dependencies between two applications.
> > > -------------------
>
> > > Hopefully this is what you need.
>
> > > -David
>
> > > On Sep 26, 12:07 pm, Guillermo <guillermo.lis...@googlemail.com>
> > > wrote:
>
> > > > Hi all,
>
> > > > I have one app with a Project model and another app with a TodoItem
> > > > model. How can I declare Project to be the foreign key of TodoItem?
> > > > Or, rather, how can I make TodoItem accept an arbitrary model as
> > > > foreign key?
>
> > > > Regards,
>
> > > > Guillermo
--~--~---------~--~----~------------~-------~--~----~
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