예제 #1
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0010_change_import_id_in_book_name'),
    ]

    operations = [
        migrations.AlterField(
            model_name='book',
            name='author',
            field=models.ManyToManyField(
                help_text=
                'If there are no author you are looking for, you can create it bellow.',
                to='books.Author'),
        ),
        migrations.AlterField(
            model_name='book',
            name='publication_language',
            field=models.ForeignKey(
                help_text=
                'If there are no language you are looking for, you can create it bellow.',
                on_delete=models.SET(books.models.on_language_delete),
                to='books.publicationlanguage'),
        ),
    ]
예제 #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=64)),
                ('price', models.PositiveIntegerField()),
                ('description', models.TextField(max_length=500)),
                ('image', models.FileField(upload_to=books.models.book_directory_path)),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
                ('address', models.CharField(max_length=128)),
                ('phone', models.CharField(max_length=32)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='books.Category'),
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='books.Publisher'),
        ),
        migrations.AddField(
            model_name='book',
            name='tags',
            field=models.ManyToManyField(to='books.Tag'),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default=None, max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='PublicationLanguage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('language',
                 models.CharField(default=None, max_length=50, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('isbn',
                 models.CharField(
                     max_length=13,
                     unique=True,
                     validators=[
                         django.core.validators.RegexValidator(
                             message='ISBN has to be 13 character long.',
                             regex='(\\d{12}[0-9X]{1})')
                     ])),
                ('title', models.CharField(max_length=255)),
                ('author', models.ManyToManyField(to='books.Author')),
                ('publication_language',
                 models.ForeignKey(on_delete=models.SET(
                     books.models.on_language_delete),
                                   to='books.publicationlanguage')),
            ],
        ),
    ]
예제 #4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('directories', '0007_series'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=60, verbose_name='Имя')),
                ('discription', models.TextField(blank=True, null=True, verbose_name='Описание')),
                ('picture', models.ImageField(default='authors/Author', upload_to=books.models.book_directory_path, verbose_name='Изображение')),
                ('price', models.FloatField(verbose_name='цена (BYN)')),
                ('pyblishing_year', models.IntegerField(blank=True, null=True, verbose_name='год издания')),
                ('pages', models.IntegerField(blank=True, null=True, verbose_name='страниц')),
                ('binding', models.CharField(choices=[('T', 'твердый'), ('М', 'мягкий'), ('др', 'другой')], default='др', max_length=2, verbose_name='переплет')),
                ('format', models.CharField(choices=[('св_кр', 'сверхкрупная (84×108/16; 70×90/8)'), ('кр', 'крупная (70×90/16; 75×90/16)'), ('ср', 'средняя (60×90/16; 84×108/32)'), ('мал', 'малая (70×90/32; 70×108/32)'), ('св_м', 'сверхмалая (60×90/32)')], default='ср', max_length=5, verbose_name='формат')),
                ('ISBN', models.CharField(blank=True, max_length=17, null=True, verbose_name='ISBN номер')),
                ('weight', models.IntegerField(blank=True, null=True, verbose_name='вес, (гр.)')),
                ('age_restrictions', models.CharField(default='нет', max_length=3, verbose_name='возрастные ограничения')),
                ('in_stock', models.IntegerField(blank=True, null=True, verbose_name='кол-во в наличии')),
                ('available', models.BooleanField(default=False, verbose_name='доступна для заказа')),
                ('rating', models.FloatField(blank=True, null=True, verbose_name='рейтинг')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата внесения в каталог')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата последнего редактирования в БД')),
                ('authors', models.ManyToManyField(related_name='books', to='directories.Author')),
                ('genre', models.ManyToManyField(related_name='books', to='directories.Genre', verbose_name='жанры')),
                ('ph', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='books', to='directories.publishinghouse')),
                ('series', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='books', to='directories.series', verbose_name='серия')),
            ],
            options={
                'verbose_name': 'Автор',
                'verbose_name_plural': 'Авторы',
            },
        ),
    ]
예제 #5
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('books', '0006_auto_20181130_0201'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='book',
            name='holder',
        ),
        migrations.AddField(
            model_name='book',
            name='holders',
            field=models.ManyToManyField(related_name='books_held', through='books.BookHolder', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterField(
            model_name='book',
            name='owner',
            field=models.ForeignKey(on_delete=models.SET(books.models.get_default_owner), related_name='books_owned', to=settings.AUTH_USER_MODEL),
        ),
    ]
예제 #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=60)),
                ('slug', models.CharField(max_length=80)),
            ],
            options={
                'verbose_name': 'author',
                'verbose_name_plural': 'authors',
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=60)),
                ('slug', models.SlugField(max_length=80)),
                ('isbn',
                 isbn_field.fields.ISBNField(
                     max_length=28,
                     validators=[isbn_field.validators.ISBNValidator],
                     verbose_name='ISBN')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=books.models.upload_location)),
                ('price',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=10)),
                ('publish_date',
                 models.DateField(blank=True, default=datetime.date.today)),
                ('created', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
                ('active', models.BooleanField(default=True)),
                ('authors',
                 models.ManyToManyField(related_name='books',
                                        to='books.Author')),
            ],
            options={
                'verbose_name': 'book',
                'verbose_name_plural': 'books',
            },
        ),
        migrations.CreateModel(
            name='RequestListener',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('request_value', models.CharField(max_length=200)),
            ],
        ),
    ]
