# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-09-12 18:24
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0007_alter_validators_add_error_messages'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='DatabaseAccessControl',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('database_name', models.CharField(max_length=256)),
                ('collection_name', models.CharField(max_length=256)),
                ('is_public', models.BooleanField(default=False)),
                ('search_keys', models.TextField(blank=True, default=b'', help_text=b'The default, blank, returns all keys.\n                                        Providing a list of keys, seperated by whitespace,\n                                        limits the API search to only these keys.', max_length=4096)),
                ('groups', models.ManyToManyField(blank=True, related_name='djmongo_database_access_control', to='auth.Group')),
            ],
            options={
                'verbose_name_plural': 'Database Access Controls',
            },
        ),
        migrations.CreateModel(
            name='SavedSearch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('output_format', models.CharField(choices=[(b'json', b'JSON'), (b'html', b'HTML'), (b'csv', b'Comma Seperated Value (.csv)')], default=b'json', max_length=4)),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('query', models.TextField(default=b'{}', max_length=2048, verbose_name=b'JSON Query')),
                ('type_mapper', models.TextField(default=b'{}', max_length=2048, verbose_name=b'Map non-string variables to numbers or boolean')),
                ('is_public', models.BooleanField(default=False, help_text=b'If checked, the search can be run without authentication')),
                ('sort', models.TextField(blank=True, default=b'', help_text=b'e.g. [["somefield", 1], ["someotherfield", -1] ]', max_length=2048, verbose_name=b'Sort Dict')),
                ('return_keys', models.TextField(blank=True, default=b'', help_text=b'Default is blank which returns all keys.\n                            Seperate keys by whitespace to limit the keys that are returned.', max_length=2048)),
                ('default_limit', models.IntegerField(default=200, help_text=b'Limit results to this number unless specified otherwise.')),
                ('database_name', models.CharField(max_length=100)),
                ('collection_name', models.CharField(max_length=100)),
                ('creation_date', models.DateField(auto_now_add=True)),
                ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='auth.Group')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-creation_date',),
                'get_latest_by': 'creation_date',
                'verbose_name_plural': 'Saved Searches',
            },
        ),
        migrations.AlterUniqueTogether(
            name='databaseaccesscontrol',
            unique_together=set([('database_name', 'collection_name')]),
        ),
    ]
