# Generated by Django 2.2.6 on 2020-05-07 16:14

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('companies', '0001_initial'),
        ('common', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='DocumentTemplate',
            fields=[
                ('entity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='common.Entity')),
                ('name', models.CharField(default='', max_length=255, verbose_name='Название')),
                ('file_template', models.FileField(blank=True, null=True, upload_to='doc_templates/', verbose_name='Файл шаблона')),
                ('active', models.BooleanField(default=True, verbose_name='Статус активности')),
                ('template', models.BooleanField(default=False, verbose_name='Шаблон')),
                ('company', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='companies.Company', verbose_name='Компания')),
            ],
            options={
                'verbose_name': 'Шаблон документа',
                'verbose_name_plural': 'Шаблоны документов',
                'db_table': 'document_template',
            },
            bases=('common.entity',),
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False, unique=True)),
                ('created', models.DateTimeField(default=datetime.datetime.now, verbose_name='Создан')),
                ('document_template', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='documents.DocumentTemplate', verbose_name='Шаблон')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Документ',
                'verbose_name_plural': 'Документы',
                'db_table': 'document',
            },
        ),
    ]
