text: # -*- coding: utf-8 -*-
  # Generated by Django 1.10.7 on 2017-08-09 23:21
  from __future__ import unicode_literals
  
  import django.db.models.deletion
  import django_dsl.fields
  import flexible_reports.models.report
  import flexible_reports.models.validators
  from django.db import migrations, models
  
  
  class Migration(migrations.Migration):
  
      initial = True
  
      dependencies = [
          ('contenttypes', '0002_remove_content_type_name'),
      ]
  
      operations = [
          migrations.CreateModel(
              name='Column',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('label', models.TextField(verbose_name='Label')),
                  ('position', models.PositiveIntegerField(default=0, verbose_name='Position')),
                  ('sortable', models.BooleanField(default=True)),
                  ('attr_name', models.CharField(blank=True, help_text='\n        Attribute name on the parent table\'s base model. \n        \n        If this column is sortable, that attribute is used to sort this \n        column. \n        \n        In case no value is given in "Template" field, \n        this attribute will be used to get information from model \n        instances.\n         \n        Warning, if you want to make this column sortable, you need to \n        provide this value.\n        \n        This value can contain dot notation to reference fields in related \n        models.\n        ', max_length=200, null=True, verbose_name='Attribute name')),
                  ('template', models.TextField(blank=True, default='{{ value }}', help_text='If empty, the value of the object\'s attribute from \n        "Attribute name" field will be used instead. \n            \n        Template will get following values in it\'s context:     \n        - *record*  -- data record for the current row\n        - *value*   -- value from `record` that corresponds to the current column\n        - *default* -- appropriate default value to use as fallback\n        ', null=True, verbose_name='Template')),
                  ('display_totals', models.BooleanField(default=False, help_text='Display column totals in footer. For columns without Attribute name, this will be total number of the rows.', verbose_name='Display totals')),
                  ('footer_template', models.TextField(blank=True, default='{{ value }}', help_text='\n        Template for footer.', null=True, verbose_name='Footer template')),
              ],
              options={
                  'verbose_name': 'Column',
                  'verbose_name_plural': 'Columns',
                  'ordering': ('position',),
              },
          ),
          migrations.CreateModel(
              name='Datasource',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('label', models.TextField(verbose_name='Label')),
                  ('dsl_query', django_dsl.fields.DjangoDSLField(verbose_name='DSL query')),
                  ('distinct', models.BooleanField(default=True, help_text='Output only distinct records', verbose_name='Distinct')),
                  ('base_model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Base model')),
              ],
              options={
                  'verbose_name': 'Datasource',
                  'verbose_name_plural': 'Datasources',
                  'ordering': ('label',),
              },
          ),
          migrations.CreateModel(
              name='Report',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('title', models.TextField(verbose_name='Title')),
                  ('subtitle', models.TextField(blank=True, null=True, verbose_name='Subtitle')),
                  ('slug', models.SlugField()),
                  ('template', models.TextField(default=flexible_reports.models.report.get_reports_template, validators=[flexible_reports.models.validators.TemplateValidator], verbose_name='Template')),
              ],
              options={
                  'verbose_name': 'Report',
                  'verbose_name_plural': 'Reports',
              },
          ),
          migrations.CreateModel(
              name='ReportElement',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('title', models.TextField(verbose_name='Title')),
                  ('subtitle', models.TextField(blank=True, null=True, verbose_name='Subtitle')),
                  ('position', models.PositiveIntegerField(default=0, verbose_name='Position')),
                  ('slug', models.SlugField(max_length=200)),
                  ('datasource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flexible_reports.Datasource')),
                  ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flexible_reports.Report')),
              ],
              options={
                  'ordering': ('position',),
              },
          ),
          migrations.CreateModel(
              name='Table',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('label', models.TextField(verbose_name='Label')),
                  ('sort_option', models.IntegerField(choices=[(0, "sort with other tables - if a column in this table is sorted, all the other tables\n    on the page with columns with identical name will be sorted too, as long \n    as they also are marked as 'sort with other tables'\n    "), (1, 'sort individually - this table will be sorted individually; even if other \n    tables on the page have columns with same label this table will be \n    sorted independently'), (2, 'sort in group - this table will be sorted together with a group of \n    tables; you must enter a prefix for this group')], default=0, verbose_name='Sort option')),
                  ('group_prefix', models.CharField(blank=True, help_text='this value is used as a prefix only when "Sort \n        option" is set to "sort in group"\n        ', max_length=200, null=True, verbose_name='Group prefix')),
                  ('empty_template', models.TextField(blank=True, default='There is no data for this table.', help_text='\n        Template which will be displayed when there is no data for this \n        table.\n        ', null=True, verbose_name='Empty template')),
                  ('base_model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='Base model')),
              ],
              options={
                  'verbose_name': 'Table',
                  'verbose_name_plural': 'Tables',
              },
          ),
          migrations.AddField(
              model_name='reportelement',
              name='table',
              field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flexible_reports.Table'),
          ),
          migrations.AddField(
              model_name='column',
              name='parent',
              field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='flexible_reports.Table'),
          ),
          migrations.AlterUniqueTogether(
              name='reportelement',
              unique_together=set([('parent', 'slug'), ('parent', 'position')]),
          ),
          migrations.AlterUniqueTogether(
              name='column',
              unique_together=set([('parent', 'id', 'position')]),
          ),
      ]
  