예제 #7
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
            ],
            options={
                'verbose_name': 'Author',
                'verbose_name_plural': 'Authors',
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=150)),
                ('description', models.TextField(verbose_name='description')),
                ('image',
                 sorl.thumbnail.fields.ImageField(
                     blank=True,
                     null=True,
                     upload_to=books.models.book_image_file_path)),
                ('authors',
                 models.ManyToManyField(to='books.Author',
                                        verbose_name='Authors')),
                ('categories',
                 models.ManyToManyField(to='categories.Category',
                                        verbose_name='Categories')),
                ('read_by',
                 models.ManyToManyField(blank=True,
                                        null=True,
                                        to=settings.AUTH_USER_MODEL,
                                        verbose_name='Read By')),
            ],
            options={
                'verbose_name': 'Book',
                'verbose_name_plural': 'Books',
            },
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('review', models.TextField(verbose_name='Review')),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reviews',
                                   to='books.Book')),
                ('user',
                 models.ManyToManyField(to=settings.AUTH_USER_MODEL,
                                        verbose_name='User')),
            ],
            options={
                'verbose_name': 'Review',
                'verbose_name_plural': 'Reviews',
            },
        ),
    ]
예제 #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
                ('slug', models.CharField(blank=True, max_length=255)),
                ('name', models.CharField(max_length=255, unique=True)),
                ('dob', models.DateTimeField(blank=True, null=True)),
                ('country',
                 models.CharField(blank=True, max_length=150, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
                ('slug', models.CharField(blank=True, max_length=255)),
                ('isbn13',
                 models.CharField(blank=True, max_length=10, null=True)),
                ('isbn10',
                 models.CharField(blank=True, max_length=10, null=True)),
                ('title', models.CharField(max_length=255, unique=True)),
                ('edition',
                 models.PositiveSmallIntegerField(blank=True, null=True)),
                ('cover',
                 models.ImageField(blank=True,
                                   upload_to=books.models.book_cover_path)),
                ('item', models.FileField(upload_to='book_file_path')),
                ('description',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('author', models.ManyToManyField(null=True,
                                                  to='books.Author')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
                ('slug', models.CharField(blank=True, max_length=255)),
                ('title', models.CharField(max_length=255, unique=True)),
                ('description',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('parent',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Category')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='book',
            name='category',
            field=models.ManyToManyField(blank=True,
                                         null=True,
                                         to='books.Category'),
        ),
        migrations.AddField(
            model_name='book',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL),
        ),
    ]
예제 #9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('username',
                 models.CharField(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Language',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('about', models.TextField()),
                ('count', models.IntegerField(default=0)),
                ('image',
                 models.ImageField(upload_to=books.models.upload_image)),
                ('book_pdf',
                 models.FileField(
                     upload_to=books.models.upload_image,
                     validators=[
                         django.core.validators.FileExtensionValidator(['pdf'])
                     ])),
                ('genere',
                 models.CharField(choices=[('0', 'Romantic'), ('1', 'Horror'),
                                           ('2', 'Comedy')],
                                  max_length=2)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='bauthor',
                                   to=settings.AUTH_USER_MODEL)),
                ('language',
                 models.ManyToManyField(related_name='book',
                                        to='books.Language')),
            ],
            options={
                'ordering': ('-pk', ),
            },
        ),
    ]
예제 #10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Novel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=20, verbose_name='名称')),
                ('number',
                 models.IntegerField(default=books.models.num,
                                     verbose_name='编号')),
            ],
        ),
        migrations.CreateModel(
            name='NovelTag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('tag', models.CharField(max_length=60, verbose_name='标签')),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('mail', models.CharField(max_length=50, verbose_name='邮箱')),
            ],
        ),
        migrations.CreateModel(
            name='UserToSc',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('number',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Novel')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.User')),
            ],
        ),
        migrations.AddField(
            model_name='user',
            name='number',
            field=models.ManyToManyField(through='books.UserToSc',
                                         to='books.Novel',
                                         verbose_name='num1'),
        ),
        migrations.CreateModel(
            name='NumToTag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('num',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Novel')),
                ('tags',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.NovelTag')),
            ],
        ),
        migrations.AddField(
            model_name='noveltag',
            name='number',
            field=models.ManyToManyField(through='books.NumToTag',
                                         to='books.Novel',
                                         verbose_name='num'),
        ),
        migrations.CreateModel(
            name='NovelMessage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('author', models.CharField(max_length=30, verbose_name='作者')),
                ('introduce',
                 models.CharField(max_length=999, verbose_name='介绍')),
                ('up',
                 models.IntegerField(default=books.models.up_num,
                                     verbose_name='点赞')),
                ('serialize',
                 models.BooleanField(default=1, verbose_name='连载状态')),
                ('vip_type',
                 models.BooleanField(default=0, verbose_name='VIP可阅读')),
                ('cover',
                 models.ImageField(null=True,
                                   upload_to='cover',
                                   verbose_name='封面')),
                ('novel_num',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='books.Novel',
                     verbose_name='小说编号')),
            ],
            options={
                'ordering': ['-up'],
            },
        ),
        migrations.AddField(
            model_name='novel',
            name='mail',
            field=models.ManyToManyField(through='books.UserToSc',
                                         to='books.User'),
        ),
        migrations.AddField(
            model_name='novel',
            name='tag',
            field=models.ManyToManyField(through='books.NumToTag',
                                         to='books.NovelTag'),
        ),
        migrations.CreateModel(
            name='Chapter',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('chapter',
                 models.CharField(max_length=100, verbose_name='小说章节')),
                ('content', models.TextField(verbose_name='单章内容')),
                ('topic',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Novel')),
            ],
        ),
    ]
