Thank you so much.  Have a great day!

frank-


On Wed, Jan 26, 2022 at 6:51 AM bnmng <[email protected]> wrote:

> I would start by defining Supplier in your models.py, then Shipment with a
> ForeignKey reference to Supplier
>
> I'm assuming (forgive me if I'm wrong) that not only can a shipment have
> many species, but a species can be in many shipments, so if that's the
> case, the most obvious way is to go with ManyToMany for that relationship
>
> https://docs.djangoproject.com/en/4.0/topics/db/examples/many_to_many/
>
> class Supplier(models.Model):
>     (etc..etc..)
>
> class Shipment(models.Model):
>     supplier = models.ForeignKey(
>         Supplier,
>         on_delete=models. (...etc.. etc...)
>
> class Species(models.Model):
>     shipment = models.ManyToManyField(
>         Shipment,
>         (etc..)
> On Monday, January 24, 2022 at 8:59:10 AM UTC-5 [email protected] wrote:
>
>> I have tried several different ways but I cannot seem to get this right.
>> What I have is a list
>> of suppliers.  Each supplier can have many shipments and each shipment
>> can have many species.  Seems simple enough but apparently I must be more
>> simple.
>>
>> I need a suggestion of how to relate these table.
>>
>> a supplier can have many shipment.  A shipment can have many species.
>> Any help would be appreciated.  Thanks.
>>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bc667e81-ce32-4df5-8f88-47dff3d852c8n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/bc667e81-ce32-4df5-8f88-47dff3d852c8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJbiy1Bm1aDHL_mt-%2B-FjFqrFz2yHqFc8M4MOdqs7kSa%2BFGUkg%40mail.gmail.com.

Reply via email to