MICROBA-311 Add US State field to UserProfile
Add list of states and field to UserProfile model; add migration; add state field to relevant serializers and to ACCOUNT_VISIBILITY_CONFIGURATION. Removes state data if country is changed to something other than United States.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.12 on 2020-04-30 20:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('student', '0032_removed_logout_view_configuration'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='userprofile',
|
||||
name='state',
|
||||
field=models.CharField(blank=True, choices=[('AL', 'Alabama'), ('AK', 'Alaska'), ('AZ', 'Arizona'), ('AR', 'Arkansas'), ('AA', 'Armed Forces Americas'), ('AE', 'Armed Forces Europe'), ('AP', 'Armed Forces Pacific'), ('CA', 'California'), ('CO', 'Colorado'), ('CT', 'Connecticut'), ('DE', 'Delaware'), ('DC', 'District Of Columbia'), ('FL', 'Florida'), ('GA', 'Georgia'), ('HI', 'Hawaii'), ('ID', 'Idaho'), ('IL', 'Illinois'), ('IN', 'Indiana'), ('IA', 'Iowa'), ('KS', 'Kansas'), ('KY', 'Kentucky'), ('LA', 'Louisiana'), ('ME', 'Maine'), ('MD', 'Maryland'), ('MA', 'Massachusetts'), ('MI', 'Michigan'), ('MN', 'Minnesota'), ('MS', 'Mississippi'), ('MO', 'Missouri'), ('MT', 'Montana'), ('NE', 'Nebraska'), ('NV', 'Nevada'), ('NH', 'New Hampshire'), ('NJ', 'New Jersey'), ('NM', 'New Mexico'), ('NY', 'New York'), ('NC', 'North Carolina'), ('ND', 'North Dakota'), ('OH', 'Ohio'), ('OK', 'Oklahoma'), ('OR', 'Oregon'), ('PA', 'Pennsylvania'), ('RI', 'Rhode Island'), ('SC', 'South Carolina'), ('SD', 'South Dakota'), ('TN', 'Tennessee'), ('TX', 'Texas'), ('UT', 'Utah'), ('VT', 'Vermont'), ('VA', 'Virginia'), ('WA', 'Washington'), ('WV', 'West Virginia'), ('WI', 'Wisconsin'), ('WY', 'Wyoming')], max_length=2, null=True),
|
||||
),
|
||||
]
|
||||
@@ -500,6 +500,64 @@ class UserProfile(models.Model):
|
||||
mailing_address = models.TextField(blank=True, null=True)
|
||||
city = models.TextField(blank=True, null=True)
|
||||
country = CountryField(blank=True, null=True)
|
||||
COUNTRY_WITH_STATES = u'US'
|
||||
STATE_CHOICES = (
|
||||
('AL', 'Alabama'),
|
||||
('AK', 'Alaska'),
|
||||
('AZ', 'Arizona'),
|
||||
('AR', 'Arkansas'),
|
||||
('AA', 'Armed Forces Americas'),
|
||||
('AE', 'Armed Forces Europe'),
|
||||
('AP', 'Armed Forces Pacific'),
|
||||
('CA', 'California'),
|
||||
('CO', 'Colorado'),
|
||||
('CT', 'Connecticut'),
|
||||
('DE', 'Delaware'),
|
||||
('DC', 'District Of Columbia'),
|
||||
('FL', 'Florida'),
|
||||
('GA', 'Georgia'),
|
||||
('HI', 'Hawaii'),
|
||||
('ID', 'Idaho'),
|
||||
('IL', 'Illinois'),
|
||||
('IN', 'Indiana'),
|
||||
('IA', 'Iowa'),
|
||||
('KS', 'Kansas'),
|
||||
('KY', 'Kentucky'),
|
||||
('LA', 'Louisiana'),
|
||||
('ME', 'Maine'),
|
||||
('MD', 'Maryland'),
|
||||
('MA', 'Massachusetts'),
|
||||
('MI', 'Michigan'),
|
||||
('MN', 'Minnesota'),
|
||||
('MS', 'Mississippi'),
|
||||
('MO', 'Missouri'),
|
||||
('MT', 'Montana'),
|
||||
('NE', 'Nebraska'),
|
||||
('NV', 'Nevada'),
|
||||
('NH', 'New Hampshire'),
|
||||
('NJ', 'New Jersey'),
|
||||
('NM', 'New Mexico'),
|
||||
('NY', 'New York'),
|
||||
('NC', 'North Carolina'),
|
||||
('ND', 'North Dakota'),
|
||||
('OH', 'Ohio'),
|
||||
('OK', 'Oklahoma'),
|
||||
('OR', 'Oregon'),
|
||||
('PA', 'Pennsylvania'),
|
||||
('RI', 'Rhode Island'),
|
||||
('SC', 'South Carolina'),
|
||||
('SD', 'South Dakota'),
|
||||
('TN', 'Tennessee'),
|
||||
('TX', 'Texas'),
|
||||
('UT', 'Utah'),
|
||||
('VT', 'Vermont'),
|
||||
('VA', 'Virginia'),
|
||||
('WA', 'Washington'),
|
||||
('WV', 'West Virginia'),
|
||||
('WI', 'Wisconsin'),
|
||||
('WY', 'Wyoming'),
|
||||
)
|
||||
state = models.CharField(blank=True, null=True, max_length=2, choices=STATE_CHOICES)
|
||||
goals = models.TextField(blank=True, null=True)
|
||||
allow_certificate = models.BooleanField(default=1)
|
||||
bio = models.CharField(blank=True, null=True, max_length=3000, db_index=False)
|
||||
|
||||
Reference in New Issue
Block a user