예제 #11
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(blank=True, max_length=100)),
                ('description', models.TextField(blank=True)),
                ('cover_picture',
                 models.ImageField(blank=True,
                                   height_field=50,
                                   null=True,
                                   upload_to=books.models.upload_dir,
                                   width_field=30)),
                ('disabled', models.BooleanField(default=False)),
                ('slug', models.SlugField(max_length=255)),
                ('price',
                 models.CharField(blank=True, default='500.00',
                                  max_length=100)),
                ('timestamp',
                 models.DateTimeField(blank=True,
                                      default=datetime.datetime.now)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'book',
                'ordering': ('title', ),
                'verbose_name': 'Book',
                'verbose_name_plural': 'Books',
            },
        ),
        migrations.CreateModel(
            name='Contributor',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('contributors',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Contributor',
                'db_table': 'contributor',
                'verbose_name_plural': 'Contributors',
            },
        ),
        migrations.AddField(
            model_name='book',
            name='contributors',
            field=models.ManyToManyField(to='books.Contributor'),
        ),
        migrations.AlterUniqueTogether(
            name='book',
            unique_together=set([('slug', 'title')]),
        ),
    ]
예제 #12
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='DiscoveryMethod',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     help_text=
                     'The name of some means by which people learn about our organization.',
                     max_length=30,
                     unique=True)),
                ('order',
                 models.IntegerField(
                     default=None,
                     help_text=
                     'These values define the order in which the discovery methods should be presented to users.',
                     unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='GroupMembership',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('start_date',
                 models.DateField(
                     default=datetime.date.today,
                     help_text='The first day on which the membership is valid.'
                 )),
                ('end_date',
                 models.DateField(
                     default=datetime.date.today,
                     help_text='The last day on which the membership is valid.'
                 )),
                ('sale_price',
                 models.DecimalField(
                     decimal_places=2,
                     default=Decimal('0'),
                     help_text='The price at which this item sold.',
                     max_digits=6)),
                ('max_members',
                 models.IntegerField(
                     blank=True,
                     default=None,
                     help_text=
                     'The maximum number of members to which this group membership can be applied. Blank if no limit.',
                     null=True)),
            ],
            options={
                'abstract': False,
            },
            bases=(books.models.JournalLiner, models.Model),
        ),
        migrations.CreateModel(
            name='Member',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('nag_re_membership',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'If true, person will be nudged (via email) to renew membership.'
                 )),
                ('membership_card_md5',
                 models.CharField(
                     blank=True,
                     help_text=
                     'MD5 of the member card#. Field will auto-apply MD5 if value is digits.',
                     max_length=32,
                     null=True)),
                ('membership_card_when',
                 models.DateTimeField(
                     blank=True,
                     help_text=
                     'Date/time on which the membership card was created.',
                     null=True)),
                ('auth_user',
                 models.OneToOneField(
                     help_text=
                     'This must point to the corresponding auth.User object.',
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='member',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['auth_user__first_name', 'auth_user__last_name'],
            },
        ),
        migrations.CreateModel(
            name='MemberLogin',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('when',
                 models.DateTimeField(
                     default=django.utils.timezone.now,
                     help_text='Date/time member logged in.')),
                ('ip',
                 models.GenericIPAddressField(
                     help_text='IP address from which member logged in.')),
                ('member',
                 models.ForeignKey(
                     blank=True,
                     help_text='The member who logged in.',
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='members.Member')),
            ],
            options={
                'verbose_name': 'Login',
            },
        ),
        migrations.CreateModel(
            name='MemberNote',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content',
                 models.TextField(
                     help_text=
                     'For staff. Anything you want to say about the member.',
                     max_length=2048)),
                ('author',
                 models.ForeignKey(
                     blank=True,
                     help_text='The member who wrote this note.',
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='member_notes_authored',
                     to='members.Member')),
                ('member',
                 models.ForeignKey(
                     help_text='The member to which this note pertains.',
                     on_delete=django.db.models.deletion.CASCADE,
                     to='members.Member')),
            ],
        ),
        migrations.CreateModel(
            name='Membership',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('start_date',
                 models.DateField(
                     default=datetime.date.today,
                     help_text='The first day on which the membership is valid.'
                 )),
                ('end_date',
                 models.DateField(
                     default=datetime.date.today,
                     help_text='The last day on which the membership is valid.'
                 )),
                ('sale_price',
                 models.DecimalField(
                     decimal_places=2,
                     default=Decimal('0'),
                     help_text='The price at which this item sold.',
                     max_digits=6)),
                ('membership_type',
                 models.CharField(choices=[('R', 'Regular'),
                                           ('W', 'Work-Trade'),
                                           ('S', 'Scholarship'),
                                           ('C', 'Complimentary'),
                                           ('G', 'Group'), ('F', 'Family'),
                                           ('K', 'Gift Card')],
                                  default='R',
                                  help_text='The type of membership.',
                                  max_length=1)),
                ('ctrlid',
                 models.CharField(
                     default=members.models.next_membership_ctrlid,
                     help_text=
                     "Payment processor's id for this membership if it was part of an online purchase.",
                     max_length=40,
                     unique=True)),
                ('protected',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Protect against further auto processing by ETL, etc. Prevents overwrites of manually entered data.'
                 )),
                ('when_nudged',
                 models.DateField(
                     blank=True,
                     default=None,
                     help_text=
                     'Most recent date on which a renewal reminder was sent.',
                     null=True)),
                ('nudge_count',
                 models.IntegerField(
                     default=0,
                     help_text=
                     'The number of times a renewal reminder was sent.')),
                ('group',
                 models.ForeignKey(
                     blank=True,
                     default=None,
                     help_text=
                     'The associated group membership, if any. Usually none.',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='members.GroupMembership')),
                ('member',
                 models.ForeignKey(
                     blank=True,
                     default=None,
                     help_text='The member to whom this membership applies.',
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='members.Member')),
            ],
            options={
                'ordering': ['start_date'],
            },
            bases=(books.models.JournalLiner, models.Model),
        ),
        migrations.CreateModel(
            name='MembershipGiftCard',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('redemption_code',
                 models.CharField(
                     help_text=
                     'A random string printed on the card, used during card redemption / membership activation.',
                     max_length=20,
                     unique=True)),
                ('date_created',
                 models.DateField(
                     default=django.utils.timezone.now,
                     help_text='The date on which the gift card was created.')
                 ),
                ('price',
                 models.DecimalField(
                     decimal_places=2,
                     help_text='The price to buy this gift card.',
                     max_digits=6)),
                ('month_duration',
                 models.IntegerField(
                     blank=True,
                     default=None,
                     help_text=
                     'The number of months of membership this gift card grants when redeemed.',
                     null=True,
                     verbose_name='Months')),
                ('day_duration',
                 models.IntegerField(
                     blank=True,
                     default=None,
                     help_text=
                     'The number of days of membership this gift card grants when redeemed.',
                     null=True,
                     verbose_name='Days')),
            ],
            options={
                'verbose_name': 'Gift card',
            },
        ),
        migrations.CreateModel(
            name='MembershipGiftCardRedemption',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('redemption_date',
                 models.DateField(
                     default=django.utils.timezone.now,
                     help_text='The date on which the gift card was redeemed.')
                 ),
                ('card',
                 models.OneToOneField(
                     help_text='The membership gift card that was redeemed.',
                     on_delete=django.db.models.deletion.PROTECT,
                     to='members.MembershipGiftCard')),
            ],
            options={
                'verbose_name': 'Gift card redemption',
            },
        ),
        migrations.CreateModel(
            name='MembershipGiftCardReference',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('sale_price',
                 models.DecimalField(
                     decimal_places=2,
                     help_text='The price at which this item sold.',
                     max_digits=6)),
                ('ctrlid',
                 models.CharField(
                     default=members.models.next_giftcardref_ctrlid,
                     help_text=
                     "Payment processor's id if this was part of an online purchase.",
                     max_length=40,
                     unique=True)),
                ('protected',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Protect against further auto processing by ETL, etc. Prevents overwrites of manually entered data.'
                 )),
                ('card',
                 models.OneToOneField(
                     blank=True,
                     help_text='The membership gift card being sold.',
                     null=True,
                     on_delete=django.db.models.deletion.PROTECT,
                     to='members.MembershipGiftCard')),
                ('sale',
                 models.ForeignKey(
                     blank=True,
                     help_text=
                     'The sale that includes the card as a line item.',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='books.Sale')),
            ],
            options={
                'verbose_name': 'Membership gift card',
            },
            bases=(models.Model, books.models.JournalLiner),
        ),
        migrations.CreateModel(
            name='Pushover',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('key',
                 models.CharField(
                     help_text="The member's User Key on Pushover.com",
                     max_length=30)),
                ('who',
                 models.ForeignKey(
                     help_text='The member to whom this tagging info applies.',
                     on_delete=django.db.models.deletion.CASCADE,
                     to='members.Member')),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(help_text='A short name for the tag.',
                                  max_length=40,
                                  unique=True)),
                ('meaning',
                 models.TextField(
                     help_text=
                     "A discussion of the tag's semantics. What does it mean? What does it NOT mean?",
                     max_length=500)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Tagging',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_tagged',
                 models.DateTimeField(
                     auto_now_add=True,
                     help_text='Date/time on which the member was tagged.')),
                ('can_tag',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'If True, the tagged member can be a authorizing member for this tag.'
                 )),
                ('authorizing_member',
                 models.ForeignKey(
                     blank=True,
                     help_text=
                     'The member that authorized that the member be tagged.',
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='authorized_taggings',
                     to='members.Member')),
                ('tag',
                 models.ForeignKey(help_text='The tag assigned to the member.',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='members.Tag')),
                ('tagged_member',
                 models.ForeignKey(help_text='The member tagged.',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='taggings',
                                   to='members.Member')),
            ],
        ),
        migrations.CreateModel(
            name='VisitEvent',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('when',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      help_text='Date/time of visit event.')),
                ('method',
                 models.CharField(
                     choices=[('R', 'RFID'), ('F', 'Front Desk'),
                              ('M', 'Mobile App'), ('U', 'Unknown')],
                     default='U',
                     help_text=
                     "The method used to record the visit, such as 'Front Desk' or 'RFID'.",
                     max_length=1)),
                ('event_type',
                 models.CharField(choices=[('A', 'Arrival'), ('P', 'Presence'),
                                           ('D', 'Departure')],
                                  help_text='The type of visit event.',
                                  max_length=1)),
                ('sync1',
                 models.BooleanField(
                     default=False,
                     help_text=
                     "True if this event has been sync'ed to 'other system #1'"
                 )),
                ('who',
                 models.ForeignKey(
                     help_text="The member who's visiting or visited.",
                     on_delete=django.db.models.deletion.PROTECT,
                     to='members.Member')),
            ],
            options={
                'ordering': ['when'],
            },
        ),
        migrations.CreateModel(
            name='WifiMacDetected',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('when',
                 models.DateTimeField(
                     default=django.utils.timezone.now,
                     help_text='Date/time when MAC was noticed to be present.')
                 ),
                ('mac',
                 models.CharField(help_text='A MAC address as 12 hex digits.',
                                  max_length=12)),
            ],
            options={
                'verbose_name_plural': 'Wifi MACs detected',
                'verbose_name': 'Wifi MAC detected',
            },
        ),
        migrations.AddField(
            model_name='membership',
            name='redemption',
            field=models.ForeignKey(
                blank=True,
                default=None,
                help_text=
                'The associated membership gift card redemption, if any. Usually none.',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='members.MembershipGiftCardRedemption'),
        ),
        migrations.AddField(
            model_name='membership',
            name='sale',
            field=models.ForeignKey(
                blank=True,
                default=None,
                help_text=
                "The sale that includes this line item, if any. E.g. comp memberships don't have a corresponding sale.",
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.Sale'),
        ),
        migrations.AddField(
            model_name='member',
            name='tags',
            field=models.ManyToManyField(blank=True,
                                         related_name='members',
                                         through='members.Tagging',
                                         to='members.Tag'),
        ),
        migrations.AddField(
            model_name='groupmembership',
            name='group_tag',
            field=models.ForeignKey(
                help_text=
                'Group membership is initially populated with the set of people having this tag.',
                on_delete=django.db.models.deletion.PROTECT,
                to='members.Tag'),
        ),
        migrations.AddField(
            model_name='groupmembership',
            name='invoice',
            field=models.ForeignKey(
                blank=True,
                default=None,
                help_text=
                'The receivable invoice that includes this line item, if any.',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.ReceivableInvoice'),
        ),
        migrations.AddField(
            model_name='groupmembership',
            name='members_covered',
            field=models.ManyToManyField(through='members.Membership',
                                         to='members.Member'),
        ),
        migrations.AddField(
            model_name='groupmembership',
            name='sale',
            field=models.ForeignKey(
                blank=True,
                default=None,
                help_text=
                'The sale on which this group membership appears as a line item, if any.',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.Sale'),
        ),
        migrations.AlterUniqueTogether(
            name='visitevent',
            unique_together=set([('who', 'when')]),
        ),
        migrations.AlterUniqueTogether(
            name='tagging',
            unique_together=set([('tagged_member', 'tag')]),
        ),
    ]
예제 #13
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        CITextExtension(),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('age', models.PositiveSmallIntegerField()),
                ('email', books.models.CustomEmailField(max_length=254, null=True)),
            ],
            options={
                'db_table': 'author',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', django.contrib.postgres.fields.citext.CICharField(max_length=30)),
                ('created', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'category',
            },
        ),
        migrations.CreateModel(
            name='CategoryRelation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(max_length=30, null=True)),
                ('category1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parents', to='books.Category')),
                ('category2', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='children', to='books.Category')),
            ],
            options={
                'db_table': 'category_relation',
            },
        ),
        migrations.AddField(
            model_name='category',
            name='related_coming',
            field=models.ManyToManyField(related_name='related_going', through='books.CategoryRelation', to='books.Category'),
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('price', django.contrib.postgres.fields.jsonb.JSONField()),
                ('title', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('content', models.BinaryField()),
                ('tags', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=10), size=3)),
                ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='books', to='books.Author')),
                ('category', models.ManyToManyField(related_name='books', to='books.Category')),
            ],
            options={
                'db_table': 'book',
            },
        ),
    ]
