I have 2 simple models; a “JobInfo” model and a “Contact” model.
class JobInfo(models.Model):
client = models.CharField(max_length=50, choices=CLIENT_CHOICES)
job_number = models.CharField(max_length=30, unique=True, blank=True, null=True)
page_type = models.CharField(max_length=50, choices=PT_CHOICES)
contact = models.CharField(max_length=50, choices=CONTACT_CHOICES?)
def __unicode__ (self):
return self.job_number
class Admin:
pass
class Contact(models.Model):
name = models.CharField(max_length=64, unique=False, blank=True, null=True)
position = models.CharField(max_length=50, choices=CLIENT_CHOICES)
phone = models.CharField(max_length=15, unique=False, blank=True, null=True)
fax = models.CharField(max_length=15, unique=False, blank=True, null=True)
email = models.EmailField()
def __unicode__ (self):
return self.name
class Admin:
pass
Can my “Contact” objects (from Contact Model) be choices for the contact field in the “JobInfo” model? I’d like to be able to select contacts in my JobInfo form and have those Contact properties available to display in the same template.
You want to create a relationship, right?
So the contact field on your JobInfo model should look like this: