I am new to Django I am working on eCommerce website I want to modify/customize existing user model and some new tables to DB e.g below
monthList = (
('Jan','Jan'),
('Feb','Feb'),
('Mar', 'Mar'),
('Apr', 'Apr'),
('May', 'May'),
('Jun', 'Jun'),
('Jul', 'Jul'),
('Aug', 'Aug'),
('Sep', 'Sep'),
('Oct', 'Oct'),
('Nov', 'Nov'),
('Dec', 'Dec'),
)
stateChoices = (
('MA', 'Massachusetts'),
('RI', 'Rhode Island'),
('CT', 'Connecticut'),
('NH', 'New Hampshire'),
('ME', 'Maine'),
('AK', 'Alaska'),
('AL', 'Alabama'),
('AR', 'Arkansas'),
('AS', 'American Samoa'),
('AZ', 'Arizona'),
('CA', 'California'),
('CO', 'Colorado'),
('DC', 'District_of_Columbia'),
('DE', 'Delaware'),
('FL', 'Florida'),
('GA', 'Georgia'),
('GU', 'Guam'),
('HI', 'Hawaii'),
('IA', 'Iowa'),
('ID', 'Idaho'),
('IL', 'Illinois'),
('IN', 'Indiana'),
('KS', 'Kansas'),
('KY', 'Kentucky'),
('LA', 'Louisiana'),
('MD', 'Maryland'),
('MI', 'Michigan'),
('MN', 'Minnesota'),
('MO', 'Missouri'),
('MP', 'Northern_Mariana_Islands'),
('MS', 'Mississippi'),
('MT', 'Montana'),
('NA', 'National'),
('NC', 'North Carolina'),
('ND', 'North Dakota'),
('NE', 'Nebraska'),
('NJ', 'New Jersey'),
('NM', 'New Mexico'),
('NV', 'Nevada'),
('NY', 'New York'),
('OH', 'Ohio'),
('OK', 'Oklahoma'),
('OR', 'Oregon'),
('PA', 'Pennsylvania'),
('PR', 'Puerto Rico'),
('SC', 'South Carolina'),
('SD', 'South Dakota'),
('TN', 'Tennessee'),
('TX', 'Texas'),
('UT', 'Utah'),
('VA', 'Virginia'),
('VI', 'Virgin Islands'),
('VT', 'Vermont'),
('WA', 'Washington'),
('WI', 'Wisconsin'),
('WV', 'West Virginia'),
('WY', 'Wyoming'),
)
class Profile(models.Model):
user = models.ForeignKey(User)
fName = models.CharField(max_length=200, verbose_name='First Name')
lName = models.CharField(max_length=200, verbose_name='Last Name')
telephone = models.CharField(max_length=15, verbose_name='Telephone Number')
def __str__(self):
return '%s %s' % (self.fName, self.lName)
class ShippingAddress(models.Model):
profile = models.ForeignKey(Profile, blank=True, null=True)
name = models.CharField(max_length=200)
telephone = models.CharField(max_length=200, blank=True, null=True)
email = models.EmailField(max_length=200, blank=True, null=True)
address = models.TextField()
preferred = models.BooleanField(default=False)
class Meta:
verbose_name='Shipping Address'
verbose_name_plural='Shipping Addresses'
def __str__(self):
return self.name
class BillingAddress(models.Model):
profile = models.ForeignKey(Profile, blank=True, null=True)
name = models.CharField(max_length=200)
telephone = models.CharField(max_length=200, blank=True, null=True)
email = models.EmailField(max_length=200, blank=True, null=True)
address = models.TextField()
preferred = models.BooleanField(default=False)
class Meta:
verbose_name='Billing Address'
verbose_name_plural='Billing Addresses'
def __str__(self):
return self.name
How could I achieve this in cookiecutter-django? please help me or redirect me to the solution if already provided I would be very thankful to all of you.
Hey @s4starb4boy,
It is good you are using Cookiecutter Django but I would like to give you some advice.
I hope I did not come out as not being empathetic with your situation but I think this is better for you than all of us here being silent about your question.
What do you think?
"This board is for issues that come up between the parts that make up Cookiecutter Django." being a newbie I really do apologize for my question. and Thanks for your advice >"Going back to 1., there is be no reason to begin with Cookiecutter Django and yet you area beginner in using Django. This will be very frustrating for you." though it discouraged me but I'd keep doing and find an other forum for help.Thx
As @Afrowave said, it's a general Django topic, not specific to Cookiecutter Django.
These types of questions would reach a far broader audience elsewhere than on this issue tracker, where only a handful of people are notified. Here are a few places I would suggest:
#djangoStackoverflow or not, I would recommend following some of their tips to ask a good question. Please keep in mind that you're asking people for some of their time.
English is not my first language (like many out there), and reading your original post, I'm not sure I understand your question.
I'm going to close this issue, it's out of scope of the project, I hope the links I gave will be helpful.
Thanks all of you. I've already found the solution. you can delete my question/post/thread or whatever you want to.