예제 #14
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0004_auto_20180603_1541'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='author',
            options={
                'verbose_name': '作者',
                'verbose_name_plural': '作者'
            },
        ),
        migrations.AlterModelOptions(
            name='book',
            options={
                'verbose_name': '書籍',
                'verbose_name_plural': '書籍'
            },
        ),
        migrations.AlterModelOptions(
            name='category',
            options={
                'verbose_name': '類別',
                'verbose_name_plural': '類別'
            },
        ),
        migrations.AlterModelOptions(
            name='publisher',
            options={
                'verbose_name': '出版商',
                'verbose_name_plural': '出版商'
            },
        ),
        migrations.AlterModelOptions(
            name='tag',
            options={
                'verbose_name': '標籤',
                'verbose_name_plural': '標籤'
            },
        ),
        migrations.AlterField(
            model_name='author',
            name='name',
            field=models.CharField(max_length=32, verbose_name='名稱'),
        ),
        migrations.AlterField(
            model_name='book',
            name='authors',
            field=models.ManyToManyField(to='books.Author', verbose_name='作者'),
        ),
        migrations.AlterField(
            model_name='book',
            name='category',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='books.Category',
                verbose_name='使用者'),
        ),
        migrations.AlterField(
            model_name='book',
            name='count',
            field=models.PositiveIntegerField(default=0, verbose_name='庫存'),
        ),
        migrations.AlterField(
            model_name='book',
            name='description',
            field=models.TextField(max_length=500, verbose_name='簡介'),
        ),
        migrations.AlterField(
            model_name='book',
            name='image',
            field=models.ImageField(upload_to=books.models.book_directory_path,
                                    verbose_name='圖片'),
        ),
        migrations.AlterField(
            model_name='book',
            name='price',
            field=models.PositiveIntegerField(verbose_name='價錢'),
        ),
        migrations.AlterField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='books.Publisher',
                verbose_name='出版商'),
        ),
        migrations.AlterField(
            model_name='book',
            name='tags',
            field=models.ManyToManyField(to='books.Tag', verbose_name='標籤'),
        ),
        migrations.AlterField(
            model_name='book',
            name='title',
            field=models.CharField(max_length=64, verbose_name='書名'),
        ),
        migrations.AlterField(
            model_name='category',
            name='name',
            field=models.CharField(max_length=32,
                                   unique=True,
                                   verbose_name='類別'),
        ),
        migrations.AlterField(
            model_name='publisher',
            name='address',
            field=models.CharField(max_length=128, verbose_name='地址'),
        ),
        migrations.AlterField(
            model_name='publisher',
            name='name',
            field=models.CharField(max_length=32, verbose_name='名稱'),
        ),
        migrations.AlterField(
            model_name='publisher',
            name='phone',
            field=models.CharField(max_length=32, verbose_name='電話'),
        ),
        migrations.AlterField(
            model_name='tag',
            name='name',
            field=models.CharField(max_length=20,
                                   unique=True,
                                   verbose_name='標籤'),
        ),
    ]
예제 #15
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('globales', '0011_auto_20201212_1227'),
    ]

    operations = [
        migrations.CreateModel(
            name='BooksCategoria',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30, verbose_name='Name')),
                ('description',
                 models.CharField(blank=True,
                                  max_length=120,
                                  null=True,
                                  verbose_name='Descripción')),
            ],
            options={
                'verbose_name': 'Categoria',
                'verbose_name_plural': 'Categorias',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='BooksEditorial',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30,
                                          verbose_name='Nombre')),
                ('direction',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Dirección')),
            ],
            options={
                'verbose_name': 'Editorial',
                'verbose_name_plural': 'Editoriales',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='BooksPerson',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30,
                                          verbose_name='Nombre')),
                ('other_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  null=True,
                                  verbose_name='Otro Nombre')),
                ('last_name',
                 models.CharField(max_length=30, verbose_name='Apellido')),
                ('other_last_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  null=True,
                                  verbose_name='Otro Apellido')),
                ('birth_date',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Fecha de Nacimiento')),
                ('ciudad_nacimiento',
                 models.CharField(blank=True,
                                  max_length=120,
                                  null=True,
                                  verbose_name='Ciudad de Nacimiento')),
                ('fecha_defuncion',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Fecha de Defunción')),
                ('ciudad_defuncion',
                 models.CharField(blank=True,
                                  max_length=120,
                                  null=True,
                                  verbose_name='Ciudad de Defunción')),
                ('resumen_biografico',
                 ckeditor.fields.RichTextField(
                     blank=True, null=True,
                     verbose_name='Resumen Biográfico')),
                ('foto',
                 models.ImageField(blank=True,
                                   default='books_persona/default.png',
                                   max_length=255,
                                   null=True,
                                   storage=cuenta.libSobreEscribirImagen.
                                   SobreEscribirImagen(),
                                   upload_to=books.models.image_path_person)),
                ('is_autor', models.BooleanField(default=False)),
                ('is_editor', models.BooleanField(default=False)),
                ('pais_defuncion',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.PROTECT,
                                   related_name='persona_pais_dead',
                                   to='globales.Pais')),
                ('pais_nacimiento',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.PROTECT,
                                   related_name='persona_pais_born',
                                   to='globales.Pais')),
            ],
            options={
                'verbose_name': 'Autor',
                'verbose_name_plural': 'Autores',
                'ordering': ['name', 'last_name'],
            },
        ),
        migrations.CreateModel(
            name='BooksPublicacion',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('fecha_edicion',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Fecha de Edición')),
                ('edition_number',
                 models.IntegerField(blank=True,
                                     null=True,
                                     verbose_name='Edición N°')),
                ('fecha_publicacion',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Fecha de Publicación')),
                ('isbn',
                 models.CharField(blank=True,
                                  max_length=17,
                                  null=True,
                                  verbose_name='ISBN')),
                ('issn',
                 models.CharField(blank=True,
                                  max_length=9,
                                  null=True,
                                  verbose_name='ISSN')),
                ('numero',
                 models.IntegerField(blank=True,
                                     null=True,
                                     verbose_name='Número')),
                ('titulo',
                 models.TextField(blank=True,
                                  max_length=256,
                                  null=True,
                                  verbose_name='Título')),
                ('sub_titulo',
                 models.TextField(blank=True,
                                  max_length=256,
                                  null=True,
                                  verbose_name='Sub Título')),
                ('volumen',
                 models.CharField(blank=True,
                                  max_length=256,
                                  null=True,
                                  verbose_name='Volumen')),
                ('resumen',
                 ckeditor.fields.RichTextField(blank=True,
                                               null=True,
                                               verbose_name='Resumen')),
                ('cantidad_paginas', models.IntegerField(blank=True,
                                                         null=True)),
                ('portada',
                 models.ImageField(blank=True,
                                   default='books_portada/default.png',
                                   max_length=255,
                                   null=True,
                                   storage=cuenta.libSobreEscribirImagen.
                                   SobreEscribirImagen(),
                                   upload_to=books.models.image_path_portada,
                                   verbose_name='Portada')),
                ('pdf',
                 models.ImageField(blank=True,
                                   default='books_pdf/default.png',
                                   max_length=255,
                                   null=True,
                                   storage=cuenta.libSobreEscribirImagen.
                                   SobreEscribirImagen(),
                                   upload_to=books.models.image_path_pdf,
                                   verbose_name='PDF')),
                ('autor',
                 models.ManyToManyField(blank=True,
                                        related_name='autores',
                                        to='books.BooksPerson',
                                        verbose_name='Autor')),
                ('categoria',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.PROTECT,
                                   to='books.BooksCategoria',
                                   verbose_name='Categoría')),
                ('editor',
                 models.ManyToManyField(blank=True,
                                        related_name='editores',
                                        to='books.BooksPerson',
                                        verbose_name='Editor')),
                ('editorial',
                 models.ManyToManyField(blank=True,
                                        related_name='editoriales',
                                        to='books.BooksEditorial',
                                        verbose_name='Editorial (es)')),
                ('pais_edicion',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.PROTECT,
                                   related_name='book_pais',
                                   to='globales.Pais',
                                   verbose_name='País de Edición')),
            ],
            options={
                'verbose_name': 'Publicacion',
                'verbose_name_plural': 'Publicaciones',
                'ordering': ['titulo'],
            },
        ),
    ]
예제 #16
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='Email address')),
                ('username',
                 models.CharField(blank=True,
                                  max_length=255,
                                  null=True,
                                  verbose_name='User name')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=32,
                                  null=True,
                                  verbose_name='First name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=32,
                                  null=True,
                                  verbose_name='Last name')),
                ('date_joined',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Date joined')),
                ('is_active',
                 models.BooleanField(default=True, verbose_name='Active')),
                ('is_staff',
                 models.BooleanField(default=False, verbose_name='Staff')),
                ('avatar',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=books.models.user_avatar_path,
                                   verbose_name='Profile picture')),
                ('facebook_email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   null=True,
                                   verbose_name='Facebook email address')),
                ('facebook_avatar',
                 models.URLField(blank=True,
                                 null=True,
                                 verbose_name='Facebook profile picture')),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name_plural': 'users',
                'verbose_name': 'user',
            },
            managers=[
                ('objects', books.managers.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name',
                 models.CharField(max_length=255, verbose_name='First name')),
                ('last_name',
                 models.CharField(max_length=255, verbose_name='Last name')),
            ],
            options={
                'verbose_name_plural': 'Authors',
                'verbose_name': 'Author',
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=255,
                                           verbose_name='Title')),
                ('isbn',
                 models.CharField(blank=True,
                                  help_text='10 or 13 digits',
                                  max_length=13,
                                  null=True,
                                  unique=True,
                                  validators=[books.models.isbn_validator],
                                  verbose_name='ISBN')),
                ('created',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Created')),
                ('updated',
                 models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('cover',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='books/covers',
                                   verbose_name='Cover')),
                ('author',
                 models.ManyToManyField(related_name='author',
                                        to='books.Author',
                                        verbose_name='Author')),
            ],
            options={
                'verbose_name_plural': 'Books',
                'verbose_name': 'Book',
            },
        ),
    ]
예제 #17
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name', models.CharField(max_length=100)),
                ('middle_name',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('last_name',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('country', models.CharField(max_length=100)),
                ('place_of_birth', models.CharField(max_length=300)),
                ('date_of_birth', models.DateField()),
                ('date_of_death', models.DateField(null=True)),
                ('description', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('isbn',
                 models.CharField(max_length=20,
                                  primary_key=True,
                                  serialize=False,
                                  unique=True,
                                  validators=[books.validators.validate_isbn
                                              ])),
                ('description', models.TextField()),
                ('title', models.CharField(max_length=300)),
                ('pages', models.IntegerField(blank=True, null=True)),
                ('publish_date', models.DateField(blank=True, null=True)),
                ('language',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('hidden', models.BooleanField(default=False)),
                ('picture',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=books.models.book_picture_path,
                                   verbose_name='Book picture')),
                ('copies_num', models.IntegerField()),
                ('authors',
                 models.ManyToManyField(related_name='books',
                                        to='books.Author')),
            ],
        ),
        migrations.CreateModel(
            name='BookComment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('body', models.TextField()),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('blocked', models.BooleanField(default=False)),
                ('blocked_reason', models.CharField(max_length=200,
                                                    null=True)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='books.Book')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='BookFile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('description', models.CharField(max_length=100)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('file',
                 models.FileField(upload_to=books.models.book_files_path)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='files',
                                   to='books.Book')),
            ],
        ),
        migrations.CreateModel(
            name='BookTag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Book')),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=300)),
                ('country', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='ReadersListRecord',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_taken', models.DateTimeField(auto_now_add=True)),
                ('date_returned', models.DateTimeField(blank=True)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Book')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=300)),
            ],
        ),
        migrations.CreateModel(
            name='Vote',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('action', models.SmallIntegerField(default=1)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Book')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='booktag',
            name='tag',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to='books.Tag'),
        ),
        migrations.AddField(
            model_name='booktag',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='book',
            name='genre',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='books.Genre'),
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.Publisher'),
        ),
        migrations.AddField(
            model_name='book',
            name='tags',
            field=models.ManyToManyField(blank=True,
                                         related_name='books',
                                         to='books.Tag'),
        ),
        migrations.AddField(
            model_name='author',
            name='genre',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='books.Genre'),
        ),
    ]
