Commit 442d941d by David Adams Committed by Giulio Gratta

Changes to CME registration form

These changes bring the form to Nov 12 specs.
parent 88e2654a
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'CmeUserProfile.how_stanford_affiliated'
db.delete_column('cme_registration', 'how_stanford_affiliated')
# Deleting field 'CmeUserProfile.profession'
db.delete_column('cme_registration', 'profession')
# Deleting field 'CmeUserProfile.stanford_affiliated'
db.delete_column('cme_registration', 'stanford_affiliated')
# Deleting field 'CmeUserProfile.phone_number'
db.delete_column('cme_registration', 'phone_number')
# Deleting field 'CmeUserProfile.fax'
db.delete_column('cme_registration', 'fax')
# Deleting field 'CmeUserProfile.hear_about_us'
db.delete_column('cme_registration', 'hear_about_us')
# Deleting field 'CmeUserProfile.mailing_list'
db.delete_column('cme_registration', 'mailing_list')
# Deleting field 'CmeUserProfile.state_province'
db.delete_column('cme_registration', 'state_province')
# Deleting field 'CmeUserProfile.extension'
db.delete_column('cme_registration', 'extension')
# Deleting field 'CmeUserProfile.organization'
db.delete_column('cme_registration', 'organization')
# Adding field 'CmeUserProfile.first_name'
db.add_column('cme_registration', 'first_name',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.last_name'
db.add_column('cme_registration', 'last_name',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.middle_initial'
db.add_column('cme_registration', 'middle_initial',
self.gf('django.db.models.fields.CharField')(max_length=1, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.birth_date'
db.add_column('cme_registration', 'birth_date',
self.gf('django.db.models.fields.CharField')(max_length=5, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.license_country'
db.add_column('cme_registration', 'license_country',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.license_state'
db.add_column('cme_registration', 'license_state',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.physician_status'
db.add_column('cme_registration', 'physician_status',
self.gf('django.db.models.fields.CharField')(max_length=8, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.affiliation'
db.add_column('cme_registration', 'affiliation',
self.gf('django.db.models.fields.CharField')(max_length=46, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.other_affiliation'
db.add_column('cme_registration', 'other_affiliation',
self.gf('django.db.models.fields.CharField')(max_length=46, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.sub_affiliation'
db.add_column('cme_registration', 'sub_affiliation',
self.gf('django.db.models.fields.CharField')(max_length=46, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.stanford_department'
db.add_column('cme_registration', 'stanford_department',
self.gf('django.db.models.fields.CharField')(max_length=46, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.sunet_id'
db.add_column('cme_registration', 'sunet_id',
self.gf('django.db.models.fields.CharField')(max_length=33, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.state'
db.add_column('cme_registration', 'state',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.county_province'
db.add_column('cme_registration', 'county_province',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Changing field 'CmeUserProfile.license_number'
db.alter_column('cme_registration', 'license_number', self.gf('django.db.models.fields.CharField')(max_length=20, null=True))
# Changing field 'CmeUserProfile.professional_designation'
db.alter_column('cme_registration', 'professional_designation', self.gf('django.db.models.fields.CharField')(max_length=25, null=True))
def backwards(self, orm):
# Adding field 'CmeUserProfile.how_stanford_affiliated'
db.add_column('cme_registration', 'how_stanford_affiliated',
self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.profession'
db.add_column('cme_registration', 'profession',
self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.stanford_affiliated'
db.add_column('cme_registration', 'stanford_affiliated',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
# Adding field 'CmeUserProfile.phone_number'
db.add_column('cme_registration', 'phone_number',
self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.fax'
db.add_column('cme_registration', 'fax',
self.gf('django.db.models.fields.CharField')(max_length=30, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.hear_about_us'
db.add_column('cme_registration', 'hear_about_us',
self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.mailing_list'
db.add_column('cme_registration', 'mailing_list',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
# Adding field 'CmeUserProfile.state_province'
db.add_column('cme_registration', 'state_province',
self.gf('django.db.models.fields.CharField')(max_length=50, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.extension'
db.add_column('cme_registration', 'extension',
self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True),
keep_default=False)
# Adding field 'CmeUserProfile.organization'
db.add_column('cme_registration', 'organization',
self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True),
keep_default=False)
# Deleting field 'CmeUserProfile.first_name'
db.delete_column('cme_registration', 'first_name')
# Deleting field 'CmeUserProfile.last_name'
db.delete_column('cme_registration', 'last_name')
# Deleting field 'CmeUserProfile.middle_initial'
db.delete_column('cme_registration', 'middle_initial')
# Deleting field 'CmeUserProfile.birth_date'
db.delete_column('cme_registration', 'birth_date')
# Deleting field 'CmeUserProfile.license_country'
db.delete_column('cme_registration', 'license_country')
# Deleting field 'CmeUserProfile.license_state'
db.delete_column('cme_registration', 'license_state')
# Deleting field 'CmeUserProfile.physician_status'
db.delete_column('cme_registration', 'physician_status')
# Deleting field 'CmeUserProfile.affiliation'
db.delete_column('cme_registration', 'affiliation')
# Deleting field 'CmeUserProfile.other_affiliation'
db.delete_column('cme_registration', 'other_affiliation')
# Deleting field 'CmeUserProfile.sub_affiliation'
db.delete_column('cme_registration', 'sub_affiliation')
# Deleting field 'CmeUserProfile.stanford_department'
db.delete_column('cme_registration', 'stanford_department')
# Deleting field 'CmeUserProfile.sunet_id'
db.delete_column('cme_registration', 'sunet_id')
# Deleting field 'CmeUserProfile.state'
db.delete_column('cme_registration', 'state')
# Deleting field 'CmeUserProfile.county_province'
db.delete_column('cme_registration', 'county_province')
# Changing field 'CmeUserProfile.license_number'
db.alter_column('cme_registration', 'license_number', self.gf('django.db.models.fields.CharField')(max_length=255, null=True))
# Changing field 'CmeUserProfile.professional_designation'
db.alter_column('cme_registration', 'professional_designation', self.gf('django.db.models.fields.CharField')(max_length=3, null=True))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'cme_registration.cmeuserprofile': {
'Meta': {'object_name': 'CmeUserProfile', 'db_table': "'cme_registration'", '_ormbases': ['student.UserProfile']},
'address_1': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'address_2': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'affiliation': ('django.db.models.fields.CharField', [], {'max_length': '46', 'null': 'True', 'blank': 'True'}),
'birth_date': ('django.db.models.fields.CharField', [], {'max_length': '5', 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'county_province': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'license_country': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'license_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
'license_state': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'middle_initial': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
'other_affiliation': ('django.db.models.fields.CharField', [], {'max_length': '46', 'null': 'True', 'blank': 'True'}),
'patient_population': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}),
'physician_status': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'}),
'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
'professional_designation': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}),
'specialty': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'stanford_department': ('django.db.models.fields.CharField', [], {'max_length': '46', 'null': 'True', 'blank': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'sub_affiliation': ('django.db.models.fields.CharField', [], {'max_length': '46', 'null': 'True', 'blank': 'True'}),
'sub_specialty': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'sunet_id': ('django.db.models.fields.CharField', [], {'max_length': '33', 'null': 'True', 'blank': 'True'}),
'userprofile_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['student.UserProfile']", 'unique': 'True', 'primary_key': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'student.userprofile': {
'Meta': {'object_name': 'UserProfile', 'db_table': "'auth_userprofile'"},
'allow_certificate': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'courseware': ('django.db.models.fields.CharField', [], {'default': "'course.xml'", 'max_length': '255', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '6', 'null': 'True', 'blank': 'True'}),
'goals': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
'level_of_education': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '6', 'null': 'True', 'blank': 'True'}),
'location': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
'mailing_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'meta': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}),
'year_of_birth': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})
}
}
complete_apps = ['cme_registration']
\ No newline at end of file
...@@ -18,103 +18,149 @@ class CmeUserProfile(UserProfile): ...@@ -18,103 +18,149 @@ class CmeUserProfile(UserProfile):
class Meta: class Meta:
db_table = "cme_registration" db_table = "cme_registration"
PROFESSION_CHOICES = (('Allied Health Professional', 'Allied Health Professional'), first_name = models.CharField(max_length=50, blank=True, null=True)
('Fellow', 'Fellow'), last_name = models.CharField(max_length=50, blank=True, null=True)
('Nurse', 'Nurse'), middle_initial = models.CharField(max_length=1, blank=True, null=True)
('Nurse Practioner', 'Nurse Practioner'), birth_date = models.CharField(max_length=5, blank=True, null=True)
('Physician', 'Physician'),
('Physician Assistant', 'Physician Assistant'),
('Resident', 'Resident'),
('Student', 'Student'))
profession = models.CharField(blank=True, null=True, max_length=30, choices=PROFESSION_CHOICES)
PROFESSIONAL_DESIGNATION_CHOICES = (('MD', 'MD'), PROFESSIONAL_DESIGNATION_CHOICES = (('DO', 'DO'),
('DO', 'DO'), ('MD', 'MD'),
('PA', 'PA'), ('MD, PhD', 'MD, PhD'),
('MBBS', 'MBBS'),
('NP', 'NP'), ('NP', 'NP'),
('RN', 'RN')) ('PA', 'PA'),
professional_designation = models.CharField(blank=True, null=True, max_length=3, choices=PROFESSIONAL_DESIGNATION_CHOICES) ('RN', 'RN'),
license_number = models.CharField(blank=True, null=True, max_length=255) ('Other', 'Other'),
organization = models.CharField(blank=True, null=True, max_length=255) ('None', 'None'))
stanford_affiliated = models.BooleanField(default=0) professional_designation = models.CharField(blank=True, null=True, max_length=25, choices=PROFESSIONAL_DESIGNATION_CHOICES)
license_number = models.CharField(max_length=20, blank=True, null=True, )
license_country = models.CharField(max_length=50, blank=True, null=True)
license_state = models.CharField(max_length=50, blank=True, null=True)
HOW_STANFORD_AFFILIATED_CHOICES = (('Lucile Packard Children\'s Hospital at Stanford', 'Lucile Packard Children\'s Hospital at Stanford'), PHYSICIAN_STATUS_CHOICES = (('Active', 'Active'),
('Packard Children\'s Health Alliance (PCHA)', 'Packard Children\'s Health Alliance (PCHA)'), ('Resident', 'Resident'),
('Stanford Hospital & Clinics', 'Stanford Hospital & Clinics'), ('Fellow', 'Fellow'),
('Stanford University', 'Stanford University'), ('Retired', 'Retired'))
('University Healthcare Alliance (UHA)', 'University Healthcare Alliance (UHA)'), physician_status = models.CharField(blank=True, null=True, max_length=8)
('Other', 'Other, please enter:'))
how_stanford_affiliated = models.CharField(blank=True, null=True, max_length=255, choices=HOW_STANFORD_AFFILIATED_CHOICES)
PATIENT_POPULATION_CHOICES = (('Adult', 'Adult'), PATIENT_POPULATION_CHOICES = (('Adult', 'Adult'),
('Pediatric', 'Pediatric'), ('Pediatric', 'Pediatric'),
('Both (Adult/Pediatric)', 'Both (Adult/Pediatric)')) ('Both', 'Both'),
('None', 'None'))
patient_population = models.CharField(blank=True, null=True, max_length=25, choices=PATIENT_POPULATION_CHOICES) patient_population = models.CharField(blank=True, null=True, max_length=25, choices=PATIENT_POPULATION_CHOICES)
specialty = models.CharField(blank=True, null=True, max_length=255) specialty = models.CharField(blank=True, null=True, max_length=255)
sub_specialty = models.CharField(blank=True, null=True, max_length=255) sub_specialty = models.CharField(blank=True, null=True, max_length=255)
AFFILIATION_CHOICES = (('Lucile Packard Children\'s Hospital', 'Lucile Packard Children\'s Hospital'),
('Packard Children\'s Health Alliance', 'Packard Children\'s Health Alliance'),
('Stanford Hospital and Clinics', 'Stanford Hospital and Clinics'),
('Stanford University', 'Stanford University'),
('University Healthcare Alliance', 'University Healthcare Alliance'),
('Other', 'Other'))
affiliation = models.CharField(blank=True, null=True, max_length=46, choices=AFFILIATION_CHOICES)
other_affiliation = models.CharField(blank=True, null=True, max_length=46)
sub_affiliation = models.CharField(blank=True, null=True, max_length=46)
DEPARTMENT_CHOICES = (('Anesthesiology,Perioperative,Pain Medicine', 'Anesthesiology,Perioperative,Pain Medicine'),
('Biochemistry', 'Biochemistry'),
('Cardiothoracic Surgery', 'Cardiothoracic Surgery'),
('Centers - School of Medicine', 'Centers - School of Medicine'),
('Chemical and Systems Biology', 'Chemical and Systems Biology'),
('Comparative Medicine', 'Comparative Medicine'),
('Dermatology', 'Dermatology'),
('Developmental Biology', 'Developmental Biology'),
('Genetics Operations', 'Genetics Operations'),
('Health Research and Policy', 'Health Research and Policy'),
('Medicine', 'Medicine'),
('Microbiology and Immunology', 'Microbiology and Immunology'),
('Molecular and Cellular Physiology', 'Molecular and Cellular Physiology'),
('Neurobiology', 'Neurobiology'),
('Neurology', 'Neurology'),
('Neurosurgery', 'Neurosurgery'),
('Obstetrics & Gynecology', 'Obstetrics & Gynecology'),
('Ophthalmology', 'Ophthalmology'),
('Orthopaedic Surgery', 'Orthopaedic Surgery'),
('Otolaryngology/Head & Neck Surgery', 'Otolaryngology/Head & Neck Surgery'),
('Pathology', 'Pathology'),
('Pediatrics', 'Pediatrics'),
('Psychiatry and Behavioral Sciences', 'Psychiatry and Behavioral Sciences'),
('Radiation Oncology', 'Radiation Oncology'),
('Radiology', 'Radiology'),
('School of Medicine', 'School of Medicine'),
('SoM - Basic Science Pool', 'SoM - Basic Science Pool'),
('SoM - Bio-X/Clark', 'SoM - Bio-X/Clark'),
('SoM - Bioengineering', 'SoM - Bioengineering'),
('SoM - Clinical Science Pool', 'SoM - Clinical Science Pool'),
('SoM - Other Departments', 'SoM - Other Departments'),
('SoM Dean\'s Office Administrative Units', 'SoM Dean\'s Office Administrative Units'),
('SoM Non Cap Projects', 'SoM Non Cap Projects'),
('Stanford Cancer/Stem Cell Biology', 'Stanford Cancer/Stem Cell Biology'),
('Stanford Institutes of Medicine', 'Stanford Institutes of Medicine'),
('Structural Biology Department', 'Structural Biology Department'),
('Surgery', 'Surgery'),
('Urology', 'Urology'),
('Urology - Administration', 'Urology - Administration'),
('Urology - Divisions', 'Urology - Divisions'))
stanford_department = models.CharField(blank=True, null=True, max_length=46, choices=DEPARTMENT_CHOICES)
sunet_id = models.CharField(blank=True, null=True, max_length=33)
address_1 = models.TextField(blank=True, null=True) address_1 = models.TextField(blank=True, null=True)
address_2 = models.TextField(blank=True, null=True) address_2 = models.TextField(blank=True, null=True)
city = models.TextField(blank=True, null=True) city = models.TextField(blank=True, null=True)
STATE_CHOICES = (('Alabama', 'Alabama'), STATE_CHOICES = (('AL', 'Alabama'),
('Alaska', 'Alaska'), ('AK', 'Alaska'),
('Arizona', 'Arizona'), ('AZ', 'Arizona'),
('Arkansas', 'Arkansas'), ('AR', 'Arkansas'),
('California', 'California'), ('CA', 'California'),
('Colorado', 'Colorado'), ('CO', 'Colorado'),
('Connecticut', 'Connecticut'), ('CT', 'Connecticut'),
('Delaware', 'Deleware'), ('DE', 'Deleware'),
('District of Columbia', 'District of Columbia'), ('DC', 'District of Columbia'),
('Florida', 'Florida'), ('FL', 'Florida'),
('Georgia', 'Georgia'), ('GA', 'Georgia'),
('Hawaii', 'Hawaii'), ('HI', 'Hawaii'),
('Idaho', 'Idaho'), ('ID', 'Idaho'),
('Illinois', 'Indiana'), ('IL', 'Illinois'),
('Iowa', 'Iowa'), ('IN', 'Indiana'),
('Kansas', 'Kansas'), ('IA', 'Iowa'),
('Kentucky', 'Kentucky'), ('KS', 'Kansas'),
('Louisiana', 'Louisiana'), ('KY', 'Kentucky'),
('Maine', 'Maine'), ('LA', 'Louisiana'),
('Maryland', 'Maryland'), ('ME', 'Maine'),
('Massachusetts', 'Massachusetts'), ('MD', 'Maryland'),
('Michigan', 'Michigan'), ('MA', 'Massachusetts'),
('Minnesota', 'Minnesota'), ('MI', 'Michigan'),
('Mississippi', 'Mississippi'), ('MN', 'Minnesota'),
('Missouri', 'Missouri'), ('MS', 'Mississippi'),
('Montana', 'Montana'), ('MO', 'Missouri'),
('Nebraska', 'Nebraska'), ('MT', 'Montana'),
('Nevada', 'Nevada'), ('NE', 'Nebraska'),
('Vermont', 'Vermont'), ('NV', 'Nevada'),
('Virginia', 'Virginia'), ('NH', 'New Hampshire'),
('Washington', 'Washington'), ('NJ', 'New Jersey'),
('West Virginia', 'West Virginia'), ('NM', 'New Mexico'),
('Wisconsin', 'Wisconsin'), ('NY', 'New York'),
('Wyoming', 'Wyoming'), ('NC', 'North Carolina'),
('American Samoa', 'American Samoa'), ('ND', 'North Dakota'),
('Armed Forces America', 'Armed Forces America'), ('OH', 'Ohio'),
('Armed Forces Europe', 'Armed Forces Europe'), ('OK', 'Oklahoma'),
('Armed Forces Pacific', 'Armed Forces Pacific'), ('OR', 'Oregon'),
('Guam', 'Guam'), ('PA', 'Pennsylvania'),
('Northern Mariana Islands', 'Northern, Mariana Islands'), ('RI', 'Rhode Island'),
('Palau', 'Palau'), ('SC', 'South Carolina'),
('Puerto Rico', 'Puerto Rico'), ('SD', 'South Dakota'),
('Utah', 'Utah'), ('TN', 'Tennessee'),
('Virgin Island', 'Virgin Island'), ('TX', 'Texas'),
('Alberta', 'Alberta'), ('UT', 'Utah'),
('British Columbia', 'British Columbia'), ('VT', 'Vermont'),
('Manitoba', 'Manitoba'), ('VA', 'Virginia'),
('Nanavut', 'Nanavut'), ('WA', 'Washington'),
('New Brunswick', 'New Brunswick'), ('WV', 'West Virginia'),
('Newfoundland and Labrador', 'Newfoundland and Labrador'), ('WI', 'Wisconsin'),
('Northwest Territories', 'Northwest Territories'), ('WY', 'Wyoming'))
('Nova Scotia', 'Nova Scotia'),
('Ontario', 'Ontario'),
('Prince Edward Island', 'Prince Edward Island'),
('Quebec', 'Quebec'),
('Saskatchewan', 'Saskatchewan'),
('Yukon Territory', 'Yukon Territory'),
('Other', 'Other'))
state_province = models.CharField(blank=True, null=True, max_length=50, choices=STATE_CHOICES) state = models.CharField(blank=True, null=True, max_length=50, choices=STATE_CHOICES)
county_province = models.CharField(blank=True, null=True, max_length=50)
postal_code = models.CharField(blank=True, null=True, max_length=20) postal_code = models.CharField(blank=True, null=True, max_length=20)
COUNTRY_CHOICES = (('United States', 'United States'), COUNTRY_CHOICES = (('United States', 'United States'),
('Afghanistan', 'Afghanistan'), ('Afghanistan', 'Afghanistan'),
...@@ -364,13 +410,5 @@ class CmeUserProfile(UserProfile): ...@@ -364,13 +410,5 @@ class CmeUserProfile(UserProfile):
('Other', 'Other')) ('Other', 'Other'))
country = models.CharField(blank=True, null=True, max_length=50, choices=COUNTRY_CHOICES) country = models.CharField(blank=True, null=True, max_length=50, choices=COUNTRY_CHOICES)
phone_number = models.CharField(blank=True, null=True, max_length=30) GENDER_CHOICES = (('M', 'Male'),
extension = models.CharField(blank=True, null=True, max_length=10) ('F', 'Female'))
fax = models.CharField(blank=True, null=True, max_length=30)
HEAR_ABOUT_US_CHOICES = (('Direct Mail Brochure', 'Direct Mail Brochure'),
('Email Announcement', 'Email Announcement'),
('SCCME Web site', 'SCCME Web site'),
('Friend/Colleague', 'Friend/Colleague'),
('Other', 'Other, please enter:'))
hear_about_us = models.CharField(blank=True, null=True, max_length=255)
mailing_list = models.BooleanField(default=0)
...@@ -18,7 +18,7 @@ from django.contrib.auth.models import User ...@@ -18,7 +18,7 @@ from django.contrib.auth.models import User
from student.models import Registration, UserProfile from student.models import Registration, UserProfile
from cme_registration.models import CmeUserProfile from cme_registration.models import CmeUserProfile
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from cme_registration.views import DENIED_COUNTRIES, validate_export_controls from cme_registration.views import DENIED_COUNTRIES, validate_export_controls, setup_sub_affiliation_field
TEST_MITX_FEATURES = settings.MITX_FEATURES.copy() TEST_MITX_FEATURES = settings.MITX_FEATURES.copy()
TEST_MITX_FEATURES['USE_CME_REGISTRATION'] = True TEST_MITX_FEATURES['USE_CME_REGISTRATION'] = True
...@@ -35,35 +35,37 @@ class TestCmeRegistration(TestCase): ...@@ -35,35 +35,37 @@ class TestCmeRegistration(TestCase):
'email': 'test@email.com', 'email': 'test@email.com',
'password': '1234', 'password': '1234',
'name': 'Chester Tester', 'name': 'Chester Tester',
'stanford_affiliated': '1', 'first_name': 'Chester',
'how_stanford_affiliated': 'j\'st affiliat\'d', 'last_name': 'Tester',
'middle_initial': 'A',
'birth_date': '09/24',
'honor_code': 'true', 'honor_code': 'true',
'terms_of_service': 'true', 'terms_of_service': 'true',
'profession': 'profession',
'professional_designation': 'professional_designation', 'professional_designation': 'professional_designation',
'license_number': 'license_number', 'license_number': 'license_number',
'organization': 'organization', 'license_country': 'license_country',
'license_state': 'license_state',
'physician_status': 'physician_status',
'patient_population': 'patient_population', 'patient_population': 'patient_population',
'specialty': 'specialty', 'specialty': 'specialty',
'sub_specialty': 'sub_specialty', 'sub_specialty': 'sub_specialty',
'affiliation': 'affiliation',
'other_affiliation': 'other_affiliation',
'sub_affiliation': 'sub_affiliation',
'sunet_id': 'sunet_id',
'stanford_department': 'stanford_department',
'address_1': 'address_1', 'address_1': 'address_1',
'address_2': 'address_2', 'address_2': 'address_2',
'city': 'city', 'city': 'city',
'state_province': 'state_province', 'state': 'state',
'postal_code': 'postal_code', 'postal_code': 'postal_code',
'country': 'country', 'country': 'country',
'phone_number': 'phone_number', 'county_province': 'county_province',
'extension': 'extension', }
'fax': 'fax',
'hear_about_us': 'hear_about_us',
'mailing_list': 'false'}
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_badly_formed_message(self): def test_badly_formed_message(self):
"""
Post itself is badly formed
"""
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, {}) response = self.client.post(url, {})
...@@ -71,274 +73,298 @@ class TestCmeRegistration(TestCase): ...@@ -71,274 +73,298 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_profession_required(self): def test_last_name_required(self):
"""
Profession required field self.post_vars['last_name'] = ''
""" url = reverse('create_account')
response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "last_name", "value": "Enter your last name", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS"""))
def test_first_name_required(self):
self.post_vars['first_name'] = ''
url = reverse('create_account')
response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "first_name", "value": "Enter your first name", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS"""))
def test_middle_initial_length(self):
self.post_vars['middle_initial'] = 'ABC'
url = reverse('create_account')
response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "middle_initial", "value": "Enter your middle initial as a single character", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS"""))
def test_birth_date_required(self):
self.post_vars['birth_date'] = ''
url = reverse('create_account')
response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "birth_date", "value": "Enter your birth date", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS"""))
def test_birth_date_format1(self):
self.post_vars['birth_date'] = '0102'
url = reverse('create_account')
response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "birth_date", "value": "Enter your birth date as MM/DD", "success": false}')
self.post_vars['profession'] = '' @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS"""))
def test_birth_date_format2(self):
self.post_vars['birth_date'] = '14/02'
url = reverse('create_account')
response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "birth_date", "value": "month must be in 1..12", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS"""))
def test_professional_designation_required(self):
self.post_vars['professional_designation'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "profession", "value": "Choose your profession.", "success": false}') self.assertContains(response, '{"field": "professional_designation", "value": "Choose your professional designation", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_license_number_required(self): def test_license_number_required(self):
"""
License number required field
"""
self.post_vars['professional_designation'] = 'DO'
self.post_vars['license_number'] = '' self.post_vars['license_number'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "license_number", "value": "Enter your license number.", "success": false}') self.assertContains(response, '{"field": "license_number", "value": "Enter your license number", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_patient_population_required(self): def test_license_country_required(self):
"""
Patient population required field
"""
self.post_vars['patient_population'] = '' self.post_vars['professional_designation'] = 'DO'
self.post_vars['license_country'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "patient_population", "value": "Choose your patient population", "success": false}') self.assertContains(response, '{"field": "license_country", "value": "Choose your license country", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_specialty_required(self): def test_license_state_required(self):
"""
Specialty required field
"""
self.post_vars['specialty'] = '' self.post_vars['license_country'] = 'United States'
self.post_vars['license_state'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "specialty", "value": "Choose your specialty", "success": false}') self.assertContains(response, '{"field": "license_state", "value": "Choose your license state", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_sub_specialty_not_required(self): def test_physician_status_required(self):
"""
Sub specialty not required
"""
self.post_vars['sub_specialty'] = '' self.post_vars['professional_designation'] = 'DO'
self.post_vars['physician_status'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '"success": true') self.assertContains(response, '{"field": "physician_status", "value": "Enter your physician status", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_address_1_required(self): def test_patient_population_required(self):
"""
Address 1 required field
"""
self.post_vars['address_1'] = '' self.post_vars['professional_designation'] = 'DO'
self.post_vars['patient_population'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "address_1", "value": "Enter your Address 01", "success": false}') self.assertContains(response, '{"field": "patient_population", "value": "Choose your patient population", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_city_required(self): def test_specialty_required(self):
"""
City required field
"""
self.post_vars['city'] = '' self.post_vars['professional_designation'] = 'DO'
self.post_vars['specialty'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "city", "value": "Enter your city", "success": false}') self.assertContains(response, '{"field": "specialty", "value": "Choose your specialty", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_state_province_required(self): def test_sub_specialty_not_required(self):
"""
State Province required field
"""
self.post_vars['state_province'] = '' self.post_vars['sub_specialty'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "state_province", "value": "Choose your state/Province", "success": false}') self.assertContains(response, '"success": true')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_postal_code_required(self): def test_sub_affiliation_field(self):
"""
Postal Code required field
"""
self.post_vars['postal_code'] = '' self.post_vars['affiliation'] = 'Packard Children\'s Health Alliance'
self.post_vars['PCHA_affiliation'] = 'Dummy_Value1'
return_vars = setup_sub_affiliation_field(self.post_vars)
self.assertEquals(return_vars['sub_affiliation'], 'Dummy_Value1')
self.post_vars['affiliation'] = 'University Healthcare Alliance'
self.post_vars['UHA_affiliation'] = 'Dummy_Value2'
return_vars = setup_sub_affiliation_field(self.post_vars)
self.assertEquals(return_vars['sub_affiliation'], 'Dummy_Value2')
self.post_vars['affiliation'] = 'Lucile Packard Children\'s Hospital'
self.post_vars['PCHA_affiliation'] = 'Dummy_Value1'
self.post_vars['UHA_affiliation'] = 'Dummy_Value2'
return_vars = setup_sub_affiliation_field(self.post_vars)
self.assertEquals(return_vars['sub_affiliation'], '')
self.post_vars['affiliation'] = 'Packard Children\'s Health Alliance'
self.post_vars['PCHA_affiliation'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "postal_code", "value": "Enter your postal code", "success": false}') self.assertContains(response, '{"field": "sub_affiliation", "value": "Enter your Packard Children\'s Health Alliance affiliation", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_country_required(self): def test_sunet_id_required(self):
"""
Country required field
"""
self.post_vars['country'] = '' self.post_vars['affiliation'] = 'Stanford University'
self.post_vars['sunet_id'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "country", "value": "Choose your country", "success": false}') self.assertContains(response, '{"field": "sunet_id", "value": "Enter your SUNet ID", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_phone_number_required(self): def test_stanford_department_required(self):
"""
Phone number required field
"""
self.post_vars['phone_number'] = '' self.post_vars['affiliation'] = 'Stanford University'
self.post_vars['stanford_department'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "phone_number", "value": "Enter your phone number", "success": false}') self.assertContains(response, '{"field": "stanford_department", "value": "Choose your Stanford department", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_hear_about_us_required(self): def test_address_1_required(self):
"""
Hear about us required field
"""
self.post_vars['hear_about_us'] = '' self.post_vars['address_1'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "hear_about_us", "value": "Choose how you heard about us", "success": false}') self.assertContains(response, '{"field": "address_1", "value": "Enter your Address 1", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_specialty_other(self): def test_city_required(self):
"""
Specialty "other" required field
"""
self.post_vars['specialty'] = 'Other' self.post_vars['city'] = ''
self.post_vars['specialty_free'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "specialty", "value": "Enter your specialty.", "success": false}') self.assertContains(response, '{"field": "city", "value": "Enter your city", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_sub_specialty_other(self): def test_country_required(self):
"""
Sub specialty "other" required field
"""
self.post_vars['sub_specialty'] = 'Other' self.post_vars['country'] = ''
self.post_vars['sub_specialty_free'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "sub_specialty", "value": "Enter your sub-specialty.", "success": false}') self.assertContains(response, '{"field": "country", "value": "Choose your country", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_hear_about_us_other(self): def test_state_required(self):
"""
Hear about us "other" required field
"""
self.post_vars['hear_about_us'] = 'Other' self.post_vars['country'] = 'United States'
self.post_vars['hear_about_us_free'] = '' self.post_vars['state'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "hear_about_us", "value": "Enter how you heard about us.", "success": false}') self.assertContains(response, '{"field": "state", "value": "Choose your state", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_stanford_affiliated_required(self): def test_postal_code_required(self):
"""
Stanford affiliated required field
"""
del self.post_vars['stanford_affiliated'] self.post_vars['postal_code'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "stanford_affiliated", "value": "Select whether, or not, you are affiliated with Stanford.", "success": false}') self.assertContains(response, '{"field": "postal_code", "value": "Enter your postal code", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_honor_code_required(self): def test_specialty_other(self):
"""
Honor code required field
"""
del self.post_vars['honor_code'] self.post_vars['specialty'] = 'Other'
self.post_vars['specialty_free'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "honor_code", "value": "To enroll, you must follow the honor code.", "success": false}') self.assertContains(response, '{"field": "specialty", "value": "Enter your specialty.", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_tos_required(self): def test_sub_specialty_other(self):
"""
TOS required field
"""
del self.post_vars['terms_of_service'] self.post_vars['sub_specialty'] = 'Other'
self.post_vars['sub_specialty_free'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "terms_of_service", "value": "You must accept the terms of service.", "success": false}') self.assertContains(response, '{"field": "sub_specialty", "value": "Enter your sub-specialty.", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_stanford_affiliated_choose(self): def test_honor_code_required(self):
"""
How Stanford affiliated required if stanford affiliated
"""
self.post_vars['how_stanford_affiliated'] = '' del self.post_vars['honor_code']
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "stanford_affiliated", "value": "Choose how you are affiliated with Stanford.", "success": false}') self.assertContains(response, '{"field": "honor_code", "value": "To enroll, you must follow the honor code.", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_stanford_affiliated_other(self): def test_tos_required(self):
"""
Stanford affiliated "other" required field
"""
self.post_vars['how_stanford_affiliated'] = 'Other' del self.post_vars['terms_of_service']
self.post_vars['how_stanford_affiliated_free'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
self.assertContains(response, '{"field": "how_stanford_affiliated", "value": "Enter how you are affiliated with Stanford.", "success": false}') self.assertContains(response, '{"field": "terms_of_service", "value": "You must accept the terms of service.", "success": false}')
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_db_records_created(self): def test_db_records_created(self):
"""
Everything gets created correctly when all input data good
"""
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
...@@ -357,26 +383,31 @@ class TestCmeRegistration(TestCase): ...@@ -357,26 +383,31 @@ class TestCmeRegistration(TestCase):
#Check cme_user_profile was created #Check cme_user_profile was created
cme_user_profile = CmeUserProfile.objects.filter(user=user[0], cme_user_profile = CmeUserProfile.objects.filter(user=user[0],
name='Chester Tester', name='Chester Tester',
stanford_affiliated=True, first_name='Chester',
how_stanford_affiliated='j\'st affiliat\'d', last_name='Tester',
profession='profession', middle_initial='A',
birth_date='09/24',
professional_designation='professional_designation', professional_designation='professional_designation',
license_number='license_number', license_number='license_number',
organization='organization', license_country='license_country',
license_state='license_state',
physician_status='physician_status',
patient_population='patient_population', patient_population='patient_population',
specialty='specialty', specialty='specialty',
sub_specialty='sub_specialty', sub_specialty='sub_specialty',
affiliation='affiliation',
sub_affiliation='',
sunet_id='sunet_id',
stanford_department='stanford_department',
address_1='address_1', address_1='address_1',
address_2='address_2', address_2='address_2',
city='city', city='city',
state_province='state_province', state='state',
postal_code='postal_code', postal_code='postal_code',
country='country', country='country',
phone_number='phone_number', county_province='county_province'
extension='extension', )
fax='fax',
hear_about_us='hear_about_us',
mailing_list=False)
self.assertEqual(1, len(cme_user_profile)) self.assertEqual(1, len(cme_user_profile))
#Check user_profile was created #Check user_profile was created
...@@ -386,18 +417,15 @@ class TestCmeRegistration(TestCase): ...@@ -386,18 +417,15 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_db_records_with_others_created(self): def test_db_records_with_others_created(self):
"""
Everything gets created correctly when all input data good with "others"
"""
self.post_vars['how_stanford_affiliated'] = 'Other'
self.post_vars['how_stanford_affiliated_free'] = 'Wife of the provost'
self.post_vars['specialty'] = 'Other' self.post_vars['specialty'] = 'Other'
self.post_vars['specialty_free'] = 'Patient care' self.post_vars['specialty_free'] = 'Patient care'
self.post_vars['sub_specialty'] = 'Other' self.post_vars['sub_specialty'] = 'Other'
self.post_vars['sub_specialty_free'] = 'Legs and feet' self.post_vars['sub_specialty_free'] = 'Legs and feet'
self.post_vars['hear_about_us'] = 'Other' self.post_vars['affiliation'] = 'Other'
self.post_vars['hear_about_us_free'] = 'Through the grapevine' self.post_vars['other_affiliation'] = 'other_affiliation'
self.post_vars['sub_affiliation'] = ''
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
...@@ -415,20 +443,31 @@ class TestCmeRegistration(TestCase): ...@@ -415,20 +443,31 @@ class TestCmeRegistration(TestCase):
#Check cme_user_profile was created #Check cme_user_profile was created
cme_user_profile = CmeUserProfile.objects.filter(user=user[0], cme_user_profile = CmeUserProfile.objects.filter(user=user[0],
name='Chester Tester', name='Chester Tester',
stanford_affiliated=True, first_name='Chester',
how_stanford_affiliated='Wife of the provost', last_name='Tester',
profession='profession', middle_initial='A',
birth_date='09/24',
professional_designation='professional_designation',
license_number='license_number', license_number='license_number',
license_country='license_country',
license_state='license_state',
physician_status='physician_status',
patient_population='patient_population', patient_population='patient_population',
specialty='Patient care', affiliation='Other',
sub_specialty='Legs and feet', other_affiliation='other_affiliation',
sub_affiliation='',
sunet_id='sunet_id',
stanford_department='stanford_department',
address_1='address_1', address_1='address_1',
address_2='address_2',
city='city', city='city',
state_province='state_province', state='state',
postal_code='postal_code', postal_code='postal_code',
country='country', country='country',
phone_number='phone_number', county_province='county_province',
hear_about_us='Through the grapevine') specialty='Patient care',
sub_specialty='Legs and feet',
)
self.assertEqual(1, len(cme_user_profile)) self.assertEqual(1, len(cme_user_profile))
#Check user_profile was created #Check user_profile was created
...@@ -438,9 +477,6 @@ class TestCmeRegistration(TestCase): ...@@ -438,9 +477,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_valid_email(self): def test_valid_email(self):
"""
Email address conforms
"""
self.post_vars['email'] = 'garbage_email_string' self.post_vars['email'] = 'garbage_email_string'
url = reverse('create_account') url = reverse('create_account')
...@@ -451,9 +487,6 @@ class TestCmeRegistration(TestCase): ...@@ -451,9 +487,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_valid_username(self): def test_valid_username(self):
"""
Username conforms
"""
self.post_vars['username'] = ' $%$%$# ' self.post_vars['username'] = ' $%$%$# '
url = reverse('create_account') url = reverse('create_account')
...@@ -464,9 +497,6 @@ class TestCmeRegistration(TestCase): ...@@ -464,9 +497,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_dupe_username(self): def test_dupe_username(self):
"""
Username not already existing
"""
UserFactory.create(username="student001", email="student001@test.com") UserFactory.create(username="student001", email="student001@test.com")
...@@ -479,9 +509,6 @@ class TestCmeRegistration(TestCase): ...@@ -479,9 +509,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_register_when_logged_in(self): def test_register_when_logged_in(self):
"""
Must be logged out to register
"""
user = UserFactory.create(username="student002", email="student002@test.com") user = UserFactory.create(username="student002", email="student002@test.com")
self.client.login(username=user.username, password='test') self.client.login(username=user.username, password='test')
...@@ -493,9 +520,6 @@ class TestCmeRegistration(TestCase): ...@@ -493,9 +520,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_register_page_loads(self): def test_register_page_loads(self):
"""
CME Register page itself renders
"""
url = reverse('register_user') url = reverse('register_user')
response = self.client.post(url, {}) response = self.client.post(url, {})
...@@ -504,9 +528,6 @@ class TestCmeRegistration(TestCase): ...@@ -504,9 +528,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_reroute_activation_email(self): def test_reroute_activation_email(self):
"""
Registration successful with reroute activation email true
"""
settings.MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'a@b.edu' settings.MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'a@b.edu'
...@@ -520,9 +541,6 @@ class TestCmeRegistration(TestCase): ...@@ -520,9 +541,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_save_profile_exception(self): def test_save_profile_exception(self):
"""
Profile doesn't get created on exception
"""
url = reverse('create_account') url = reverse('create_account')
self.client.post(url, self.post_vars) self.client.post(url, self.post_vars)
...@@ -534,9 +552,6 @@ class TestCmeRegistration(TestCase): ...@@ -534,9 +552,6 @@ class TestCmeRegistration(TestCase):
@unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False), @unittest.skipIf(settings.MITX_FEATURES.get('DISABLE_CME_REGISTRATION_TESTS', False),
dedent("""Skipping Test because the url is not in CMS""")) dedent("""Skipping Test because the url is not in CMS"""))
def test_activation_email_exception(self): def test_activation_email_exception(self):
"""
Exception if activation email not sent
"""
url = reverse('create_account') url = reverse('create_account')
response = self.client.post(url, self.post_vars) response = self.client.post(url, self.post_vars)
...@@ -545,9 +560,7 @@ class TestCmeRegistration(TestCase): ...@@ -545,9 +560,7 @@ class TestCmeRegistration(TestCase):
self.assertContains(response, 'Could not send activation e-mail.') self.assertContains(response, 'Could not send activation e-mail.')
def test_export_controls(self): def test_export_controls(self):
"""
Test export controls verification
"""
for country in DENIED_COUNTRIES: for country in DENIED_COUNTRIES:
retv = validate_export_controls({'country': country}) retv = validate_export_controls({'country': country})
self.assertFalse(retv['success']) self.assertFalse(retv['success'])
......
...@@ -5,6 +5,7 @@ CME Registration methods ...@@ -5,6 +5,7 @@ CME Registration methods
import json import json
import logging import logging
from dogapi import dog_stats_api from dogapi import dog_stats_api
import datetime
from django_future.csrf import ensure_csrf_cookie from django_future.csrf import ensure_csrf_cookie
from django.conf import settings from django.conf import settings
...@@ -22,7 +23,6 @@ import student ...@@ -22,7 +23,6 @@ import student
from cme_registration.models import CmeUserProfile from cme_registration.models import CmeUserProfile
from mitxmako.shortcuts import render_to_response, render_to_string from mitxmako.shortcuts import render_to_response, render_to_string
log = logging.getLogger("mitx.student") log = logging.getLogger("mitx.student")
...@@ -40,7 +40,8 @@ def cme_register_user(request, extra_context=None): ...@@ -40,7 +40,8 @@ def cme_register_user(request, extra_context=None):
'enrollment_action': request.GET.get('enrollment_action'), 'enrollment_action': request.GET.get('enrollment_action'),
'patient_population_choices': PATIENT_POPULATION_CHOICES, 'patient_population_choices': PATIENT_POPULATION_CHOICES,
'specialty_choices': SPECIALTY_CHOICES, 'specialty_choices': SPECIALTY_CHOICES,
'sub_specialty_choices': SUB_SPECIALTY_CHOICES 'sub_specialty_choices': SUB_SPECIALTY_CHOICES,
'sub_affiliation_choices': SUB_AFFILIATION_CHOICES,
} }
if extra_context is not None: if extra_context is not None:
context.update(extra_context) context.update(extra_context)
...@@ -56,7 +57,7 @@ def cme_create_account(request, post_override=None): ...@@ -56,7 +57,7 @@ def cme_create_account(request, post_override=None):
''' '''
json_string = {'success': False} json_string = {'success': False}
post_vars = post_override if post_override else request.POST post_vars = post_override if post_override else request.POST.copy()
# Confirm we have a properly formed request # Confirm we have a properly formed request
for var in ['username', 'email', 'password', 'name']: for var in ['username', 'email', 'password', 'name']:
...@@ -65,27 +66,56 @@ def cme_create_account(request, post_override=None): ...@@ -65,27 +66,56 @@ def cme_create_account(request, post_override=None):
json_string['field'] = var json_string['field'] = var
return HttpResponse(json.dumps(json_string)) return HttpResponse(json.dumps(json_string))
#Validate required felds # Validate required fields set1
error = validate_required_fields(post_vars) error = validate_required_fields_set1(post_vars)
if error is not None: if error is not None:
return HttpResponse(json.dumps(error)) return HttpResponse(json.dumps(error))
#Validate required check boxes # Validate length of middle initial
error = validate_required_boxes(post_vars) error = validate_middle_initial_length(post_vars)
if error is not None:
return HttpResponse(json.dumps(error))
# Validate birth date
error = validate_birth_date_format(post_vars)
if error is not None: if error is not None:
return HttpResponse(json.dumps(error)) return HttpResponse(json.dumps(error))
#Validate required radio buttons # Validate fields dependent on Professional Designation
error = validate_required_radios(post_vars) error = validate_professional_fields(post_vars)
if error is not None:
return HttpResponse(json.dumps(error))
# Setup post_vars for correct sub_affiliation field
post_vars = setup_sub_affiliation_field(post_vars)
# Validate affiliation fields
error = validate_affiliation_fields(post_vars)
if error is not None: if error is not None:
return HttpResponse(json.dumps(error)) return HttpResponse(json.dumps(error))
#Validate required secondary fields # Validate required fields set2
error = validate_required_fields_set2(post_vars)
if error is not None:
return HttpResponse(json.dumps(error))
# Validate required check boxes
error = validate_required_boxes(post_vars)
if error is not None:
return HttpResponse(json.dumps(error))
# Validate required radio buttons
# Commented out while no radios exist
# error = validate_required_radios(post_vars)
# if error is not None:
# return HttpResponse(json.dumps(error))
# Validate required secondary fields
error = validate_required_secondaries(post_vars) error = validate_required_secondaries(post_vars)
if error is not None: if error is not None:
return HttpResponse(json.dumps(error)) return HttpResponse(json.dumps(error))
#Validate email address # Validate email address
try: try:
validate_email(post_vars['email']) validate_email(post_vars['email'])
except ValidationError: except ValidationError:
...@@ -93,7 +123,7 @@ def cme_create_account(request, post_override=None): ...@@ -93,7 +123,7 @@ def cme_create_account(request, post_override=None):
json_string['field'] = 'email' json_string['field'] = 'email'
return HttpResponse(json.dumps(json_string)) return HttpResponse(json.dumps(json_string))
#Validate username conforms # Validate username conforms
try: try:
validate_slug(post_vars['username']) validate_slug(post_vars['username'])
except ValidationError: except ValidationError:
...@@ -101,7 +131,7 @@ def cme_create_account(request, post_override=None): ...@@ -101,7 +131,7 @@ def cme_create_account(request, post_override=None):
json_string['field'] = 'username' json_string['field'] = 'username'
return HttpResponse(json.dumps(json_string)) return HttpResponse(json.dumps(json_string))
#Validate Export controls # Validate Export controls
error = validate_export_controls(post_vars) error = validate_export_controls(post_vars)
if error is not None: if error is not None:
return HttpResponse(json.dumps(error)) return HttpResponse(json.dumps(error))
...@@ -163,6 +193,7 @@ def _do_cme_create_account(post_vars): ...@@ -163,6 +193,7 @@ def _do_cme_create_account(post_vars):
Since CmeUserProfile is implemented using multi-table inheritence of UserProfile, the CmeUserProfile object Since CmeUserProfile is implemented using multi-table inheritence of UserProfile, the CmeUserProfile object
will also contain all the UserProfile fields. will also contain all the UserProfile fields.
""" """
user = User(username=post_vars['username'], user = User(username=post_vars['username'],
email=post_vars['email'], email=post_vars['email'],
is_active=False) is_active=False)
...@@ -191,19 +222,18 @@ def _do_cme_create_account(post_vars): ...@@ -191,19 +222,18 @@ def _do_cme_create_account(post_vars):
#UserProfile fields #UserProfile fields
cme_user_profile.name = post_vars['name'] cme_user_profile.name = post_vars['name']
cme_user_profile.gender = post_vars.get('gender')
#CmeUserProfile fields #CmeUserProfile fields
cme_user_profile.profession = post_vars.get('profession') cme_user_profile.last_name = post_vars['last_name']
cme_user_profile.first_name = post_vars['first_name']
cme_user_profile.middle_initial = post_vars.get('middle_initial')
cme_user_profile.birth_date = post_vars['birth_date']
cme_user_profile.professional_designation = post_vars.get('professional_designation') cme_user_profile.professional_designation = post_vars.get('professional_designation')
cme_user_profile.license_number = post_vars.get('license_number') cme_user_profile.license_number = post_vars.get('license_number')
cme_user_profile.organization = post_vars.get('organization') cme_user_profile.license_country = post_vars.get('license_country')
cme_user_profile.stanford_affiliated = True if post_vars.get('stanford_affiliated') == '1' else False cme_user_profile.license_state = post_vars.get('license_state')
cme_user_profile.physician_status = post_vars.get('physician_status')
if post_vars.get('how_stanford_affiliated') == 'Other':
cme_user_profile.how_stanford_affiliated = post_vars.get('how_stanford_affiliated_free')
else:
cme_user_profile.how_stanford_affiliated = post_vars.get('how_stanford_affiliated')
cme_user_profile.patient_population = post_vars.get('patient_population') cme_user_profile.patient_population = post_vars.get('patient_population')
if post_vars.get('specialty') == 'Other': if post_vars.get('specialty') == 'Other':
...@@ -216,32 +246,34 @@ def _do_cme_create_account(post_vars): ...@@ -216,32 +246,34 @@ def _do_cme_create_account(post_vars):
else: else:
cme_user_profile.sub_specialty = post_vars.get('sub_specialty') cme_user_profile.sub_specialty = post_vars.get('sub_specialty')
cme_user_profile.affiliation = post_vars.get('affiliation')
if post_vars.get('affiliation') == 'Other':
cme_user_profile.other_affiliation = post_vars.get('other_affiliation')
else:
cme_user_profile.other_affiliation = None
cme_user_profile.sub_affiliation = post_vars.get('sub_affiliation')
cme_user_profile.sunet_id = post_vars.get('sunet_id')
cme_user_profile.stanford_department = post_vars.get('stanford_department')
cme_user_profile.address_1 = post_vars.get('address_1') cme_user_profile.address_1 = post_vars.get('address_1')
cme_user_profile.address_2 = post_vars.get('address_2') cme_user_profile.address_2 = post_vars.get('address_2')
cme_user_profile.city = post_vars.get('city') cme_user_profile.city = post_vars.get('city')
cme_user_profile.state_province = post_vars.get('state_province') cme_user_profile.state = post_vars.get('state')
cme_user_profile.county_province = post_vars.get('county_province')
cme_user_profile.postal_code = post_vars.get('postal_code') cme_user_profile.postal_code = post_vars.get('postal_code')
cme_user_profile.country = post_vars.get('country') cme_user_profile.country = post_vars.get('country')
cme_user_profile.phone_number = post_vars.get('phone_number')
cme_user_profile.extension = post_vars.get('extension')
cme_user_profile.fax = post_vars.get('fax')
if post_vars.get('hear_about_us') == 'Other':
cme_user_profile.hear_about_us = post_vars.get('hear_about_us_free')
else:
cme_user_profile.hear_about_us = post_vars.get('hear_about_us')
cme_user_profile.mailing_list = 1 if post_vars.get('mailing_list') == 'true' else 0
try: try:
cme_user_profile.save() cme_user_profile.save()
except Exception: except Exception:
print "Could not create cme_user_profile"
log.exception("UserProfile creation failed for user {0}.".format(user.email)) log.exception("UserProfile creation failed for user {0}.".format(user.email))
return (user, cme_user_profile, registration) return (user, cme_user_profile, registration)
def validate_required_fields(post_vars): def validate_required_fields_set1(post_vars):
""" """
Checks that required free text fields contain at least 2 chars Checks that required free text fields contain at least 2 chars
`post_vars` is dict of post parameters (a `dict`) `post_vars` is dict of post parameters (a `dict`)
...@@ -252,18 +284,156 @@ def validate_required_fields(post_vars): ...@@ -252,18 +284,156 @@ def validate_required_fields(post_vars):
required_fields_list = [{'email': 'A properly formatted e-mail is required.'}, required_fields_list = [{'email': 'A properly formatted e-mail is required.'},
{'password': 'A valid password is required.'}, {'password': 'A valid password is required.'},
{'username': 'Username must be minimum of two characters long.'}, {'username': 'Username must be minimum of two characters long.'},
{'name': 'Your legal name must be a minimum of two characters long.'}, {'name': 'Your full name must be a minimum of two characters long.'},
{'profession': 'Choose your profession.'}, {'last_name': 'Enter your last name'},
{'license_number': 'Enter your license number.'}, {'first_name': 'Enter your first name'},
{'birth_date': 'Enter your birth date'},
{'professional_designation': 'Choose your professional designation'},
]
error = {}
for required_field in required_fields_list:
for key, val in required_field.iteritems():
if len(post_vars.get(key)) < 2:
error['success'] = False
error['value'] = val
error['field'] = key
return error
def validate_middle_initial_length(post_vars):
"""
Checks length of middle initial
"""
if len(post_vars.get('middle_initial')) > 1:
error = {}
error['success'] = False
error['value'] = 'Enter your middle initial as a single character'
error['field'] = 'middle_initial'
return error
def validate_birth_date_format(post_vars):
"""
Checks date is in format 'MM/DD'
"""
birth_date = post_vars.get('birth_date')
date_parts = birth_date.split('/')
error = {}
if len(date_parts) < 2:
error['success'] = False
error['value'] = 'Enter your birth date as MM/DD'
error['field'] = 'birth_date'
return error
dummy_year = 2013
try:
dateobj = datetime.date(dummy_year, int(date_parts[0]), int(date_parts[1]))
except ValueError, e:
error['success'] = False
error['value'] = str(e)
error['field'] = 'birth_date'
return error
def validate_professional_fields(post_vars):
"""
Checks that professional fields are filled out correctly
`post_vars` is dict of post parameters (a `dict`)
Returns a dict indicating failure, field and message on empty field else None
"""
required_fields_list = [{'license_number': 'Enter your license number'},
{'license_country': 'Choose your license country'},
{'physician_status': 'Enter your physician status'},
{'patient_population': 'Choose your patient population'}, {'patient_population': 'Choose your patient population'},
{'specialty': 'Choose your specialty'}, {'specialty': 'Choose your specialty'},
{'address_1': 'Enter your Address 01'}, ]
error = {}
if post_vars.get('professional_designation') in ['DO', 'MD', 'MD, PhD', 'MBBS']:
for required_field in required_fields_list:
for key, val in required_field.iteritems():
if len(post_vars.get(key)) < 2:
error['success'] = False
error['value'] = val
error['field'] = key
return error
# license_state is required if license_country = United States
if post_vars.get('license_country') == 'United States':
if len(post_vars.get('license_state')) < 2:
error['success'] = False
error['value'] = 'Choose your license state'
error['field'] = 'license_state'
return error
def setup_sub_affiliation_field(post_vars):
"""
Sets post_vars['sub_affiliation'] to correct value dependent upon affiliation dropdown
"""
affiliation_values = [{'Packard Children\'s Health Alliance': 'PCHA_affiliation'},
{'University Healthcare Alliance': 'UHA_affiliation'},
]
post_vars['sub_affiliation'] = ''
for affiliation_value in affiliation_values:
for key, val in affiliation_value.iteritems():
if post_vars.get('affiliation') == key:
post_vars['sub_affiliation'] = post_vars.get(val)
return post_vars
def validate_affiliation_fields(post_vars):
"""
Checks affiliation fields
"""
error = {}
affiliation_fields_list = [{'Packard Children\'s Health Alliance': 'Enter your Packard Children\'s Health Alliance affiliation'},
{'University Healthcare Alliance': 'Enter your University Healthcare Alliance affiliation'},
]
for affiliation_field in affiliation_fields_list:
for key, val in affiliation_field.iteritems():
if post_vars.get('affiliation') == key and len(post_vars.get('sub_affiliation')) < 2:
error['success'] = False
error['value'] = val
error['field'] = 'sub_affiliation'
return error
required_fields_list = [{'sunet_id': 'Enter your SUNet ID'},
{'stanford_department': 'Choose your Stanford department'},
]
if post_vars.get('affiliation') == 'Stanford University':
for required_field in required_fields_list:
for key, val in required_field.iteritems():
if len(post_vars.get(key)) < 2:
error['success'] = False
error['value'] = val
error['field'] = key
return error
def validate_required_fields_set2(post_vars):
"""
Checks that required free text fields contain at least 2 chars
`post_vars` is dict of post parameters (a `dict`)
Returns a dict indicating failure, field and message on empty field else None
"""
#Add additional required fields here
required_fields_list = [{'address_1': 'Enter your Address 1'},
{'city': 'Enter your city'}, {'city': 'Enter your city'},
{'state_province': 'Choose your state/Province'},
{'postal_code': 'Enter your postal code'},
{'country': 'Choose your country'}, {'country': 'Choose your country'},
{'phone_number': 'Enter your phone number'}, {'postal_code': 'Enter your postal code'},
{'hear_about_us': 'Choose how you heard about us'}
] ]
error = {} error = {}
...@@ -275,6 +445,13 @@ def validate_required_fields(post_vars): ...@@ -275,6 +445,13 @@ def validate_required_fields(post_vars):
error['field'] = key error['field'] = key
return error return error
if post_vars.get('country') == 'United States':
if len(post_vars.get('state')) < 2:
error['success'] = False
error['value'] = 'Choose your state'
error['field'] = 'state'
return error
def validate_required_boxes(post_vars): def validate_required_boxes(post_vars):
""" """
...@@ -307,11 +484,8 @@ def validate_required_secondaries(post_vars): ...@@ -307,11 +484,8 @@ def validate_required_secondaries(post_vars):
""" """
#Add additional required secondaries here #Add additional required secondaries here
required_secondaries_dict = {'stanford_affiliated': ('1', 'how_stanford_affiliated', 'Choose how you are affiliated with Stanford.'), required_secondaries_dict = {'specialty': ('Other', 'specialty_free', 'Enter your specialty.'),
'how_stanford_affiliated': ('Other', 'how_stanford_affiliated_free', 'Enter how you are affiliated with Stanford.'),
'specialty': ('Other', 'specialty_free', 'Enter your specialty.'),
'sub_specialty': ('Other', 'sub_specialty_free', 'Enter your sub-specialty.'), 'sub_specialty': ('Other', 'sub_specialty_free', 'Enter your sub-specialty.'),
'hear_about_us': ('Other', 'hear_about_us_free', 'Enter how you heard about us.')
} }
error = {} error = {}
...@@ -322,25 +496,25 @@ def validate_required_secondaries(post_vars): ...@@ -322,25 +496,25 @@ def validate_required_secondaries(post_vars):
error['field'] = k error['field'] = k
return error return error
# Commented out while no radios exist
def validate_required_radios(post_vars): # def validate_required_radios(post_vars):
""" # """
Checks that required radio buttons have been checked # Checks that required radio buttons have been checked
`post_vars is dict of post parameters (a `dict) # `post_vars is dict of post parameters (a `dict)
Returns a dict indicating failure, field and message on empty field else None # Returns a dict indicating failure, field and message on empty field else None
""" # """
#
#Add additional required radios here # #Add additional required radios here
required_radios_dict = {'stanford_affiliated': 'Select whether, or not, you are affiliated with Stanford.' # required_radios_dict = {
} # }
#
error = {} # error = {}
for k, val in required_radios_dict.items(): # for k, val in required_radios_dict.items():
if k not in post_vars: # if k not in post_vars:
error['success'] = False # error['success'] = False
error['value'] = val # error['value'] = val
error['field'] = k # error['field'] = k
return error # return error
def validate_export_controls(post_vars): def validate_export_controls(post_vars):
...@@ -357,21 +531,22 @@ def validate_export_controls(post_vars): ...@@ -357,21 +531,22 @@ def validate_export_controls(post_vars):
} }
DENIED_COUNTRIES = [ DENIED_COUNTRIES = ['Sudan',
'Sudan',
'Korea, Democratic People\'s Republic Of', 'Korea, Democratic People\'s Republic Of',
'Iran, Islamic Republic Of', 'Iran, Islamic Republic Of',
'Cuba', 'Cuba',
'Syrian Arab Republic', 'Syrian Arab Republic',
] ]
#Construct dicts for specialty and sub-specialty dropdowns #Construct dicts for specialty, sub-specialty, sub-affiliation dropdowns
SPECIALTY_CHOICES = {} SPECIALTY_CHOICES = {}
SUB_SPECIALTY_CHOICES = {} SUB_SPECIALTY_CHOICES = {}
SUB_AFFILIATION_CHOICES = {}
PATIENT_POPULATION_CHOICES = (('Adult', 'Adult'), PATIENT_POPULATION_CHOICES = (('Adult', 'Adult'),
('Pediatric', 'Pediatric'), ('Pediatric', 'Pediatric'),
('Both', 'Both (Adult/Pediatric)')) ('Both', 'Both'),
('None', 'None'))
SPECIALTY_CHOICES['Adult'] = (('Addiction_Medicine', 'Addiction Medicine'), SPECIALTY_CHOICES['Adult'] = (('Addiction_Medicine', 'Addiction Medicine'),
('Allergy', 'Allergy'), ('Allergy', 'Allergy'),
('Anesthesiology', 'Anesthesiology'), ('Anesthesiology', 'Anesthesiology'),
...@@ -604,3 +779,18 @@ SUB_SPECIALTY_CHOICES['Surgery'] = (('Bariatric_Surgery', 'Bariatric Surgery'), ...@@ -604,3 +779,18 @@ SUB_SPECIALTY_CHOICES['Surgery'] = (('Bariatric_Surgery', 'Bariatric Surgery'),
SUB_SPECIALTY_CHOICES['Transplant'] = (('Solid_Organ', 'Solid Organ'), SUB_SPECIALTY_CHOICES['Transplant'] = (('Solid_Organ', 'Solid Organ'),
('Blood_and_Bone_Marrow', 'Blood and Bone Marrow'), ('Blood_and_Bone_Marrow', 'Blood and Bone Marrow'),
('Other', 'Other, please enter:')) ('Other', 'Other, please enter:'))
SUB_AFFILIATION_CHOICES['Packard_Childrens_Health_Alliance'] = (('Bayside_Medical_Group', 'Bayside Medical Group'),
('Diablo_Valley_Child_Neurology', 'Diablo Valley Child Neurology'),
('Jagdip_Powar_Associates', 'Jagdip Powar, MD and Associates'),
('Judy_Fuentebella_Associates', 'Judy Fuentebella, MD and Associates'),
('Livermore_Pleasanton_San_Ramon_Pediatrics_Group', 'Livermore Pleasanton San Ramon Pediatrics Group'),
('Pediatric_Cardiology_Medical_Group', 'Pediatric Cardiology Medical Group'),
('Pediatric_Cardiology_Associates', 'Pediatric Cardiology Associates'),
('Peninsula_Pediatrics', 'Peninsula Pediatrics'),
('Sabina_Ali_Associates', 'Sabina Ali, MD and Associates'))
SUB_AFFILIATION_CHOICES['University_Healthcare_Alliance'] = (('Affinity_Medical_Partners_Medical_Group', 'Affinity Medical Partners Medical Group (AMP)'),
('Bay_Valley_Medical_Group', 'Bay Valley Medical Group (BVMG)'),
('Cardiovascular_Consultants_Medical_Group', 'Cardiovascular Consultants Medical Group (CCMG)'),
('Menlo_Medical_Clinic', 'Menlo Medical Clinic (MMC)'))
...@@ -24,12 +24,13 @@ ...@@ -24,12 +24,13 @@
$('body').addClass('js').addClass(view_name); $('body').addClass('js').addClass(view_name);
// new window/tab opening // new window/tab opening
$('a[rel="external"], a[class="new-vp"]') $('a[rel="external"], a[class="new-vp"]').click( function() {
.click( function() {
window.open( $(this).attr('href') ); window.open( $(this).attr('href') );
return false; return false;
}); });
//---------------------------------------- Client side registration behavior ----------------------------------------//
// form field label styling on focus // form field label styling on focus
$("form :input").focus(function() { $("form :input").focus(function() {
$("label[for='" + this.id + "']").parent().addClass("is-focused"); $("label[for='" + this.id + "']").parent().addClass("is-focused");
...@@ -38,12 +39,19 @@ ...@@ -38,12 +39,19 @@
}); });
// display dependent form sections // display dependent form sections
$('input.controller-show').click(function() {
$(this).parent().siblings('.controlled').slideDown('fast');
});
$('input.controller-hide').click(function() { $('select.affiliation-controller').change(function() {
$(this).parent().siblings('.controlled').slideUp('fast'); $(this).siblings('.affiliation-controlled').slideUp('fast');
if ($(this).children("option:selected").val() === 'Stanford University') {
$(this).siblings('.affiliation-controlled#sunet_id_container, .affiliation-controlled#stanford_department_container').slideDown('fast');
} else if ($(this).children("option:selected").val() === "Packard Children's Health Alliance") {
$(this).siblings('.affiliation-controlled#PCHA_affiliation_container').slideDown('fast');
} else if ($(this).children("option:selected").val() === 'University Healthcare Alliance') {
$(this).siblings('.affiliation-controlled#UHA_affiliation_container').slideDown('fast');
} else if ($(this).children("option:selected").val() === 'Other') {
$(this).siblings('.affiliation-controlled#other_affiliation_container').slideDown('fast');
}
}); });
$('select.controller').change(function() { $('select.controller').change(function() {
...@@ -71,6 +79,43 @@ ...@@ -71,6 +79,43 @@
} }
}); });
// Dependent required fields
$('select#professional_designation').change(function() {
var dependentRequiredFields = 'li#license-number_container, li#license-country_container, li#physician_status_container, li#patient_population_container, li#specialty-container';
if ($(this).children("option:selected").val() === 'MD' || $(this).children("option:selected").val() === 'MD, PhD' || $(this).children("option:selected").val() === 'DO' || $(this).children("option:selected").val() === 'MBBS') {
$(this).parent().siblings(dependentRequiredFields).addClass('required');
} else {
$(this).parent().siblings(dependentRequiredFields).removeClass('required');
}
});
$('select#stanford_affiliation').change(function() {
if ($(this).children("option:selected").val() === 'Other' || $(this).children("option:selected").val() === '') {
$(this).parent().siblings('li.field').removeClass('required');
} else {
$(this).parent().siblings('li.field').addClass('required');
}
});
$('select#license_country').change(function() {
var dependentRequiredFields = 'li#license-state_container';
if ($(this).children("option:selected").val() === 'United States') {
$(this).parent().siblings(dependentRequiredFields).addClass('required');
} else {
$(this).parent().siblings(dependentRequiredFields).removeClass('required');
}
});
$('select#country').change(function() {
var dependentRequiredFields = 'li#state_container';
if ($(this).children("option:selected").val() === 'United States') {
$(this).parent().siblings(dependentRequiredFields).addClass('required');
} else {
$(this).parent().siblings(dependentRequiredFields).removeClass('required');
}
});
//--------------------------------------- /Client side registration behavior ----------------------------------------//
}); });
(function() { (function() {
...@@ -172,6 +217,37 @@ ...@@ -172,6 +217,37 @@
<input id="name" type="text" name="name" value="" placeholder="example: Jane C Doe" required aria-required="true" /> <input id="name" type="text" name="name" value="" placeholder="example: Jane C Doe" required aria-required="true" />
<span class="tip tip-input">Needed for any certificates you may earn <strong>(cannot be changed later)</strong></span> <span class="tip tip-input">Needed for any certificates you may earn <strong>(cannot be changed later)</strong></span>
</li> </li>
<li class="field required text" id="field-name">
<label for="name">Last Name</label>
<input id="last_name" type="text" name="last_name" value="" required aria-required="true" />
</li>
<li class="field required text" id="field-name">
<label for="name">First Name</label>
<input id="first_name" type="text" name="first_name" value="" required aria-required="true" />
</li>
<li class="field select" id="field-name">
<label for="name">Middle Initial</label>
<input id="middle_initial" type="text" name="middle_initial" value="" required aria-required="true" />
</li>
<li class="field required text" id="field-name">
<label for="name">Month and Day of Birth</label>
<input id="birth_date" type="text" name="birth_date" value="" required aria-required="true" placeholder="MM/DD" maxlength="5" />
</li>
<li class="field select" id="gender_container">
<label for="gender">Gender</label>
<select id="gender" name="gender">
<option value="">--</option>
%for code, gender in CmeUserProfile.GENDER_CHOICES:
<option value="${code}">${gender}</option>
%endfor
</select>
</li>
</ol> </ol>
% else: % else:
...@@ -213,22 +289,13 @@ ...@@ -213,22 +289,13 @@
% endif % endif
</fieldset> </fieldset>
<fieldset class="group group-form group-form-secondary group-form-personalinformation"> <fieldset class="group group-form group-form-secondary group-form-professionalinformation form-page">
<hr /> <hr />
<h3><strong>Professional Information</strong></h3> <h3><strong>Professional Information</strong></h3>
<ol class="list-input"> <ol class="list-input">
<li class="field required text" id="field-profession">
<label for="profession">Profession</label>
<select id="profession" name="profession">
<option value="">--</option>
%for code, profession in CmeUserProfile.PROFESSION_CHOICES:
<option value="${code}">${profession}</option>
%endfor
</select>
</li>
<li class="field select" id="field-professional-designation"> <li class="field required text" id="field-professional-designation_container">
<label for="professional_designation">Professional Designation</label> <label for="professional_designation">Professional Designation</label>
<select id="professional_designation" name="professional_designation"> <select id="professional_designation" name="professional_designation">
<option value="">--</option> <option value="">--</option>
...@@ -238,60 +305,42 @@ ...@@ -238,60 +305,42 @@
</select> </select>
</li> </li>
<li class="field required text" id="license-number"> <li class="field select" id="license-number_container">
<label for="license_number">License Number</label> <label for="license_number">License Number</label>
<input id="license_number" type="text" name="license_number" /> <input id="license_number" type="text" name="license_number" />
</li> </li>
</ol> <li class="field select" id="license-country_container">
</fieldset> <label for="license_country">License Country</label>
<select id="license_country" name="license_country">
<fieldset class="group group-form group-form-secondary group-form-organizationinformation"> <option value="">--</option>
<hr /> %for code, country in CmeUserProfile.COUNTRY_CHOICES:
<h3><strong>Organization Information</strong></h3> <option value="${code}">${country}</option>
%endfor
<ol class="list-input"> </select>
<li class="field select" id="organization">
<label for="organization">Organization</label>
<input id="organization" type="text" name="organization" />
</li> </li>
<li class="field required" id="stanford_affiliated"> <li class="field select" id="license-state_container">
<label for="stanford_affiliated">Are you affiliated with Stanford?</label> <label for="license_state">License State</label>
<div class="field select radio " id="is_stanford_affiliated"> <select id="license_state" name="license_state">
<span><input id="stanford_affiliated_yes" class="controller-show" type="radio" value="1" name="stanford_affiliated" aria-label="Yes" /> Yes</span>
<span><input id="stanford_affiliated_no" class="controller-hide" type="radio" value="0" name="stanford_affiliated" aria-label="No" style="margin-left: 50px;" /> No</span>
<div class="field select controlled" id="how_stanford_affiliated" style="display: none;">
<br />
<label for="how_stanford_affiliated">How are you affiliated with Stanford?</label>
<select class="controller" id="how_stanford_affiliated" name="how_stanford_affiliated">
<option value="">--</option> <option value="">--</option>
% for code, how_stanford_affiliated in CmeUserProfile.HOW_STANFORD_AFFILIATED_CHOICES: %for code, state in CmeUserProfile.STATE_CHOICES:
% if code == "Other, please enter:": <option value="${code}">${state}</option>
<option value="${code}" class="controller-show">${how_stanford_affiliated}</option> %endfor
% else:
<option value="${code}" class="controller-hide">${how_stanford_affiliated}</option>
% endif
% endfor
</select> </select>
<div class="field controlled" id="how_stanford_affililiated_free_container" style="display: none;">
<br />
<input id="how_stanford_affililiated_free" type="text" name="how_stanford_affiliated_free" title="Please enter how you are affiliated with Stanford here." />
</div>
</div>
</div>
</li> </li>
</ol> <li class="field select" id="physician_status_container">
</fieldset> <label for="physician_status">Physician Status</label>
<select id="physician_status" name="physician_status">
<fieldset class="group group-form group-form-secondary group-form-patientinformation"> <option value="">--</option>
<hr /> %for code, status in CmeUserProfile.PHYSICIAN_STATUS_CHOICES:
<h3><strong>Your Patient Information</strong></h3> <option value="${code}">${status}</option>
%endfor
</select>
</li>
<ol class="list-input"> <li class="field select" id="patient_population_container">
<li class="field required" id="patient_population">
<label for="patient_population">Patient population</label> <label for="patient_population">Patient population</label>
<select id="patient_population" name="patient_population" class="select-controller"> <select id="patient_population" name="patient_population" class="select-controller">
<option value="">--</option> <option value="">--</option>
...@@ -301,11 +350,13 @@ ...@@ -301,11 +350,13 @@
</select> </select>
</li> </li>
##################################################### #####################################################
## Specialty Select Field ## Specialty Select Field
##################################################### #####################################################
<li class="field required" style="display: none;"> <li class="field select" style="display: none;" id="specialty-container">
<label for="specialty">Specialty</label> <label for="specialty">Specialty</label>
<select id="specialty" name="specialty" class="controller select-controller"> <select id="specialty" name="specialty" class="controller select-controller">
<option value="">--</option> <option value="">--</option>
...@@ -313,7 +364,7 @@ ...@@ -313,7 +364,7 @@
<div class="field controlled" id="specialty_free_container" style="display: none;"> <div class="field controlled" id="specialty_free_container" style="display: none;">
<br /> <br />
<input id="specialty_free" type="text" name="specialty_free" title="Please enter your Specialty here." /> <input id="specialty_free" type="text" name="specialty_free" title="Please enter your Specialty here." placeholder="Please enter your Specialty here." />
</div> </div>
</li> </li>
...@@ -343,7 +394,7 @@ ...@@ -343,7 +394,7 @@
## Sub Specialty Select Field ## Sub Specialty Select Field
##################################################### #####################################################
<li class="field" style="display: none;"> <li class="field" style="display: none;" id="sub-specialty-container">
<label for="sub_specialty">Sub-Specialty</label> <label for="sub_specialty">Sub-Specialty</label>
<select id="sub_specialty" name="sub_specialty" class="controller"> <select id="sub_specialty" name="sub_specialty" class="controller">
<option value="">--</option> <option value="">--</option>
...@@ -351,7 +402,7 @@ ...@@ -351,7 +402,7 @@
<div class="field controlled" id="sub_specialty_free_container" style="display: none;"> <div class="field controlled" id="sub_specialty_free_container" style="display: none;">
<br /> <br />
<input id="sub_specialty_free" type="text" name="sub_specialty_free" title="Please enter your Sub-Specialty here." /> <input id="sub_specialty_free" type="text" name="sub_specialty_free" title="Please enter your Sub-Specialty here." placeholder="Please enter your Sub-Specialty here." />
</div> </div>
</li> </li>
...@@ -418,9 +469,71 @@ ...@@ -418,9 +469,71 @@
%endfor %endfor
</div> </div>
</ol> </ol>
</fieldset> </fieldset>
<fieldset class="group group-form group-form-secondary group-form-affiliationinformation form-page">
<hr />
<h3><strong>Affiliation Information</strong></h3>
<ol class="list-input">
<li class="field select" id="affiliation">
<label for="affiliation">Affiliation</label>
<select id="affiliation" name="affiliation" class="affiliation-controller">
<option value="">--</option>
%for code, affiliation in CmeUserProfile.AFFILIATION_CHOICES:
<option value="${code}">${affiliation}</option>
%endfor
</select>
<div class="field affiliation-controlled select required" id="sunet_id_container" style="display: none;">
<br />
<label for="sunet_id">SUNet ID</label>
<input id="sunet_id" type="text" name="sunet_id" />
</div>
<div class="field affiliation-controlled select required" id="stanford_department_container" style="display: none;">
<label for="stanford_department">Stanford Department</label>
<select id="stanford_department" name="stanford_department">
<option value="">--</option>
%for code, stanford_department in CmeUserProfile.DEPARTMENT_CHOICES:
<option value="${code}">${stanford_department}</option>
%endfor
</select>
</div>
<div class="field affiliation-controlled select required" id="PCHA_affiliation_container" style="display: none;">
<br />
<label for="PCHA_affiliation">Packard Children's Health Alliance Affiliation</label>
<select id="PCHA_affiliation" name="PCHA_affiliation">
<option value="">--</option>
%for code, PCHA_affiliation in sub_affiliation_choices['Packard_Childrens_Health_Alliance']:
<option value="${code}">${PCHA_affiliation}</option>
%endfor
</select>
</div>
<div class="field affiliation-controlled select required" id="UHA_affiliation_container" style="display: none;">
<br />
<label for="UHA_affiliation">University Healthcare Alliance Affiliation</label>
<select id="UHA_affiliation" name="UHA_affiliation">
<option value="">--</option>
%for code, UHA_affiliation in sub_affiliation_choices['University_Healthcare_Alliance']:
<option value="${code}">${UHA_affiliation}</option>
%endfor
</select>
</div>
<div class="field affiliation-controlled" id="other_affiliation_container" style="display: none;">
<br />
<input id="other_affiliation" type="text" name="other_affiliation" title="Please enter your affiliation here." placeholder="Please enter your affiliation here." />
</div>
</li>
</ol>
</fieldset>
<fieldset class="group group-form group-form-secondary group-form-personalinformation"> <fieldset class="group group-form group-form-secondary group-form-personalinformation">
<hr /> <hr />
...@@ -429,37 +542,22 @@ ...@@ -429,37 +542,22 @@
<ol class="list-input"> <ol class="list-input">
<li class="field required" id="address_1"> <li class="field required" id="address_1_container">
<label for="address_1">Address 1</label> <label for="address_1">Address 1</label>
<input id="address_1" type="text" name="address_1" /> <input id="address_1" type="text" name="address_1" />
</li> </li>
<li class="field select" id="address_2"> <li class="field select" id="address_2_container">
<label for="address_2">Address 2</label> <label for="address_2">Address 2</label>
<input id="address_2" type="text" name="address_2" /> <input id="address_2" type="text" name="address_2" />
</li> </li>
<li class="field required" id="city"> <li class="field required" id="city_container">
<label for="city">City</label> <label for="city">City</label>
<input id="city" type="text" name="city" /> <input id="city" type="text" name="city" />
</li> </li>
<li class="field required" id="state_province"> <li class="field required" id="country_container">
<label for="state_province">State/Province</label>
<select id="state_province" name="state_province">
<option value="">--</option>
%for code, state in CmeUserProfile.STATE_CHOICES:
<option value="${code}">${state}</option>
%endfor
</select>
</li>
<li class="field required" id="postal_code">
<label for="postal_code">Postal Code</label>
<input id="postal_code" type="text" name="postal_code" />
</li>
<li class="field required" id="country">
<label for="country">Country</label> <label for="country">Country</label>
<select id="country" name="country"> <select id="country" name="country">
<option value="">--</option> <option value="">--</option>
...@@ -469,45 +567,30 @@ ...@@ -469,45 +567,30 @@
</select> </select>
</li> </li>
<li class="field required" id="phone_number"> <li class="field" id="state_container">
<label for="phone_number">Phone Number</label> <label for="state">State</label>
<input id="phone_number" type="text" name="phone_number" /> <select id="state" name="state">
</li>
<li class="field select" id="extension">
<label for="extension">Extension</label>
<input id="extension" type="text" name="extension" />
</li>
<li class="field select" id="fax">
<label for="fax">Fax</label>
<input id="fax" type="text" name="fax" />
</li>
<li class="field required" id="hear_about_us">
<label for="hear_about_us">How did you hear about us?</label>
<select class="controller" id="hear_about_us" name="hear_about_us">
<option value="">--</option> <option value="">--</option>
%for code, about_us in CmeUserProfile.HEAR_ABOUT_US_CHOICES: %for code, state in CmeUserProfile.STATE_CHOICES:
% if code == "Other, please enter:": <option value="${code}">${state}</option>
<option value="${code}" class="controller-show">${about_us}</option>
% else:
<option value="${code}" class="controller-hide">${about_us}</option>
% endif
%endfor %endfor
</select> </select>
<div class="field controlled" id="hear_about_us_free" style="display: none;">
<br />
<input id="hear_about_us_free" type="text" name="hear_about_us_free" title="Please enter how you heard about us here." />
</div>
</li> </li>
<input id="mailing_list" type="hidden" name="mailing_list" value="true" /> <li class="field" id="county_province_container">
<label for="county_province">International Province or Territory</label>
<input id="county_province" type="text" name="county_province" />
</li>
<li class="field required" id="postal_code_container">
<label for="postal_code">Postal/Zip Code</label>
<input id="postal_code" type="text" name="postal_code" />
</li>
</ol> </ol>
</fieldset> </fieldset>
<fieldset class="group group-form group-form-accountacknowledgements"> <fieldset class="group group-form group-form-accountacknowledgements" id="form-checkboxes">
<hr /> <hr />
<legend class="sr">Account Acknowledgements</legend> <legend class="sr">Account Acknowledgements</legend>
...@@ -543,7 +626,7 @@ ...@@ -543,7 +626,7 @@
<input type="hidden" name="course_id" value="${course_id | h}" /> <input type="hidden" name="course_id" value="${course_id | h}" />
% endif % endif
<div class="form-actions"> <div class="form-actions" id="form-submit">
<button name="submit" type="submit" id="submit" class="action action-primary action-update">Register <span class="orn-plus">+</span> Create My Account</button> <button name="submit" type="submit" id="submit" class="action action-primary action-update">Register <span class="orn-plus">+</span> Create My Account</button>
</div> </div>
</form> </form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment