Having followed all the suggestions, I am now stuck. I have simplified the database by removing one model. I get to the point of
-- python manage.py makemigrations and it returns with what looks right. However, the migrate command just throws out a bunch of errors. For some reason,
it is looking at the choices variable field and telling me that 'following' is not an integer field. From the directions I read, in similar posts, it seemed like too many parentheses were used for the
CHOICES.
Here is what I have now. I hope this is helpful in getting this to work.
See below:
from django.db import models
class ContactOrOrganization(models.Model):
name = models.CharField(max_length=40)
organization = models.CharField(max_length=60, null=True, blank=True)
street_line1 = models.CharField("Street Line 1", max_length=50, null=True, blank=True)
street_line2 = models.CharField("Street Line 2", max_length=50, null=True, blank=True)
city = models.CharField(max_length=40, null=True, blank=True)
state = models.CharField(max_length=40, null=True, blank=True)
zipcode = models.CharField(max_length=20, blank=True, null=True)
phone1 = models.CharField(max_length=20, null=True, blank=True)
phone2 = models.CharField(max_length=20, null=True, blank=True)
email = models.EmailField(max_length=60, null=True, blank=True)
website = models.URLField(max_length=90, null=True, blank=True)
connections = models.ForeignKey('Connection', on_delete=models.CASCADE)
class Connection(models.Model):
CHOICES = (('following', 'Following'),
('family', 'Family'),
('friend', 'Friend'),
('clients', 'Clients'),
('recruiters', 'Recruiters'),
('acquaintances', 'Acquaintances'),
('employers', 'Employers'),
('Employment_Agencies', 'Employment Agencies'),
('unspecified', 'Unspecified'),
)
organization = models.ForeignKey("ContactOrOrganization", related_name="Contact_Organization", null=True, blank=True)
contact = models.ForeignKey("ContactOrOrganization", related_name="contact", null=True, blank=True)
connection_type = models.CharField(max_length=60, choices=CHOICES)
Thanks in advance for any help,
Bruce
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eb67f110-3c66-4098-ad80-c5a7cbc85822%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment