Esempio n. 1
0
class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(max_length=200,
                                  verbose_name='Название для боковой панели')),
                ('short_description',
                 models.TextField(blank=True,
                                  verbose_name='Краткое описание')),
                ('long_description',
                 tinymce.models.HTMLField(blank=True,
                                          verbose_name='Полное описание')),
                ('lng', models.FloatField(verbose_name='Долгота')),
                ('lat', models.FloatField(verbose_name='Широта')),
                ('properties_title',
                 models.CharField(default='',
                                  max_length=200,
                                  verbose_name='Название точки на карте')),
                ('properties_placeId',
                 models.UUIDField(
                     default=uuid.uuid4,
                     editable=False,
                     verbose_name='Уникальный идентификатор локации')),
            ],
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('order',
                 models.SmallIntegerField(default=0,
                                          verbose_name='Позиция в списке')),
                ('image', models.ImageField(upload_to='',
                                            verbose_name='Файл')),
                ('location',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='images',
                                   to='places.location',
                                   verbose_name='Место')),
            ],
            options={
                'ordering': ['order'],
            },
        ),
    ]
Esempio n. 2
0
class Books(BaseModel):
    books_type_choices = ((k, v) for k, v in BOOKS_TYPE.items())
    status_choices = ((k, v) for k, v in STATUS_CHOICE.items())
    type_id = models.SmallIntegerField(default=PYTHON,
                                       choices=books_type_choices,
                                       verbose_name="商品种类")
    name = models.CharField(max_length=20, verbose_name="商品名称")
    desc = models.CharField(max_length=128, verbose_name="商品简介")
    price = models.DecimalField(max_digits=10,
                                decimal_places=2,
                                verbose_name="商品价格")
    unit = models.CharField(max_length=20, verbose_name="商品单位")
    stock = models.IntegerField(default=1, verbose_name="商品库存")
    sales = models.IntegerField(default=0, verbose_name="商品销量")
    detail = tinymce.models.HTMLField(verbose_name="商品详情")
    image = models.ImageField(upload_to='books', verbose_name="商品图片")
    status = models.SmallIntegerField(default=ONLINE,
                                      choices=status_choices,
                                      verbose_name="商品状态")

    objects = BooksManager()

    def __str__(self):
        return self.name

    class Meta:
        db_table = 's_books'
        verbose_name = '书籍'
        verbose_name_plural = '书籍'
Esempio n. 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='GoodsInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('gtitle', models.CharField(max_length=20, verbose_name='商品名称')),
                ('gpic', models.ImageField(blank=True, null=True, upload_to='df_goods', verbose_name='商品图片')),
                ('gprice', models.DecimalField(decimal_places=2, max_digits=7, verbose_name='商品价格')),
                ('gunit', models.CharField(default='500g', max_length=20, verbose_name='商品单位')),
                ('gclick', models.IntegerField(verbose_name='点击量')),
                ('isDelete', models.BooleanField(default=False, verbose_name='是否删除')),
                ('gjianjie', models.CharField(max_length=200, verbose_name='简介')),
                ('gkucun', models.IntegerField(verbose_name='库存')),
                ('gcontent', tinymce.models.HTMLField(verbose_name='详细介绍')),
            ],
            options={
                'verbose_name': '商品信息',
                'verbose_name_plural': '商品信息',
            },
        ),
        migrations.CreateModel(
            name='TypeInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ttitle', models.CharField(max_length=20, verbose_name='类型名称')),
                ('isDelete', models.BooleanField(default=False, verbose_name='是否删除')),
            ],
            options={
                'verbose_name': '分类信息',
                'verbose_name_plural': '分类信息',
            },
        ),
        migrations.AddField(
            model_name='goodsinfo',
            name='gtype',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='df_goods.TypeInfo', verbose_name='所属分类'),
        ),
    ]
Esempio n. 4
0
class Migration(migrations.Migration):
    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('element', models.CharField(max_length=50)),
                ('author', models.CharField(max_length=100)),
                ('type', models.CharField(max_length=100)),
                ('body', tinymce.models.HTMLField()),
            ],
        ),
    ]
class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Blog',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=255)),
                ('sub_title', models.CharField(max_length=255)),
                ('image', models.URLField()),
                ('body', tinymce.models.HTMLField()),
                ('slug', models.SlugField()),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
        ),
    ]
