class Migration(migrations.Migration):

    dependencies = [
        ('auctions', '0008_auto_20200815_2112'),
    ]

    operations = [
        migrations.RenameField(
            model_name='listing',
            old_name='user',
            new_name='creator',
        ),
        migrations.RemoveField(
            model_name='bid',
            name='user',
        ),
        migrations.RemoveField(
            model_name='comment',
            name='user',
        ),
        migrations.AddField(
            model_name='bid',
            name='bidder',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='comment',
            name='commentor',
            field=models.ForeignKey(blank=True, null=True, on_delete=models.SET(auctions.models.Comment.get_deleted_user), to=settings.AUTH_USER_MODEL),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('auctions', '0004_auto_20200710_1146'),
    ]

    operations = [
        migrations.AlterField(
            model_name='items',
            name='category',
            field=models.ForeignKey(null=True,
                                    on_delete=models.SET(
                                        auctions.models.Category),
                                    to='auctions.Category'),
        ),
    ]
Example #3
0
class Migration(migrations.Migration):

    dependencies = [
        ('auctions', '0010_auto_20200711_1352'),
    ]

    operations = [
        migrations.RenameField(
            model_name='items',
            old_name='startPrice',
            new_name='start_price',
        ),
        migrations.AlterField(
            model_name='items',
            name='category',
            field=models.ForeignKey(blank=True, null=True, on_delete=models.SET(auctions.models.Category), related_name='Items', to='auctions.Category'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('auctions', '0009_auto_20200711_1250'),
    ]

    operations = [
        migrations.AlterField(
            model_name='items',
            name='category',
            field=models.ForeignKey(blank=True,
                                    null=True,
                                    on_delete=models.SET(
                                        auctions.models.Category),
                                    related_name='categoryItems',
                                    to='auctions.Category'),
        ),
    ]
Example #5
0
class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('category',
                 models.CharField(choices=[('Electronics', 'Electronics'),
                                           ('Home', 'Home'),
                                           ('Books', 'Books'),
                                           ('Sports', 'Sports'),
                                           ('Automobile', 'Automobile'),
                                           ('Others', 'Others')],
                                  default='Others',
                                  max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='Listing',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=15)),
                ('description', models.TextField(max_length=250)),
                ('image_url', models.URLField(blank=True)),
                ('category',
                 models.ManyToManyField(blank=True,
                                        related_name='listings',
                                        to='auctions.Category')),
            ],
        ),
        migrations.AddField(
            model_name='user',
            name='birth_date',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='user',
            name='location',
            field=models.CharField(blank=True, max_length=30),
        ),
        migrations.CreateModel(
            name='Watchlist',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('listings',
                 models.ManyToManyField(blank=True,
                                        related_name='watchlists',
                                        to='auctions.Listing')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='watchlists',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('author',
                 models.ForeignKey(on_delete=models.SET(
                     auctions.models.get_sentinel_user),
                                   related_name='comments',
                                   to=settings.AUTH_USER_MODEL)),
                ('listing',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='auctions.listing')),
            ],
        ),
        migrations.CreateModel(
            name='Bid',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('value', models.FloatField()),
                ('bidder',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='bids',
                                   to=settings.AUTH_USER_MODEL)),
                ('listing',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='bids',
                                   to='auctions.listing')),
            ],
        ),
    ]
class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(db_index=True, max_length=64, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Listing',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(default=datetime.datetime.now)),
                ('title', models.CharField(db_index=True, max_length=64)),
                ('description', models.TextField()),
                ('image_url', models.URLField()),
                ('starting_bid',
                 models.DecimalField(decimal_places=2, max_digits=9)),
                ('opens_at',
                 models.DateTimeField(default=datetime.datetime.now)),
                ('closes_at', models.DateTimeField()),
                ('category',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='listings',
                     to='auctions.category')),
                ('creator',
                 models.ForeignKey(on_delete=models.SET(
                     auctions.models.get_sentinel_user),
                                   to=settings.AUTH_USER_MODEL)),
                ('users_watching',
                 models.ManyToManyField(blank=True,
                                        related_name='watchlist',
                                        to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('time', models.DateTimeField(default=datetime.datetime.now)),
                ('listing',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='auctions.listing')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Bid',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2,
                                               max_digits=9)),
                ('time', models.DateTimeField(default=datetime.datetime.now)),
                ('listing',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='bids',
                                   to='auctions.listing')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='bids',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Example #7
0
class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='Items',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('description', models.CharField(max_length=100)),
                ('imageUrl', models.CharField(max_length=250)),
                ('is_active', models.BooleanField()),
                ('startPrice',
                 models.DecimalField(decimal_places=2, max_digits=8)),
                ('category',
                 models.ForeignKey(on_delete=models.SET(
                     auctions.models.Category),
                                   to='auctions.Category')),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='UserItems',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('userItem',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='auctions.Items')),
            ],
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.CharField(max_length=100)),
                ('item',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='auctions.Items')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Bid',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('bid_price',
                 models.DecimalField(decimal_places=2, max_digits=8)),
                ('bidOwner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('item',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='auctions.Items')),
            ],
        ),
    ]
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')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('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')),
                ('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='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('tag', models.CharField(max_length=35)),
            ],
        ),
        migrations.CreateModel(
            name='Listing',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.TextField(default='', max_length=1000)),
                ('price', models.FloatField(default=0)),
                ('active', models.BooleanField(default=True)),
                ('photo', models.URLField(default=None, null=True)),
                ('categories',
                 models.ManyToManyField(related_name='listings',
                                        to='auctions.Category')),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date', models.DateTimeField()),
                ('content', models.TextField(max_length=280)),
                ('listingId',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='auctions.Listing')),
                ('userID',
                 models.ForeignKey(on_delete=models.SET(
                     auctions.models.Comment.get_deleted_user),
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Bid',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('amount', models.FloatField()),
                ('listingId',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='bids',
                                   to='auctions.Listing')),
                ('userId',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='user',
            name='watchlist',
            field=models.ManyToManyField(to='auctions.Listing'),
        ),
    ]