Hi, it seems like *Contractor* class is defined in *RfqInstance* class, just like class *Meta* is.
Adam Dne pá 2. 8. 2019 20:55 uživatel Kean <kean...@gmail.com> napsal: > Hi, > Im new to django, im trying to create a workflow, whereby a customer > creates an RFQ, this flow to a contractor, who can > then accept or decline the quote plus add quote price for accepted quote,. > On return flow, the customer can agree quote, > which turns into order and flows back to contractor. > > In the first step im creating the quote flow, but am not able to import > contractor table and make migrations. > > please see model.py below, can anyone help to id what is wrong and what i > can do to correct? > > from django.db import models > import uuid > > > # Create your models here. > > # model for the quote > > class Rfq(models.Model): > Customer_name = models.ForeignKey('Quote', on_delete=models.SET_NULL, > null=True) > Brief_work = models.CharField(max_length=100, help_text = 'Enter brief > heading description of the work (e.g. Fit a new kitched)') > Detail_work = models.TextField(max_length=500) > Address_work = models.CharField(max_length=200) > > def __str__(self): > return self.Brief_work > > # rfq instance in the workflow > > class RfqInstance(models.Model): > Id = models.UUIDField(primary_key=True, default=uuid.uuid4, max_length=8, > unique=True, editable=False, > help_text='quote ID number for track and trace') > Quote = models.ForeignKey('Quote', on_delete=models.SET_NULL, null=True) > Quote_date = models.DateField(null=True, blank=True) > Expiry_quote = models.DateField(null=True, blank=True) > > QUOTE_STATUS = ( > ('R', 'Raised'), > ('I', 'Issued'), > ('U', 'Contractor updated'), > ('QR', 'Contractor returned quote'), > ('QA', 'Quote accepted by customer'), > ('QR', 'Quote rejected by customer'), > ) > > status = models.CharField(max_length=3, choices=QUOTE_STATUS, blank=True, > default='Pen', help_text='Rfq status guide') > > class Meta: > quoting = ['Quote_date'] > > def __str__(self): > return f'{self.Quote_id} ({self.customer_name.quote})' > > class Contractor(models.Model): > Contractor_name = models.CharField(max_length=50) > Contractor_businessname = models.CharField(max_length=100) > Contractor_address = models.CharField(max_length=100) > Contractor_comments = models.CharField(max_length=300) > Duration_work = models.CharField(max_length=50) > Quote_price = models.CharField(max_length=20) > Quote_date = models.DateField(null=True, blank=True) > Expiry_quote = models.DateField(null=True, blank=True) > > class Meta: > ordering: ['Quote_price'] > > def __str__(self): > return f'{self.Contractor_name}, {self.Quote_price}' > > Best, > > K > > -- > 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/5746adcd-bdac-42d9-8b77-b39ae7587615%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/5746adcd-bdac-42d9-8b77-b39ae7587615%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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAB9%3DGXZ%2BmcMjXGnX1j90%3Dyd8aZ9g%3DxDp3FM9gRr6FgaokEgbjg%40mail.gmail.com.