class Migration(migrations.Migration):
    dependencies = [
        ('blog', '0003_auto_20210304_1847'),
    ]

    operations = [
        migrations.AlterField(
            model_name='blog',
            name='body',
            field=tinymce.models.HTMLField(unique=True),
        ),
        migrations.AlterField(
            model_name='blog',
            name='title',
            field=models.CharField(max_length=255, unique=True),
        ),
    ]
Esempio n. 7
0
class ResumeOrder(models.Model):
    class Sections(models.TextChoices):
        PROJECT = 'PR', _('Projects')
        EXPERIENCE = 'EX', _('Experience')
        EDUCATION = 'ED', _('Education')
        SKILLS = 'SK', _('Skills')
        COURSES = 'CO', _('Courses')

    section = models.CharField(max_length=2,
                               choices=Sections.choices,
                               unique=True)
    priority = models.PositiveSmallIntegerField(unique=True)

    class Meta:
        ordering = (
            'priority',
            'section',
        )
Esempio n. 8
0
class Education(models.Model):
    year_start = models.PositiveSmallIntegerField()
    year_end = models.PositiveSmallIntegerField()

    degree = models.TextField(help_text="e.g. Associates of Arts, or AA")

    major = models.TextField()
    minor = models.TextField(blank=True, default='')

    school_name_full = models.TextField()
    school_name_acronym = models.CharField(default='', max_length=10)

    description = models.TextField(blank=True, default='')
    gpa = models.FloatField(
        blank=True,
        null=True,
        default=None,
        validators=[MinValueValidator(0.0),
                    MaxValueValidator(4.0)])

    small_icon = models.ImageField(blank=True, null=True, default=None)

    class Meta:
        ordering = ('-year_start', )

    def year_range_str(self):
        return "{start} - {end}".format(
            start=self.year_start,
            end=self.year_end if self.year_end else "Present")

    year_range_str.short_description = "Dates"  # This is so the admin page has correct column header

    def __str__(self):
        return "{years} : {school} - {major}".format(
            years=self.year_range_str(),
            school=self.school_name_acronym,
            major=self.major)
Esempio n. 9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("useraccounts", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Attributes",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=200)),
                ("is_number", models.BooleanField(default=True)),
                ("is_string", models.BooleanField(default=False)),
            ],
            options={"verbose_name_plural": "Attributes"},
        ),
        migrations.CreateModel(
            name="Category",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("lft", models.PositiveIntegerField(editable=False)),
                ("rght", models.PositiveIntegerField(editable=False)),
                (
                    "tree_id",
                    models.PositiveIntegerField(db_index=True, editable=False),
                ),
                ("level", models.PositiveIntegerField(editable=False)),
                (
                    "parent",
                    mptt.fields.TreeForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="children",
                        to="catalog.Category",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ChangeRequest",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("purchase_order_of_session", models.IntegerField()),
                ("previous_total", models.IntegerField()),
                ("new_total", models.IntegerField()),
                ("description", models.CharField(max_length=100)),
                ("initiator", models.CharField(max_length=50)),
                ("initiation_date", models.DateField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name="FinancialSession",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("session_start_date", models.DateField()),
                ("session_end_date", models.DateField()),
            ],
        ),
        migrations.CreateModel(
            name="HeaderFooter",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("header", tinymce.models.HTMLField()),
                ("footer", tinymce.models.HTMLField()),
                ("is_active", models.BooleanField(default=False)),
            ],
            options={"verbose_name_plural": "Header and Footer"},
        ),
        migrations.CreateModel(
            name="ModeOfPayment",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("method", models.CharField(max_length=25)),
            ],
            options={"verbose_name_plural": "Modes of payment"},
        ),
        migrations.CreateModel(
            name="NonPaymentOrder",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "reference",
                    models.CharField(max_length=200,
                                     verbose_name="Letter No."),
                ),
                (
                    "reference_date",
                    models.DateField(verbose_name="Letter Date"),
                ),
                ("date", models.DateField(auto_now_add=True)),
                (
                    "delivery_address",
                    models.CharField(
                        blank=True,
                        max_length=500,
                        null=True,
                        verbose_name="Site",
                    ),
                ),
                ("item_type", models.CharField(max_length=200)),
                (
                    "buyer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Client",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Product",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=500)),
                ("price_per_unit", models.IntegerField(blank=True, null=True)),
                (
                    "category",
                    mptt.fields.TreeForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="products",
                        to="catalog.Category",
                    ),
                ),
                (
                    "organisation",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="useraccounts.AdminOrganisations",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="PurchaseOrder",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "is_debit",
                    models.BooleanField(default=False,
                                        verbose_name="Non-Payment Job"),
                ),
                (
                    "reference",
                    models.CharField(max_length=200,
                                     verbose_name="Letter No."),
                ),
                (
                    "reference_date",
                    models.DateField(blank=True,
                                     null=True,
                                     verbose_name="Letter Date"),
                ),
                (
                    "delivery_address",
                    models.CharField(
                        blank=True,
                        max_length=500,
                        null=True,
                        verbose_name="Site",
                    ),
                ),
                ("date_time", models.DateField(auto_now_add=True)),
                ("purchase_order_time", models.TimeField(auto_now_add=True)),
                ("total_discount", models.IntegerField(default=0)),
                ("tds", models.IntegerField(default=0)),
                (
                    "cheque_dd_number",
                    models.CharField(blank=True, max_length=50),
                ),
                (
                    "cheque_dd_date",
                    models.DateField(blank=True, max_length=50, null=True),
                ),
                ("is_active", models.BooleanField(default=True)),
                (
                    "buyer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="Client",
                    ),
                ),
                (
                    "mode_of_payment",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.ModeOfPayment",
                    ),
                ),
                (
                    "organisation",
                    models.ForeignKey(
                        default=1,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="useraccounts.AdminOrganisations",
                    ),
                ),
                (
                    "type_of_service",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="useraccounts.OrganisationType",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Surcharge",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("tax_name", models.CharField(max_length=200)),
                ("value", models.FloatField()),
                ("taxes_included", models.BooleanField(default=False)),
                ("tax_effected_from", models.DateField(null=True)),
                ("tax_valid_till", models.DateField(null=True)),
                ("Remark", models.CharField(max_length=1000, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Unit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("unit", models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name="TaxesApplied",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("surcharge_name", models.CharField(max_length=500)),
                ("surcharge_value", models.FloatField()),
                ("tax", models.IntegerField()),
                (
                    "purchase_order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.PurchaseOrder",
                    ),
                ),
                (
                    "surcharge",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.Surcharge",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="SurchargePaid",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("value", models.IntegerField()),
                ("date", models.DateField(auto_now_add=True)),
                (
                    "surcharge",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.Surcharge",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="SpecialCategories",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("voucher", models.BooleanField(default=False)),
                ("tax", models.BooleanField(default=False)),
                (
                    "category",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.Category",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="RequestSurchargeChange",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("previous_value", models.IntegerField()),
                ("new_value", models.IntegerField()),
                (
                    "change_request",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.ChangeRequest",
                    ),
                ),
                (
                    "surcharge",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.TaxesApplied",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="RequestStatus",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("confirmed", models.BooleanField(default=False)),
                ("cancelled", models.BooleanField(default=False)),
                ("request_response", models.DateField(null=True)),
                (
                    "change_request",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.ChangeRequest",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="PurchasedItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("price_per_unit", models.IntegerField()),
                ("qty", models.IntegerField(verbose_name="Quantity")),
                ("price", models.IntegerField()),
                (
                    "item",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.Product",
                    ),
                ),
                (
                    "purchase_order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.PurchaseOrder",
                    ),
                ),
            ],
            options={
                "verbose_name": "Tests",
                "verbose_name_plural": "Tests"
            },
        ),
        migrations.CreateModel(
            name="NonPaymentOrderOfSession",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("non_payment_order_of_session", models.IntegerField()),
                (
                    "non_payment_order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.NonPaymentOrder",
                    ),
                ),
                (
                    "session",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.FinancialSession",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="mCategory",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                (
                    "parent",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.mCategory",
                    ),
                ),
            ],
            options={"verbose_name_plural": "Categories"},
        ),
        migrations.AddField(
            model_name="changerequest",
            name="session",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="catalog.FinancialSession",
            ),
        ),
        migrations.AddField(
            model_name="category",
            name="unit",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="catalog.Unit",
            ),
        ),
        migrations.CreateModel(
            name="Catalog",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("value", models.CharField(max_length=200)),
                (
                    "attribute",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.Attributes",
                    ),
                ),
                (
                    "product",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.Product",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Bill",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("delivery_charges", models.IntegerField()),
                ("total_cost", models.IntegerField()),
                ("totalplusdelivery", models.IntegerField()),
                ("total_tax", models.IntegerField()),
                ("grand_total", models.IntegerField()),
                ("amount_received", models.IntegerField()),
                (
                    "purchase_order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.PurchaseOrder",
                    ),
                ),
            ],
        ),
    ]
