# Generated by Django 2.1.2 on 2018-11-11 12:18

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields

import workshops.fields


def update_contenttypes(apps, schema_editor):
    ContentType = apps.get_model('contenttypes', 'ContentType')

    # update application for all non-versioned model content type
    model_names = [
        # 'academiclevel',
        # 'computingexperiencelevel',
        'dataanalysislevel',
        'dcworkshoptopic',
        'dcworkshopdomain',
        'profileupdaterequest',
        'eventrequest',
        'eventsubmission',
        'dcselforganizedeventrequest',
    ]
    ContentType.objects.filter(app_label='workshops', model__in=model_names) \
                       .update(app_label='extrequests')


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('workshops', '0164_remove_nonversioned_models'),
    ]

    state_operations = [
        migrations.CreateModel(
            name='DataAnalysisLevel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'workshops_dataanalysislevel',
            },
        ),
        migrations.CreateModel(
            name='DCSelfOrganizedEventRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('last_updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('state', models.CharField(choices=[('p', 'Pending'), ('d', 'Discarded'), ('a', 'Accepted')], default='p', max_length=1)),
                ('name', models.CharField(max_length=255)),
                ('email', models.EmailField(max_length=254)),
                ('organization', models.CharField(max_length=255, verbose_name='University or organization affiliation')),
                ('instructor_status', models.CharField(blank=True, choices=[('', 'None'), ('incomplete', "Have gone through instructor training, but haven't yet completed checkout"), ('dc', 'Certified Data Carpentry instructor'), ('swc', 'Certified Software Carpentry instructor'), ('both', 'Certified Software and Data Carpentry instructor')], max_length=40, verbose_name='Your Software and Data Carpentry instructor status')),
                ('is_partner', models.CharField(blank=True, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unsure'), ('', 'Other (enter below)')], max_length=1, verbose_name='Is your organization a Data Carpentry or Software Carpentry Partner')),
                ('is_partner_other', models.CharField(blank=True, default='', max_length=100, verbose_name='Other (is your organization a Partner?)')),
                ('location', models.CharField(help_text='City, Province or State', max_length=255, verbose_name='Location')),
                ('country', django_countries.fields.CountryField(max_length=2)),
                ('associated_conference', models.CharField(blank=True, default='', help_text='If the workshop is to be associated with a conference or meeting, which one?', max_length=100, verbose_name='Associated conference')),
                ('dates', models.CharField(help_text='Preferably in YYYY-MM-DD to YYYY-MM-DD format', max_length=255, verbose_name='Planned workshop dates')),
                ('domains_other', models.CharField(blank=True, default='', help_text='If none of the fields above works for you.', max_length=255, verbose_name='Other domains for the workshop')),
                ('topics_other', models.CharField(blank=True, default='', help_text='If none of the fields above works for you.', max_length=255, verbose_name='Other topics to be taught')),
                ('payment', models.CharField(choices=[('per_participant', 'I will contribute $25/participant through registration fees'), ('invoice', 'I will contribute $500 via an invoice'), ('credit_card', 'I will contribute $500 via a credit card payment'), ('fee_waiver', 'I would like to request a fee waiver')], default='per_participant', help_text='Self-organized workshops for non-Partner organizations are $500 or $25/participant for a workshop licensing fee (<a href="http://www.datacarpentry.org/self-organized-workshops/">http://www.datacarpentry.org/self-organized-workshops/</a>). Fee waivers are available and generally granted upon request.', max_length=40, verbose_name='Payment choice')),
                ('fee_waiver_reason', models.CharField(blank=True, default='', max_length=255, verbose_name='Reason for requesting a fee waiver')),
                ('handle_registration', models.BooleanField(default=False, verbose_name='I confirm that I will handle registration for this workshop')),
                ('distribute_surveys', models.BooleanField(default=False, verbose_name='I confirm that I will distribute the Data Carpentry surveys to workshop participants')),
                ('follow_code_of_conduct', models.BooleanField(default=False, verbose_name='I confirm that I will follow the Data Carpentry Code of Conduct')),
                ('assigned_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('attendee_academic_levels', models.ManyToManyField(help_text='If you know the academic level(s) of your attendees, indicate them here.', to='workshops.AcademicLevel', verbose_name="Attendees' academic level")),
                ('attendee_data_analysis_level', models.ManyToManyField(help_text="If you know, indicate learner's general level of data analysis experience", to='extrequests.DataAnalysisLevel', verbose_name="Attendees' level of data analysis experience")),
            ],
            options={
                'db_table': 'workshops_dcselforganizedeventrequest',
            },
        ),
        migrations.CreateModel(
            name='DCWorkshopDomain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'workshops_dcworkshopdomain',
            },
        ),
        migrations.CreateModel(
            name='DCWorkshopTopic',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'workshops_dcworkshoptopic',
            },
        ),
        migrations.CreateModel(
            name='EventRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('last_updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('state', models.CharField(choices=[('p', 'Pending'), ('d', 'Discarded'), ('a', 'Accepted')], default='p', max_length=1)),
                ('name', models.CharField(max_length=40)),
                ('email', models.EmailField(max_length=254)),
                ('affiliation', models.CharField(help_text='University or Company', max_length=100)),
                ('location', models.CharField(help_text='City, Province, or State', max_length=100)),
                ('country', django_countries.fields.CountryField(max_length=2)),
                ('conference', models.CharField(blank=True, default='', max_length=100, verbose_name='If the workshop is to be associated with a conference or meeting, which one? ')),
                ('preferred_date', models.CharField(help_text='Please indicate when you would like to run the workshop. A range of at least a month is most helpful, although if you have specific dates you need the workshop, we will try to accommodate those requests.', max_length=255, verbose_name='Preferred workshop dates')),
                ('workshop_type', models.CharField(choices=[('swc', 'Software-Carpentry'), ('dc', 'Data-Carpentry')], default='swc', max_length=40)),
                ('approx_attendees', models.CharField(choices=[('1-20', '1-20 (one room, two instructors)'), ('20-40', '20-40 (one room, two instructors)'), ('40-80', '40-80 (two rooms, four instructors)'), ('80-120', '80-120 (three rooms, six instructors)')], default='20-40', help_text="This number doesn't need to be precise, but will help us decide how many instructors your workshop will need.Each workshop must have at least two instructors.", max_length=40, verbose_name='Approximate number of Attendees')),
                ('attendee_domains_other', models.CharField(blank=True, default='', help_text='If none of the fields above works for you.', max_length=100, verbose_name='Other domains or topics of interest')),
                ('data_types', models.CharField(blank=True, choices=[('survey', 'Survey data (ecology, biodiversity, social science)'), ('genomic', 'Genomic data'), ('geospatial', 'Geospatial data'), ('text-mining', 'Text mining'), ('', 'Other:')], max_length=40, verbose_name='We currently have developed or are developing workshops focused on four types of data. Please let us know which workshop would best suit your needs.')),
                ('data_types_other', models.CharField(blank=True, max_length=100, verbose_name='Other data domains for the workshop')),
                ('understand_admin_fee', models.BooleanField(default=False)),
                ('admin_fee_payment', models.CharField(choices=[('NP1', 'Non-profit / non-partner: US$2500'), ('FP1', 'For-profit: US$10,000'), ('self-organized', 'Self-organized: no fee (please let us know if you wish to make a donation)'), ('waiver', 'Waiver requested (please give details in "Anything else")')], default='NP1', max_length=40, verbose_name='Which of the following applies to your payment for the administrative fee?')),
                ('fee_waiver_request', models.BooleanField(default=False, help_text="Waiver's of the administrative fee are available on a needs basis. If you are interested in submitting a waiver application please indicate here.", verbose_name='I would like to submit an administrative fee waiver application')),
                ('cover_travel_accomodation', models.BooleanField(default=False, verbose_name="My institution will cover instructors' travel and accommodation costs.")),
                ('travel_reimbursement', models.CharField(blank=True, choices=[('', "Don't know yet."), ('book', 'Book travel through our university or program.'), ('reimburse', 'Book their own travel and be reimbursed.'), ('', 'Other:')], default='', max_length=40, verbose_name="How will instructors' travel and accommodations be managed?")),
                ('travel_reimbursement_other', models.CharField(blank=True, max_length=100, verbose_name="Other propositions for managing instructors' travel and accommodations")),
                ('comment', models.TextField(blank=True, help_text='What else do you want us to know about your workshop? About your attendees? About you?', verbose_name='Anything else?')),
                ('assigned_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('attendee_academic_levels', models.ManyToManyField(help_text='If you know the academic level(s) of your attendees, indicate them here.', to='workshops.AcademicLevel', verbose_name="Attendees' Academic Level")),
                ('attendee_computing_levels', models.ManyToManyField(help_text="Indicate the attendees' level of computing experience, if known. We will ask attendees to fill in a skills survey before the workshop, so this answer can be an approximation.", to='workshops.ComputingExperienceLevel', verbose_name="Attendees' level of computing experience")),
                ('attendee_data_analysis_level', models.ManyToManyField(help_text="If you know, indicate learner's general level of data analysis experience", to='extrequests.DataAnalysisLevel', verbose_name='Level of data analysis experience')),
                ('attendee_domains', models.ManyToManyField(help_text="The attendees' academic field(s) of study, if known.", to='workshops.KnowledgeDomain', verbose_name='Domains or topic of interest for target audience')),
                ('event', models.OneToOneField(blank=True, help_text='Link to the event instance created or otherwise related to this object.', null=True, on_delete=django.db.models.deletion.PROTECT, to='workshops.Event', verbose_name='Linked event object')),
                ('language', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='workshops.Language', verbose_name='What human language do you want the workshop to be run in?')),
            ],
            options={
                'ordering': ['created_at'],
                'db_table': 'workshops_eventrequest',
            },
        ),
        migrations.CreateModel(
            name='EventSubmission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('last_updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('state', models.CharField(choices=[('p', 'Pending'), ('d', 'Discarded'), ('a', 'Accepted')], default='p', max_length=1)),
                ('url', models.URLField(verbose_name="Link to the workshop's website")),
                ('contact_name', models.CharField(max_length=100, verbose_name='Your name')),
                ('contact_email', models.EmailField(help_text='We may need to contact you regarding workshop details.', max_length=254, verbose_name='Your email')),
                ('self_organized', models.BooleanField(default=False, verbose_name='Was the workshop self-organized?')),
                ('notes', models.TextField(blank=True, default='')),
                ('assigned_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('event', models.OneToOneField(blank=True, help_text='Link to the event instance created or otherwise related to this object.', null=True, on_delete=django.db.models.deletion.PROTECT, to='workshops.Event', verbose_name='Linked event object')),
            ],
            options={
                'ordering': ['created_at'],
                'db_table': 'workshops_eventsubmission',
            },
        ),
        migrations.CreateModel(
            name='ProfileUpdateRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('last_updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('data_privacy_agreement', models.BooleanField(default=False, verbose_name='I have read and agree to <a href="https://docs.carpentries.org/topic_folders/policies/privacy.html", target="_blank">the data privacy policy</a> of The Carpentries.')),
                ('personal', models.CharField(max_length=100, verbose_name='Personal (first) name')),
                ('middle', models.CharField(blank=True, max_length=100, verbose_name='Middle name')),
                ('family', models.CharField(max_length=100, verbose_name='Family (last) name')),
                ('email', models.EmailField(max_length=254, verbose_name='Email address')),
                ('affiliation', models.CharField(help_text='What university, company, lab, or other organization are you affiliated with (if any)?', max_length=100)),
                ('country', django_countries.fields.CountryField(blank=True, default='', max_length=2, verbose_name='Country of residence')),
                ('airport_iata', models.CharField(help_text='Please use its 3-letter IATA code (<a href="http://www.airportcodes.aero/" target="_blank">http://www.airportcodes.aero/</a>) to tell us where you\'re located.', max_length=3, verbose_name='Nearest major airport')),
                ('occupation', models.CharField(blank=True, choices=[('undisclosed', 'Prefer not to say'), ('undergrad', 'Undergraduate student'), ('grad', 'Graduate student'), ('postdoc', 'Post-doctoral researcher'), ('faculty', 'Faculty'), ('research', 'Research staff (including research programmer)'), ('support', 'Support staff (including technical support)'), ('librarian', 'Librarian/archivist'), ('commerce', 'Commercial software developer '), ('', 'Other:')], default='undisclosed', help_text='Please choose the one that best describes you.', max_length=40, verbose_name='What is your current occupation/career stage?')),
                ('occupation_other', models.CharField(blank=True, default='', max_length=100, verbose_name='Other occupation/career stage')),
                ('github', workshops.fields.NullableGithubUsernameField(blank=True, default='', help_text='Please put only a single username here.', max_length=39, null=True, verbose_name='GitHub username')),
                ('twitter', models.CharField(blank=True, default='', max_length=100, verbose_name='Twitter username')),
                ('orcid', models.CharField(blank=True, default='', max_length=100, verbose_name='ORCID ID')),
                ('website', models.CharField(blank=True, default='', max_length=100, verbose_name='Personal website')),
                ('gender', models.CharField(choices=[('U', 'Prefer not to say'), ('F', 'Female'), ('M', 'Male'), ('O', 'Other:')], default='U', max_length=1)),
                ('gender_other', models.CharField(blank=True, default='', max_length=100, verbose_name='Other gender')),
                ('domains_other', models.CharField(blank=True, default='', max_length=255, verbose_name='Other areas of expertise')),
                ('lessons_other', models.CharField(blank=True, default='', help_text='Please include lesson URLs.', max_length=255, verbose_name="Other topics/lessons you're comfortable teaching")),
                ('notes', models.TextField(blank=True, default='')),
                ('may_contact', models.BooleanField(default=True, help_text='Allow to contact from The Carpentries according to the <a href="https://docs.carpentries.org/topic_folders/policies/privacy.html" target="_blank">Privacy Policy</a>.')),
                ('publish_profile', models.BooleanField(default=False, help_text='Allow to post your name and any public profile you list (website, Twitter) on our instructors website. Emails will not be posted.', verbose_name='Consent to making profile public')),
                ('domains', models.ManyToManyField(blank=True, help_text='Please check all that apply.', limit_choices_to=models.Q(_negated=True, name__startswith="Don't know yet"), to='workshops.KnowledgeDomain', verbose_name='Areas of expertise')),
                ('languages', models.ManyToManyField(blank=True, to='workshops.Language', verbose_name='Languages you can teach in')),
                ('lessons', models.ManyToManyField(help_text='Please mark ALL that apply.', to='workshops.Lesson', verbose_name="Topic and lessons you're comfortable teaching")),
            ],
            options={
                'db_table': 'workshops_profileupdaterequest',
            },
        ),
        migrations.AddField(
            model_name='dcselforganizedeventrequest',
            name='domains',
            field=models.ManyToManyField(help_text="Set of lessons you're going to teach", to='extrequests.DCWorkshopDomain', verbose_name='Domain for the workshop'),
        ),
        migrations.AddField(
            model_name='dcselforganizedeventrequest',
            name='event',
            field=models.OneToOneField(blank=True, help_text='Link to the event instance created or otherwise related to this object.', null=True, on_delete=django.db.models.deletion.PROTECT, to='workshops.Event', verbose_name='Linked event object'),
        ),
        migrations.AddField(
            model_name='dcselforganizedeventrequest',
            name='topics',
            field=models.ManyToManyField(help_text='A Data Carpentry workshop must include a Data Carpentry lesson on data organization and three other modules in the same domain from the Data Carpentry curriculum (see <a href="http://www.datacarpentry.org/workshops/">http://www.datacarpentry.org/workshops/</a>). If you do want to include materials not in our curriculum, please note that below and we\'ll get in touch.', to='extrequests.DCWorkshopTopic', verbose_name='Topics to be taught'),
        ),
    ]
    operations = [
        migrations.SeparateDatabaseAndState(state_operations=state_operations),
        migrations.RunPython(update_contenttypes),
    ]
