# -*- coding: utf-8 -*-


from django.db import models, migrations
from django.conf import settings
import piprints.main.models


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('username', models.CharField(unique=True, max_length=16)),
                ('password', models.CharField(max_length=64)),
                ('is_active', models.BooleanField(default=True)),
                ('is_staff', models.BooleanField(default=False)),
                ('is_superuser', models.BooleanField(default=False)),
                ('last_login', models.DateTimeField(null=True, blank=True)),
                ('created_by', models.ForeignKey(related_name='created_user', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_user', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
                'ordering': ['username'],
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('description', models.CharField(max_length=200)),
                ('file', models.FileField(max_length=255, upload_to=piprints.main.models.document_upload_to)),
                ('created_by', models.ForeignKey(related_name='created_document', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_document', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('crm_id', models.IntegerField(default=0, blank=True)),
                ('title', models.CharField(max_length=250)),
                ('slug', models.SlugField(default='', help_text='if provided the event will be accessible with the URL http://localhost/<i>slug</i>', max_length=32, blank=True)),
                ('date_from', models.DateField(help_text='first day of event')),
                ('date_to', models.DateField(verbose_name='last day of event')),
                ('place', models.CharField(max_length=80, blank=True)),
                ('description', models.TextField(blank=True)),
                ('registration_deadline', models.DateField(help_text='last day for registration', null=True, blank=True)),
                ('grant_request_deadline', models.DateField(help_text='last day for requesting a grant', null=True, blank=True)),
                ('registration_page_enabled', models.BooleanField(default=False, help_text='if checked a registration page will be generated')),
                ('grant_application_enabled', models.BooleanField(default=False, help_text='if checked grant request will be enabled')),
                ('grant_description', models.TextField(help_text='write here any comments regarding the grant', blank=True)),
                ('timetable_enabled', models.BooleanField(default=False, help_text='if checked a timetable will be generated')),
                ('created_by', models.ForeignKey(related_name='created_event', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('documents', models.ManyToManyField(to='main.Document', blank=True)),
            ],
            options={
                'ordering': ['-date_from', 'title'],
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='EventParticipant',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('state', models.CharField(default=b'requested', max_length=16, choices=[(b'requested', b'requested'), (b'accepted', b'accepted'), (b'cancelled', b'cancelled')])),
                ('email', models.EmailField(max_length=80)),
                ('email_verified', models.BooleanField(default=False)),
                ('verification_code', models.CharField(max_length=60, blank=True)),
                ('lastname', models.CharField(max_length=60)),
                ('firstname', models.CharField(max_length=60)),
                ('affiliation', models.CharField(max_length=250, blank=True)),
                ('position', models.CharField(max_length=80, blank=True)),
                ('date_from', models.DateField()),
                ('date_to', models.DateField()),
                ('grant_state', models.CharField(default=b'no', max_length=16, choices=[(b'no', b'no'), (b'requested', b'requested'), (b'rejected', b'rejected'), (b'granted', b'granted')])),
                ('notes', models.TextField(default='', blank=True)),
                ('created_by', models.ForeignKey(related_name='created_eventparticipant', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('documents', models.ManyToManyField(to='main.Document', blank=True)),
                ('event', models.ForeignKey(to='main.Event', on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_eventparticipant', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Keyword',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(unique=True, max_length=80)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Link',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('url', models.URLField(max_length=250)),
                ('description', models.TextField()),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Log',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True)),
                ('username', models.CharField(default='', max_length=80, blank=True)),
                ('action', models.CharField(default='', max_length=1024, blank=True)),
                ('dump', models.TextField(default='', blank=True)),
                ('o_creation_time', models.DateTimeField(default=None, null=True, blank=True)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='News',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('title', models.CharField(max_length=250)),
                ('description', models.TextField(blank=True)),
                ('created_by', models.ForeignKey(related_name='created_news', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('documents', models.ManyToManyField(to='main.Document', blank=True)),
                ('keywords', models.ManyToManyField(to='main.Keyword', blank=True)),
                ('links', models.ManyToManyField(to='main.Link', blank=True)),
                ('modified_by', models.ForeignKey(related_name='modified_news', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
                'verbose_name_plural': 'News',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Paper',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('code', models.CharField(unique=True, max_length=32)),
                ('title', models.CharField(max_length=250)),
                ('paper_type', models.CharField(default='', max_length=160, blank=True)),
                ('doi', models.CharField(default='', max_length=280, blank=True)),
                ('year', models.IntegerField(db_index=True)),
                ('journal', models.CharField(max_length=250, blank=True)),
                ('volume', models.CharField(max_length=32, blank=True)),
                ('number', models.CharField(max_length=32, blank=True)),
                ('pages', models.CharField(max_length=20, blank=True)),
                ('notes', models.TextField(blank=True)),
                ('abstract', models.TextField(blank=True)),
                ('notification_sent', models.BooleanField(default=False)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PaperAuthor',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('order', models.IntegerField()),
                ('created_by', models.ForeignKey(related_name='created_paperauthor', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_paperauthor', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('paper', models.ForeignKey(to='main.Paper', on_delete=models.PROTECT)),
            ],
            options={
                'ordering': ('order',),
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('crm_id', models.IntegerField(default=0, blank=True)),
                ('lastname', models.CharField(max_length=60)),
                ('firstname', models.CharField(max_length=60)),
                ('affiliation', models.CharField(max_length=250, blank=True)),
                ('position', models.CharField(max_length=80, blank=True)),
                ('email', models.EmailField(max_length=80, blank=True)),
                ('home_page', models.URLField(max_length=250, blank=True)),
                ('description', models.TextField(blank=True)),
                ('created_by', models.ForeignKey(related_name='created_person', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_person', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('user', models.OneToOneField(related_name='_person', null=True, blank=True, to=settings.AUTH_USER_MODEL, on_delete=models.PROTECT)),
            ],
            options={
                'ordering': ('lastname', 'firstname'),
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='PersonRequest',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('lastname', models.CharField(max_length=60)),
                ('firstname', models.CharField(max_length=60)),
                ('affiliation', models.CharField(max_length=250, blank=True)),
                ('position', models.CharField(max_length=80, blank=True)),
                ('email', models.EmailField(max_length=80)),
                ('notes', models.TextField(blank=True)),
                ('managed', models.BooleanField(default=False)),
                ('ip', models.IPAddressField(default='', blank=True)),
                ('created_by', models.ForeignKey(related_name='created_personrequest', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_personrequest', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
                'ordering': ('-creation_time',),
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Position',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('title', models.CharField(max_length=250)),
                ('description', models.TextField(blank=True)),
                ('deadline', models.DateField()),
                ('created_by', models.ForeignKey(related_name='created_position', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('documents', models.ManyToManyField(to='main.Document', blank=True)),
                ('links', models.ManyToManyField(to='main.Link', blank=True)),
                ('modified_by', models.ForeignKey(related_name='modified_position', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
                'verbose_name': 'open position',
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Seminar',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('title', models.CharField(max_length=250)),
                ('type', models.CharField(default=b'seminar', max_length=30, choices=[(b'seminar', b'seminar'), (b'course', b'course'), (b'separator', b'separator')])),
                ('date', models.DateField(help_text='yyyy-mm-dd')),
                ('date_is_valid', models.BooleanField(default=True, help_text='uncheck this if the date is not confirmed.')),
                ('time', models.TimeField(null=True, blank=True)),
                ('place', models.CharField(max_length=80, blank=True)),
                ('description', models.TextField(blank=True)),
                ('abstract', models.TextField(blank=True)),
                ('to_be_confirmed', models.BooleanField(default=False, help_text="check this if the seminar hasn't been confirmed.")),
                ('created_by', models.ForeignKey(related_name='created_seminar', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('documents', models.ManyToManyField(to='main.Document', blank=True)),
                ('keywords', models.ManyToManyField(to='main.Keyword', blank=True)),
                ('links', models.ManyToManyField(to='main.Link', blank=True)),
                ('modified_by', models.ForeignKey(related_name='modified_seminar', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('parent', models.ForeignKey(related_name='seminars', blank=True, to='main.Event', help_text='the seminar is part of an event? Choose here the event.', null=True, on_delete=models.PROTECT)),
                ('speakers', models.ManyToManyField(related_name='seminars', to='main.Person', blank=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('value', models.CharField(unique=True, max_length=16, choices=[(b'GeMeThNES', b'GeMeThNES')])),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='Template',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('creation_time', models.DateTimeField(auto_now_add=True, null=True)),
                ('modification_time', models.DateTimeField(auto_now=True, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('name', models.CharField(max_length=250)),
                ('source', models.TextField(blank=True)),
                ('created_by', models.ForeignKey(related_name='created_template', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
                ('event', models.ForeignKey(to='main.Event', null=True, on_delete=models.PROTECT)),
                ('modified_by', models.ForeignKey(related_name='modified_template', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.AlterUniqueTogether(
            name='template',
            unique_together=set([('event', 'name')]),
        ),
        migrations.AddField(
            model_name='paperauthor',
            name='person',
            field=models.ForeignKey(to='main.Person', on_delete=models.PROTECT),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='authors',
            field=models.ManyToManyField(related_name='papers', through='main.PaperAuthor', to='main.Person'),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='created_by',
            field=models.ForeignKey(related_name='created_paper', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='documents',
            field=models.ManyToManyField(to='main.Document', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='keywords',
            field=models.ManyToManyField(to='main.Keyword', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='links',
            field=models.ManyToManyField(to='main.Link', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='modified_by',
            field=models.ForeignKey(related_name='modified_paper', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='paper',
            name='tags',
            field=models.ManyToManyField(to='main.Tag', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='eventparticipant',
            name='person',
            field=models.ForeignKey(blank=True, to='main.Person', null=True, on_delete=models.PROTECT),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='event',
            name='keywords',
            field=models.ManyToManyField(to='main.Keyword', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='event',
            name='links',
            field=models.ManyToManyField(to='main.Link', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='event',
            name='modified_by',
            field=models.ForeignKey(related_name='modified_event', default=None, blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='event',
            name='organizers',
            field=models.ManyToManyField(related_name='organized_events', to='main.Person', blank=True),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='event',
            name='parent',
            field=models.ForeignKey(related_name='sub_events', blank=True, to='main.Event', null=True, on_delete=models.PROTECT),
            preserve_default=True,
        ),
        migrations.AddField(
            model_name='event',
            name='speakers',
            field=models.ManyToManyField(related_name='invited_events', to='main.Person', blank=True),
            preserve_default=True,
        ),
    ]