Esempio n. 10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("accounts", "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(max_length=50,
                                           verbose_name="Title")),
            ],
            options={
                "verbose_name": "Category",
                "verbose_name_plural": "Categories",
            },
        ),
        migrations.CreateModel(
            name="Newsletter",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("email",
                 models.EmailField(max_length=254, verbose_name="Email")),
                (
                    "timestamp",
                    models.DateTimeField(auto_now=True,
                                         verbose_name="Timestamp"),
                ),
            ],
            options={
                "verbose_name": "newsletter",
                "verbose_name_plural": "newsletters",
            },
        ),
        migrations.CreateModel(
            name="Post",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=100,
                                           verbose_name="Title")),
                ("overview",
                 models.TextField(default="", verbose_name="Overview")),
                (
                    "timestamp",
                    models.DateTimeField(auto_now=True,
                                         verbose_name="Timestamp"),
                ),
                ("content",
                 tinymce.models.HTMLField(default="<p>Hello World</p>")),
                (
                    "featured",
                    models.BooleanField(default=False,
                                        verbose_name="Featured"),
                ),
                (
                    "thumbnail",
                    models.ImageField(
                        blank=True,
                        default="testing.jpeg",
                        upload_to="thumbnail",
                        verbose_name="Thumbnail",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "author",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="accounts.author",
                        verbose_name="Author",
                    ),
                ),
                (
                    "category",
                    models.ManyToManyField(related_name="post",
                                           to="blog.Category",
                                           verbose_name="Category"),
                ),
            ],
            options={
                "verbose_name": "Post",
                "verbose_name_plural": "Posts",
            },
        ),
        migrations.CreateModel(
            name="Comment",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "timestamp",
                    models.DateTimeField(auto_now=True,
                                         verbose_name="Timestamp"),
                ),
                ("content", models.TextField(verbose_name="Content")),
                (
                    "post",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="comment",
                        to="blog.post",
                        verbose_name="post",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="accounts.author",
                        verbose_name="user",
                    ),
                ),
            ],
            options={
                "verbose_name": "comment",
                "verbose_name_plural": "comments",
            },
        ),
    ]
