Friday, August 2, 2019

Creating a workflow for customer contractor not importing..

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+unsubscribe@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.

No comments:

Post a Comment