I was thinking of the case of one model which can have a foreign key
to one of two models.
Like a title model that can have a foreign key to a page model or an
article model.

2016-07-21 13:15 GMT+02:00 'David Turner' via Django users
<django-users@googlegroups.com>:
> Hi
>
> Thanks for this.
> So basically if I am using the county Foreign key in a few different models
> I am fine. I am not sure what you meant by this
> "as long as no models can link to notes or counties and
> not both, simple foreign key are fine."
>
>
> On 21 July 2016 at 11:13, ludovic coues <cou...@gmail.com> wrote:
>>
>> Generic Foreign Key solve a very specific problem. Foreign key to
>> arbitrary models. Like a tagging system, with the ability to set a tag
>> to user, article, comment, media in a blog.
>>
>> For your use, as long as no models can link to notes or counties and
>> not both, simple foreign key are fine.
>> And even then, it might be easier to have a foreign key to both and
>> maybe a method on your models to return one without testing which one
>> is None.
>>
>> Generic Foreign Key have some non-trivial drawback. For exemple, you
>> can't use them in a filter on a queryset.
>>
>> 2016-07-21 9:43 GMT+02:00 'dtdave' via Django users
>> <django-users@googlegroups.com>:
>> > I have two models notes and counties which are used across multiple
>> > models.
>> > At the moment the realtionship is done using a foreign key.
>> >
>> > I am getting conflicting advice on whether to use a Generic Foreign Key.
>> > Could someone please enlighen me as to the best practice?
>> >
>> > Many thanks in advance
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to django-users+unsubscr...@googlegroups.com.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/37577063-87bf-4460-a6fb-7a17d74dc79c%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/MAoN1LNDMEg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEuG%2BTZJG5Vi6OD9hpzcfVnEO0dkw4-3a4KF8hdPtK5O1oASow%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALwQ%2B-ueLUWTc6taeQAES-krh_ibH4ZfnFLufc6R6OwDz1oOwA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZeXjDPF7hqefi%3DJG3kadckdLzF_1oX0T3zDCLMwQQk3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to