Esempio n. 11
0
class Migration(migrations.Migration):

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Goods',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('name', models.CharField(verbose_name='商品SPU名称',
                                          max_length=20)),
                ('detail',
                 tinymce.models.HTMLField(verbose_name='商品详情', blank=True)),
            ],
            options={
                'verbose_name': '商品SPU',
                'db_table': 'df_goods',
                'verbose_name_plural': '商品SPU',
            },
        ),
        migrations.CreateModel(
            name='GoodsImage',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('image',
                 models.ImageField(verbose_name='图片路径', upload_to='goods')),
            ],
            options={
                'verbose_name': '商品图片',
                'db_table': 'df_goods_image',
                'verbose_name_plural': '商品图片',
            },
        ),
        migrations.CreateModel(
            name='GoodsSKU',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('name', models.CharField(verbose_name='商品名称', max_length=20)),
                ('desc', models.CharField(verbose_name='商品简介',
                                          max_length=256)),
                ('price',
                 models.DecimalField(verbose_name='商品价格',
                                     max_digits=10,
                                     decimal_places=2)),
                ('unite', models.CharField(verbose_name='商品单位',
                                           max_length=20)),
                ('image',
                 models.ImageField(verbose_name='商品图片', upload_to='goods')),
                ('stock', models.IntegerField(verbose_name='商品库存', default=1)),
                ('sales', models.IntegerField(verbose_name='商品销量', default=0)),
                ('status',
                 models.SmallIntegerField(verbose_name='商品状态',
                                          default=1,
                                          choices=[(0, '下线'), (1, '上线')])),
                ('goods',
                 models.ForeignKey(verbose_name='商品SPU',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='goods.Goods')),
            ],
            options={
                'verbose_name': '商品',
                'db_table': 'df_goods_sku',
                'verbose_name_plural': '商品',
            },
        ),
        migrations.CreateModel(
            name='GoodsType',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('name', models.CharField(verbose_name='种类名称', max_length=20)),
                ('logo', models.CharField(verbose_name='标识', max_length=20)),
                ('image',
                 models.ImageField(verbose_name='商品类型图片', upload_to='type')),
            ],
            options={
                'verbose_name': '商品种类',
                'db_table': 'df_goods_type',
                'verbose_name_plural': '商品种类',
            },
        ),
        migrations.CreateModel(
            name='IndexGoodsBanner',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('image',
                 models.ImageField(verbose_name='图片', upload_to='banner')),
                ('index',
                 models.SmallIntegerField(verbose_name='展示顺序', default=0)),
                ('sku',
                 models.ForeignKey(verbose_name='商品',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='goods.GoodsSKU')),
            ],
            options={
                'verbose_name': '首页轮播商品',
                'db_table': 'df_index_banner',
                'verbose_name_plural': '首页轮播商品',
            },
        ),
        migrations.CreateModel(
            name='IndexPromotionBanner',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('name', models.CharField(verbose_name='活动名称', max_length=20)),
                ('url', models.URLField(verbose_name='活动链接')),
                ('image',
                 models.ImageField(verbose_name='活动图片', upload_to='banner')),
                ('index',
                 models.SmallIntegerField(verbose_name='展示顺序', default=0)),
            ],
            options={
                'verbose_name': '主页促销活动',
                'db_table': 'df_index_promotion',
                'verbose_name_plural': '主页促销活动',
            },
        ),
        migrations.CreateModel(
            name='IndexTypeGoodsBanner',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  primary_key=True,
                                  auto_created=True)),
                ('create_time',
                 models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time',
                 models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('is_delete',
                 models.BooleanField(verbose_name='删除标记', default=False)),
                ('display_type',
                 models.SmallIntegerField(verbose_name='展示类型',
                                          default=1,
                                          choices=[(0, '标题'), (1, '图片')])),
                ('index',
                 models.SmallIntegerField(verbose_name='展示顺序', default=0)),
                ('sku',
                 models.ForeignKey(verbose_name='商品SKU',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='goods.GoodsSKU')),
                ('type',
                 models.ForeignKey(verbose_name='商品类型',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='goods.GoodsType')),
            ],
            options={
                'verbose_name': '主页分类展示商品',
                'db_table': 'df_index_type_goods',
                'verbose_name_plural': '主页分类展示商品',
            },
        ),
        migrations.AddField(
            model_name='goodssku',
            name='type',
            field=models.ForeignKey(
                verbose_name='商品种类',
                on_delete=django.db.models.deletion.CASCADE,
                to='goods.GoodsType'),
        ),
        migrations.AddField(
            model_name='goodsimage',
            name='sku',
            field=models.ForeignKey(
                verbose_name='商品',
                on_delete=django.db.models.deletion.CASCADE,
                to='goods.GoodsSKU'),
        ),
    ]
Esempio n. 12
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taggit', '0003_taggeditem_add_unique_index'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    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=70, unique=True)),
                ('slug', models.SlugField(max_length=70, unique=True)),
            ],
            options={
                'verbose_name_plural': 'Categories',
                'ordering': ('name', ),
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('slug', models.SlugField(blank=True, max_length=100)),
                ('status',
                 models.CharField(choices=[('draft', 'Draft'),
                                           ('published', 'Published')],
                                  default='draft',
                                  max_length=15)),
                ('content', tinymce.models.HTMLField()),
                ('date_posted',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('updated',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='author_post',
                                   to=settings.AUTH_USER_MODEL)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='categories',
                                   to='posts.category')),
                ('tags',
                 taggit.managers.TaggableManager(
                     help_text='A comma-separated list of tags.',
                     through='taggit.TaggedItem',
                     to='taggit.Tag',
                     verbose_name='Tags')),
            ],
            options={
                'ordering': ('date_posted', ),
            },
        ),
    ]
Esempio n. 13
0
class Migration(migrations.Migration):
    initial = True

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

    operations = [
        migrations.CreateModel(
            name="BlogPost",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("blog_title", models.TextField()),
                ("pub_date", models.DateField(verbose_name="Date published")),
                ("blog_summary", models.TextField()),
                ("blog_slug", models.SlugField(unique=True)),
                ("blog_text", tinymce.models.HTMLField()),
            ],
        ),
        migrations.CreateModel(
            name="BlogComment",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("comment_text", models.TextField(max_length=750)),
                ("votes", models.IntegerField(default=0)),
                (
                    "blog",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="tomdougiamas.blogpost",
                    ),
                ),
                ("pub_date", models.DateField(verbose_name="Date published")),
                (
                    "author",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Project",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("project_title", models.CharField(max_length=50)),
                ("project_description", tinymce.models.HTMLField()),
            ],
        ),
    ]