dels can link to notes or counties and
> > not both, simple foreign key are fine."
> >
> >
> > On 21 July 2016 at 11:13, ludovic coues wrote:
> >>
> >> Generic Foreign Key solve a very specific problem. Foreign key to
> >> arbitrary models. Li
ally 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 wrot
ues 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
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
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
2014-08-17 11:24 GMT+02:00 Vladimir Chukharev
:
>
>
> On Saturday, August 16, 2014 10:46:33 PM UTC+3, Aaron Law wrote:
>>
>>
>> Hi all,
>>
>> I have php web programming background, and new to Django. I am helping my
>> brother to build an online system to manage inventory, and I've got a
>> datab
On Saturday, August 16, 2014 10:46:33 PM UTC+3, Aaron Law wrote:
>
>
> Hi all,
>
> I have php web programming background, and new to Django. I am helping my
> brother to build an online system to manage inventory, and I've got a
> database design & coding problem recently. Needing help!
>
> Tha
2014-08-16 21:45 GMT+02:00 Aaron Law :
>
> Hi all,
>
> I have php web programming background, and new to Django. I am helping my
> brother to build an online system to manage inventory, and I've got a
> database design & coding problem recently. Needing help!
>
> That is, I have a set of tables of
another way is not to use fk but generic field, where patent_id is a normal
integer field. In a custom manager you have to manage the data content in
this field with data content in table field to retrieve yr linked record.
Il giorno sabato 16 agosto 2014 21:46:33 UTC+2, Aaron Law ha scritto:
>
I think there really are two ways to do it, as you say.
Either use a GenericForeignKey(), or have multiple ForeignKey(null=True,
blank=True), each one pointing to a different model. I personally use the
multiple foreign keys approach, but this is the case that GenericForeignKey
was designed for
Hi all,
I have php web programming background, and new to Django. I am helping my
brother to build an online system to manage inventory, and I've got a
database design & coding problem recently. Needing help!
That is, I have a set of tables of "possible products", "inventory",
"suppiler", etc. I
to' object and so the
'filter(likes__user=user)' part must iterate through them in a way. Anyway
it works.
Cheers,
Bastian
On Thursday, October 18, 2012 6:46:14 PM UTC+2, Bastian wrote:
>
> Hi, I'm not sure to understand what I'm doing here :) I have a model of a
> ph
Hi, I'm not sure to understand what I'm doing here :) I have a model of a
photo with name, description, image field... and a generic foreign key
called 'likes' to store the photo in users' favorites:
likes = generic.GenericRelation(Like)
and in the Like model I have:
I went ahead and hardcoded checks for fields that as of today I know
will only be in one of the models. I would still love to hear any
cleaner solutions if anyone has them.
On Aug 26, 10:12 am, John wrote:
> Any ideas?
>
> In the inline model's validation I could hardcode checks for data that
> I
Any ideas?
In the inline model's validation I could hardcode checks for data that
I expect will only be in one of the models, but that does not seem
like the best option. I am still hoping for a simpler alternative to
this.
Thanks.
--
You received this message because you are subscribed to the
Hi there,
I am writing an app with Django where I have a model with a generic
foreign key. I
am looking to do some validation on this model based on the
content_type of the
generic foreign key. When I am modifying this model on its admin page,
I am
able to easily determine the content_type
Hi,
Here's the problem:
class AssociationClass(models.Model):
fk_model1 = models.IntegerField()
fk_model2 = models.IntegerField()
model2_type = models.IntegerField()
after an inspectdb, I would like to tell django that this is an
association class, with a generic foreign key.
17 matches
Mail list logo