Glad to be of help. Sometimes it just takes a fresh pair of eyes.

On Fri, 2021-06-11 at 17:33 -0500, frank dilorenzo wrote:
> I hate to sound corny but you sir are my hero!.  Thanks,  it all
> works now
>  
> frank-
> 
> 
> On Fri, Jun 11, 2021 at 2:43 PM Adam Stein <a...@csh.rit.edu> wrote:
> > Since you said 3 separate apps, I assume each of these classes are
> > in a separate file. However, you have the line:
> > 
> > from .models import Supplier
> > 
> > which would make it seem that Supplier is defined in the same file
> > as Shipment. Shipment should be in ".models" and if Supplier is
> > also defined in the same file, no need to import it. If it's
> > defined in a different file, then the import should reference
> > another place, not ".models".
> > 
> > On Fri, 2021-06-11 at 12:22 -0700, frank dilorenzo wrote:
> > > Hello,  I have 3 separate app as follow:
> > > from django.db import models
> > > 
> > > # Create your models here.
> > > 
> > > # Supplier can have many shipments
> > > class Supplier(models.Model):
> > > name = models.CharField(max_length=120, null=True)
> > > phone = models.CharField(max_length=15, null=True)
> > > email = models.CharField(max_length=120, null=True)
> > > created = models.DateTimeField(auto_now_add=True)
> > > updated = models.DateTimeField(auto_now=True)
> > > 
> > > def __str__(self):
> > > return self.name
> > > -----------------------------------------
> > > from django.db import models
> > > from django.utils import timezone
> > > 
> > > # Create your models here.
> > > 
> > > # A specie can belong to many shipments
> > > class Specie(models.Model):
> > > name = models.CharField(max_length=120, null=True)
> > > image = models.ImageField(upload_to="species",
> > > default="no_picture.png")
> > > created = models.DateTimeField(default=timezone.now)
> > > 
> > > def __str__(self):
> > > return self.name
> > > --------------------------------------------
> > > from django.db import models
> > > from .models import Supplier
> > > 
> > > # from .models import Supplier, Specie
> > > 
> > > # Create your models here.
> > > 
> > > # A shipment can have many species
> > > class Shipment(models.Model):
> > > 
> > > supplier = models.ManyToManyField(Suppliers)
> > > specie = models.ManyToManyField(Species)
> > > 
> > > name = models.CharField(
> > > max_length=120, null=True, help_text="enter name from Supplier
> > > above..."
> > > )
> > > slabel = models.CharField(max_length=10)
> > > received = models.PositiveIntegerField(default=0)
> > > bad = models.PositiveIntegerField(default=0)
> > > non = models.PositiveIntegerField(default=0)
> > > doa = models.PositiveIntegerField(default=0)
> > > para = models.PositiveIntegerField(default=0)
> > > released = models.PositiveIntegerField(default=0)
> > > entered = models.BooleanField(default=False)
> > > created = models.DateTimeField(default=timezone.now)
> > > 
> > > def __str__(self):
> > > return f"{self.slabel}"
> > > 
> > > =======================
> > > 
> > > when trying to migrate I get this error message:
> > > 
> > > ImportError: cannot import name 'Supplier' from partially
> > > initialized module 'shipments.models' (most likely due to a
> > > circular import)
> > > (/Users/frankd/django_projects/stlzoo/src/shipments/models.py)
> > > 
> > > I am stuck here and cannot seem to resolve this error.  I would
> > > truly appreciate any help on this.  Thanks.
> > > 
> > > Frank
> > > -- 
> > > 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 view this discussion on the web visit
> > >
> >
> https://groups.google.com/d/msgid/django-users/c0aff4c4-651a-43ad-9ac9-42c6452a33f4n%40googlegroups.com
> > > .
> > 
> > 
> > -- 
> > Adam (a...@csh.rit.edu)
> > 

-- 
Adam (a...@csh.rit.edu)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/34fe18d800ae49957c4a6ababcc80d943bf95295.camel%40csh.rit.edu.

Reply via email to