예제 #18
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('author_name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('isbn', models.CharField(max_length=120)),
                ('title', models.CharField(max_length=120)),
                ('description', models.TextField()),
                ('length',
                 models.DurationField(default=datetime.timedelta(0, 1200))),
                ('release_date', models.DateTimeField()),
                ('image', models.FileField(blank=True,
                                           null=True,
                                           upload_to=b'')),
                ('audio_link',
                 models.FileField(
                     upload_to=books.models.get_upload_file_name)),
                ('is_banner',
                 models.CharField(choices=[('On', 'on'), ('Off', 'off')],
                                  max_length=10)),
                ('is_featured',
                 models.CharField(choices=[('On', 'on'), ('Off', 'off')],
                                  max_length=10)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('author_id', models.ManyToManyField(to='books.Author')),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('category_name', models.CharField(max_length=50)),
                ('parent',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='child',
                                   to='books.Category')),
            ],
            options={
                'verbose_name': 'category',
                'verbose_name_plural': 'categories',
            },
        ),
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('currency_name', models.CharField(max_length=255)),
                ('currency_symbol', models.CharField(max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('group_name', models.CharField(max_length=120)),
            ],
        ),
        migrations.CreateModel(
            name='Language',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('language_name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Narrator',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('narrator_name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Price',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('price_tag',
                 models.DecimalField(decimal_places=2,
                                     default=Decimal('0.00'),
                                     max_digits=6)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Book')),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='price_currency',
                                   to='books.Currency')),
                ('language',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Language')),
            ],
        ),
        migrations.CreateModel(
            name='ProgramFormat',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('program_name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('publisher_name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Rating',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('rating', models.IntegerField(default=0)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Book')),
                ('user_id',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('group',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Group')),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='category_id',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.Category'),
        ),
        migrations.AddField(
            model_name='book',
            name='narrator_id',
            field=models.ManyToManyField(to='books.Narrator'),
        ),
        migrations.AddField(
            model_name='book',
            name='program_format',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.ProgramFormat'),
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='books.Publisher'),
        ),
    ]