Thank you for your reply.
here are my models. Forms below.
MODELS
class Customers(Prospects):
cust_id = models.IntegerField(default=0)
vertical_cat = models.IntegerField(default=0)
custom_cat = models.IntegerField(default=0)
logo = models.ImageField(default='default.png', upload_to='media/cust-logos/')
max_scripts = models.IntegerField(default=0)
branch_custom_scripts = models.BooleanField(default=False)
receive_emails = models.BooleanField(default=True)
customer_rep_id = models.SmallIntegerField(default=0)
customer_writer_id = models.SmallIntegerField(default=0)
customer_male_vt_id = models.SmallIntegerField(default=0)
customer_fem_vt = models.SmallIntegerField(default=0)
customer_sales_rep = models.SmallIntegerField(default=0)
contract_date_first = models.DateTimeField(default=None, null=True, blank=True)
contract_date_renewal = models.DateTimeField(default=None, null=True, blank=True)
contract_billing_type = models.CharField(max_length=200, null=True, blank=True)
anniversary = models.DateTimeField(default=None, null=True, blank=True)
is_on_contract = models.BooleanField(default=False)
internal_flag = models.IntegerField(default=0)
shuff_freq_pref = models.SmallIntegerField(default=0)
shuff_freq_upd = models.DateTimeField(default=None, null=True, blank=True)
shuff_freq_7 = models.BooleanField(default=True)
shuff_freq_14 = models.BooleanField(default=True)
shuff_freq_30 = models.BooleanField(default=True)
shuff_freq_60 = models.BooleanField(default=True)
shuff_freq_90 = models.BooleanField(default=True)
shuff_freq_180 = models.BooleanField(default=False)
shuff_walk_thru = models.DateTimeField(default=None, null=True, blank=True)
shuff_walk_thru_by = models.SmallIntegerField(models.ForeignKey(Emp, on_delete=models.CASCADE), default=0)
cust_classification = models.ForeignKey(CustomerClasses, on_delete=models.CASCADE)
date_updated = models.DateTimeField(auto_now=True, null=True, blank=True)
updated_by = models.SmallIntegerField(default=0)
audit_note = models.TextField(default=None, null=True, blank=True)
audit_exception = models.BooleanField(default=False)
audit_date = models.DateTimeField(auto_now_add=True)
script_exception = models.BooleanField(default=False)
script_exception_date = models.DateTimeField(default=None, null=True, blank=True)
reports_exception = models.BooleanField(default=False)
reports_exception_date = models.DateTimeField(default=None, null=True, blank=True)
using_script_credits = models.BooleanField(default=False)
def __str__(self):
return self.company_name
def get_absolute_url(self):
return reverse('cust-detail', args=[
self.id])
class CustomerRegions(models.Model):
region = models.CharField(max_length=100)
customer = models.ForeignKey(Customers, on_delete=models.CASCADE)
def __str__(self):
return self.region
FORMS
class CustomerForm(forms.ModelForm):
class Meta:
model = Customers
fields = 'company_name', 'contact1_first_name', \
'contact1_last_name', 'email', 'contact2_first_name', \
'contact2_last_name', 'contact2_email', \
'contact2_phone', 'address1', 'address2', \
'city', 'state', 'zip_code', 'phone', \
'mobile', 'web_address', 'notes', \
'cust_classification', 'logo'
class RegionWCust(forms.ModelForm):
class Meta:
model = CustomerRegions
fields = ('region',)