示例#1
0
class Category(CategoryBase):
    thumbnail = models.FileField(
        upload_to=settings.THUMBNAIL_UPLOAD_PATH,
        null=True, blank=True,
        storage=settings.THUMBNAIL_STORAGE,)
    thumbnail_width = models.IntegerField(blank=True, null=True)
    thumbnail_height = models.IntegerField(blank=True, null=True)
    order = models.IntegerField(default=0)
    alternate_title = models.CharField(
        blank=True,
        default="",
        max_length=100,
        help_text="An alternative title to use on pages with this category.")
    alternate_url = models.CharField(
        blank=True,
        max_length=200,
        help_text="An alternative URL to use instead of the one derived from "
                  "the category hierarchy.")
    description = models.TextField(blank=True, null=True)
    meta_keywords = models.CharField(
        blank=True,
        default="",
        max_length=255,
        help_text="Comma-separated keywords for search engines.")
    meta_extra = models.TextField(
        blank=True,
        default="",
        help_text="(Advanced) Any additional HTML to be placed verbatim "
                  "in the <head>")
示例#2
0
class Product(models.Model):
    def folder_path(self, filename):
        product_name = self.product_name.lower().replace(' ', '_')
        upload_dir = os.path.join('products/', f'{product_name}/certificate')
        return os.path.join(upload_dir, filename)

    product_code = models.CharField(max_length=250, unique=True)
    user = models.ForeignKey(User,
                             on_delete=models.CASCADE,
                             related_name='product_user')
    brand = models.ForeignKey(Brand,
                              on_delete=models.CASCADE,
                              null=True,
                              blank=True,
                              related_name='product_brand_relation')
    category = models.ForeignKey(Categories,
                                 on_delete=models.CASCADE,
                                 null=True,
                                 blank=True)
    product_name = models.CharField(max_length=255, unique=True)
    product_description = models.TextField(max_length=65500,
                                           null=True,
                                           blank=True)
    product_specification = models.TextField(max_length=65500,
                                             null=True,
                                             blank=True)
    purchase_note = models.TextField(max_length=65500, null=True, blank=True)
    certificate_by = models.CharField(max_length=250, null=True, blank=True)
    certificate_file = models.FileField(upload_to=folder_path,
                                        blank=True,
                                        null=True)
    price = models.FloatField(max_length=250)
    selling_price = models.FloatField(max_length=250)
    price_off = models.CharField(max_length=250, null=True, blank=True)
    status = models.BooleanField(default=True)
    likes = models.IntegerField(default=0)
    view = models.IntegerField(default=0)
    total_comment = models.IntegerField(default=0)
    total_review = models.FloatField(default=0)
    is_feature = models.BooleanField(default=False)
    is_approved = models.BooleanField(default=False)
    approved_by = models.ForeignKey('admin_users.User',
                                    on_delete=models.CASCADE,
                                    null=True,
                                    blank=True,
                                    related_name='product_approved_by_user')
    slug = models.CharField(max_length=250, blank=True, null=True)
    meta_description = models.TextField(max_length=10000,
                                        null=True,
                                        blank=True)
    meta_keyword = models.CharField(max_length=250, null=True, blank=True)
    meta_title = models.CharField(max_length=250, null=True, blank=True)
    delivery_charge = models.IntegerField(default=0)
    is_cod = models.BooleanField(default=True)
    product_tags = models.TextField(max_length=65500, null=True, blank=True)
    delivery_time = models.CharField(max_length=250, null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
示例#3
0
class ProductInventory(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    stock_keeping_unit = models.CharField(max_length=250)
    stock_quantity = models.IntegerField(default=0)
    stock_status = models.CharField(max_length=250,
                                    choices=(('In stock', 'In stock'),
                                             ('Out of stock', 'Out of stock'),
                                             ('On backorder', 'On backorder')),
                                    null=True,
                                    blank=True)
    allow_backorders = models.CharField(
        max_length=250,
        choices=(('Do not allow', 'Do not allow'),
                 ('Allow, but notify customer',
                  'Allow, but notify customer'), ('Allow', 'Allow')),
        null=True,
        blank=True)
    low_stock_threshold = models.IntegerField(default=0)
    sold_individually = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
示例#4
0
class ProductReview(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    review = models.IntegerField(default=1)
    review_description = models.TextField(max_length=65500,
                                          null=True,
                                          blank=True)
    approved_by = models.ForeignKey(
        'admin_users.User',
        on_delete=models.CASCADE,
        null=True,
        blank=True,
        related_name='product_review_approved_by_user')
    is_approved = models.BooleanField(default=False)
    is_feature = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
示例#5
0
class Migration(migrations.Migration):

    dependencies = [
        ('exhibitions', '0002_exhibit-media'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='exhibitsindexpage',
            options={'ordering': ['order', '-last_published_at']},
        ),
        migrations.AddField(
            model_name='exhibitsindexpage',
            name='order',
            field=models.IntegerField(
                default=1,
                help_text=
                'Defines the sort order in the parent row (lower numbers go first).'
            ),
        ),
        migrations.AlterField(
            model_name='exhibitartwork',
            name='type',
            field=models.CharField(
                choices=[('image', 'Image'), ('html', 'Embed code (HTML)')],
                default='image',
                help_text=
                'Used to determines the way this work appears in the gallery.',
                max_length=20),
        ),
        migrations.AlterField(
            model_name='exhibitpage',
            name='description',
            field=wagtail.core.fields.StreamField(
                [('subheading',
                  wagtail.core.blocks.CharBlock(
                      classname='title',
                      icon='title',
                      template='categories/blocks/subheading.html')),
                 ('paragraph',
                  wagtail.core.blocks.RichTextBlock(
                      features=[
                          'bold', 'italic', 'link', 'document-link', 'h3',
                          'ol', 'ul', 'image', 'embed', 'hr'
                      ],
                      icon='pilcrow',
                      template='categories/blocks/paragraph.html')),
                 ('image',
                  wagtail.core.blocks.StructBlock(
                      [('image', wagtail.images.blocks.ImageChooserBlock()),
                       ('caption',
                        wagtail.core.blocks.RichTextBlock(features=[
                            'bold', 'italic', 'link', 'document-link'
                        ],
                                                          required=False))])),
                 ('linked_image',
                  wagtail.core.blocks.StructBlock(
                      [('image', wagtail.images.blocks.ImageChooserBlock()),
                       ('caption',
                        wagtail.core.blocks.RichTextBlock(features=[
                            'bold', 'italic', 'link', 'document-link'
                        ],
                                                          required=False)),
                       ('link', wagtail.core.blocks.URLBlock())])),
                 ('pullquote',
                  wagtail.core.blocks.StructBlock([
                      ('quote', wagtail.core.blocks.TextBlock('quote title')),
                      ('name', wagtail.core.blocks.CharBlock(required=False)),
                      ('position',
                       wagtail.core.blocks.CharBlock(
                           label='Position or affiliation', required=False))
                  ])),
                 ('snippet',
                  wagtail.core.blocks.RichTextBlock(
                      label='Callout',
                      template='categories/blocks/snippet.html')),
                 ('html', categories.models.EmbedHTML(label='Embed code')),
                 ('row',
                  wagtail.core.blocks.StreamBlock(
                      [('distribution',
                        wagtail.core.blocks.ChoiceBlock(
                            blank=False,
                            choices=[('left', 'left side bigger'),
                                     ('right', 'right side bigger'),
                                     ('equal', 'equal size sides')],
                            max_num=1,
                            min_num=1)),
                       ('paragraph',
                        wagtail.core.blocks.RichTextBlock(
                            features=[
                                'bold', 'italic', 'link', 'document-link',
                                'h3', 'ol', 'ul', 'image', 'embed', 'hr'
                            ],
                            icon='pilcrow',
                            template='categories/blocks/paragraph.html')),
                       ('image',
                        wagtail.core.blocks.StructBlock([
                            ('image',
                             wagtail.images.blocks.ImageChooserBlock()),
                            ('caption',
                             wagtail.core.blocks.RichTextBlock(features=[
                                 'bold', 'italic', 'link', 'document-link'
                             ],
                                                               required=False))
                        ])),
                       ('linked_image',
                        wagtail.core.blocks.StructBlock(
                            [('image',
                              wagtail.images.blocks.ImageChooserBlock()),
                             ('caption',
                              wagtail.core.blocks.RichTextBlock(
                                  features=[
                                      'bold', 'italic', 'link', 'document-link'
                                  ],
                                  required=False)),
                             ('link', wagtail.core.blocks.URLBlock())])),
                       ('pullquote',
                        wagtail.core.blocks.StructBlock(
                            [('quote',
                              wagtail.core.blocks.TextBlock('quote title')),
                             ('name',
                              wagtail.core.blocks.CharBlock(required=False)),
                             ('position',
                              wagtail.core.blocks.CharBlock(
                                  label='Position or affiliation',
                                  required=False))])),
                       ('snippet',
                        wagtail.core.blocks.RichTextBlock(
                            features=[
                                'bold', 'italic', 'link', 'document-link',
                                'h3', 'ol', 'ul', 'image', 'embed', 'hr'
                            ],
                            label='Callout',
                            template='categories/blocks/snippet.html'))],
                      max_num=3))],
                null=True,
                verbose_name='Introduction/Description'),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('wagtailcore', '0040_page_draft_title'),
        ('wagtailimages', '0020_add-verbose-name'),
    ]

    operations = [
        migrations.CreateModel(
            name='ExhibitArtwork',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('type', models.CharField(choices=[('image', 'Image'), ('audio', 'Audio'), ('video', 'Video'), ('html', 'Embed code (HTML)')], default='image', help_text='Used to determines the way this work appears in the gallery.', max_length=20)),
                ('title', models.CharField(max_length=255)),
                ('creator', models.TextField(blank=True, verbose_name='Creator(s)')),
                ('link', models.TextField(blank=True, help_text='Optional, if provided the title will be hyperlinked to this URL.')),
                ('embed_code', models.TextField(blank=True, help_text='Optional, use this for HTML embeds, videos, audio, etc.')),
                ('description', wagtail.core.fields.RichTextField(blank=True, help_text='Notes or a general description.')),
                ('image', models.ForeignKey(blank=True, help_text='Image (used as the thumbnail if this isn\'t an "image" type work)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.Image')),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ExhibitPage',
            fields=[
                ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
                ('display_template', models.CharField(choices=[('banner', 'Single header image'), ('foursquare', 'Four square header images')], default='banner', help_text='There are two layouts for the header; one large banner image or four square images set to the left of the title.', max_length=20)),
                ('location', wagtail.core.fields.RichTextField(blank=True, help_text='E.g. Simpson, Meyer')),
                ('dates', wagtail.core.fields.RichTextField(blank=True, help_text='Time period when the exibit ran.')),
                ('creators', wagtail.core.fields.RichTextField(blank=True, help_text='Name(s) of artists and curators.')),
                ('reception', wagtail.core.fields.RichTextField(blank=True, help_text='Details about the reception like date/time.')),
                ('description', wagtail.core.fields.StreamField([('subheading', wagtail.core.blocks.CharBlock(classname='title', icon='title', template='categories/blocks/subheading.html')), ('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link', 'h3', 'ol', 'ul', 'image', 'embed', 'hr'], icon='pilcrow', template='categories/blocks/paragraph.html')), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link'], required=False))])), ('linked_image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link'], required=False)), ('link', wagtail.core.blocks.URLBlock())])), ('pullquote', wagtail.core.blocks.StructBlock([('quote', wagtail.core.blocks.TextBlock('quote title')), ('name', wagtail.core.blocks.CharBlock(required=False)), ('position', wagtail.core.blocks.CharBlock(label='Position or affiliation', required=False))])), ('snippet', wagtail.core.blocks.RichTextBlock(label='Callout', template='categories/blocks/snippet.html')), ('html', categories.models.EmbedHTML(label='Embed code')), ('row', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link', 'h3', 'ol', 'ul', 'image', 'embed', 'hr'], icon='pilcrow', template='categories/blocks/paragraph.html')), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link'], required=False))])), ('linked_image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link'], required=False)), ('link', wagtail.core.blocks.URLBlock())])), ('pullquote', wagtail.core.blocks.StructBlock([('quote', wagtail.core.blocks.TextBlock('quote title')), ('name', wagtail.core.blocks.CharBlock(required=False)), ('position', wagtail.core.blocks.CharBlock(label='Position or affiliation', required=False))])), ('snippet', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link', 'document-link', 'h3', 'ol', 'ul', 'image', 'embed', 'hr'], label='Callout', template='categories/blocks/snippet.html'))], max_num=2))], null=True, verbose_name='Introduction/Description')),
                ('epilogue', wagtail.core.fields.RichTextField(blank=True, help_text='Footer text (e.g. for licensing, attribution)')),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
        migrations.CreateModel(
            name='ExhibitsIndexPage',
            fields=[
                ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
                ('front_matter', wagtail.core.fields.RichTextField(blank=True, help_text='Text that appears at the top of the index page by the title.')),
                ('epilogue', wagtail.core.fields.RichTextField(blank=True, help_text='Bottom text just above the footer (e.g. for licensing, attribution notes).')),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
        migrations.CreateModel(
            name='HeaderImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('image', models.ForeignKey(help_text='Header image', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.Image')),
                ('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='header_image', to='exhibitions.ExhibitPage')),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='exhibitartwork',
            name='page',
            field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='exhibit_artwork', to='exhibitions.ExhibitPage'),
        ),
    ]