# Generated by Django 2.2.4 on 2019-08-09 10:40

from django.db import migrations, models
import django.db.models.deletion
import lino.core.choicelists
import lino.core.fields
import lino.core.roles
import lino.modlib.users.choicelists
import lino.modlib.users.models
import lino.utils.mldbc.fields
import lino_xl.lib.xl.user_types


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contacts', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='e-mail address')),
                ('language', lino.utils.mldbc.fields.LanguageField(blank=True, choices=[('en', 'English'), ('de', 'German'), ('fr', 'French')], max_length=5, verbose_name='Language')),
                ('modified', models.DateTimeField(editable=False, help_text='The time when this database object was last modified.', null=True, verbose_name='Modified')),
                ('created', models.DateTimeField(editable=False, help_text='The time when this object was created.', verbose_name='Created')),
                ('start_date', models.DateField(blank=True, help_text='The site administrator can optionally specify a date when a\nuser started or stopped to be active.', null=True, verbose_name='Start date')),
                ('end_date', models.DateField(blank=True, null=True, verbose_name='End date')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, help_text='Not used in Lino.', null=True, verbose_name='last login')),
                ('username', models.CharField(help_text='Must be unique and cannot be empty.', max_length=30, unique=True, verbose_name='Username')),
                ('user_type', lino.core.choicelists.ChoiceListField(blank=True, choicelist=lino.modlib.users.choicelists.UserTypes, choices=[(lino.modlib.users.choicelists.UserType('000', 'Anonymous', lino.core.roles.UserRole, name='anonymous', readonly=True), '000 (000 (Anonymous))'), (lino.modlib.users.choicelists.UserType('100', 'User', lino_xl.lib.xl.user_types.SiteUser, name='user'), '100 (100 (User))'), (lino.modlib.users.choicelists.UserType('900', 'Administrator', lino_xl.lib.xl.user_types.SiteAdmin, name='admin'), '900 (900 (Administrator))')], help_text='The user_type of a user is what defines her or his permissions.', max_length=20, verbose_name='User type')),
                ('initials', models.CharField(blank=True, help_text='The nickname or initials of this user. This does not need to\nbe unique but should provide a reasonably identifying\nfunction.', max_length=10, verbose_name='Initials')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='First name')),
                ('last_name', models.CharField(blank=True, max_length=30, verbose_name='Last name')),
                ('remarks', models.TextField(blank=True, verbose_name='Remarks')),
                ('partner', models.ForeignKey(blank=True, help_text='Pointer to the Partner instance related to\nthis user.', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='users_by_partner', to='contacts.Partner')),
            ],
            options={
                'verbose_name': 'User',
                'verbose_name_plural': 'Users',
                'ordering': ['last_name', 'first_name', 'username'],
                'abstract': False,
            },
            bases=(models.Model, lino.core.fields.TableRow),
            managers=[
                ('objects', lino.modlib.users.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Authority',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('authorized', models.ForeignKey(help_text='The user who gets the right to represent the author', on_delete=django.db.models.deletion.PROTECT, to='users.User')),
                ('user', models.ForeignKey(blank=True, help_text='The user who gives the right of representation. author of this\nauthority', on_delete=django.db.models.deletion.PROTECT, related_name='users_authority_set_by_user', to='users.User', verbose_name='Author')),
            ],
            options={
                'verbose_name': 'Authority',
                'verbose_name_plural': 'Authorities',
            },
            bases=(models.Model, lino.core.fields.TableRow),
        ),
    ]
