Пример #1
0
class Brand(models.Model):
    def folder_path(self, filename):
        upload_dir = os.path.join('brand/', f'{self.brand_name}')
        return os.path.join(upload_dir, filename)

    user = models.ForeignKey(User,
                             on_delete=models.CASCADE,
                             related_name='brand_user')
    brand_name = models.CharField(max_length=250)
    is_feature = models.BooleanField(default=False)
    is_approved = models.BooleanField(default=False)
    brand_image = models.FileField(upload_to=folder_path,
                                   blank=True,
                                   null=True)
    alt = models.TextField(max_length=50000, null=True, blank=True)
    approved_by = models.ForeignKey(User,
                                    on_delete=models.CASCADE,
                                    null=True,
                                    blank=True,
                                    related_name='brand_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)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
Пример #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 ProductShipping(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    weight = models.CharField(max_length=250)
    length = models.CharField(max_length=250)
    width = models.CharField(max_length=250)
    height = models.CharField(max_length=250)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
Пример #4
0
class ProductSize(models.Model):
    def folder_path(self, filename):
        product_name = self.product.product_name.lower().replace(' ', '_')
        upload_dir = os.path.join('products/', f'{product_name}/sizes')
        return os.path.join(upload_dir, filename)

    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    size = models.CharField(max_length=250)
    size_image = models.FileField(upload_to=folder_path, blank=True, null=True)
    alt = models.TextField(max_length=10000, null=True, blank=True)
    is_feature = models.BooleanField(default=False)
    price = models.FloatField(default=0)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
Пример #5
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)
Пример #6
0
class ShippingAddress(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    full_name = models.CharField(max_length=250)
    mobile_number = models.CharField(max_length=250)
    country = models.ForeignKey(Country,
                                on_delete=models.CASCADE,
                                related_name='shipping_address_country_name')
    city = models.ForeignKey(City,
                             on_delete=models.CASCADE,
                             related_name='shipping_address_city_name')
    state = models.ForeignKey(State,
                              on_delete=models.CASCADE,
                              related_name='shipping_address_state_name')
    pincode = models.ForeignKey(Pincode,
                                on_delete=models.CASCADE,
                                related_name='shipping_address_pincode')
    address = models.TextField(max_length=20000)
    landmark = models.CharField(max_length=250, null=True, blank=True)
    is_default = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
Пример #7
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)
Пример #8
0
class ProductComment(models.Model):
    product = models.ForeignKey(Product,
                                on_delete=models.CASCADE,
                                related_name="product_comment")
    user = models.ForeignKey(User,
                             on_delete=models.CASCADE,
                             related_name="product_comment_user")
    comment = models.TextField(max_length=65500)
    sub_comment = models.ForeignKey('self',
                                    on_delete=models.CASCADE,
                                    related_name='product_sub_comment',
                                    null=True,
                                    blank=True)
    is_approved = models.BooleanField(default=False)
    approved_by = models.ForeignKey(
        'admin_users.User',
        on_delete=models.CASCADE,
        null=True,
        blank=True,
        related_name='product_comment_approved_by_user')
    is_feature = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
Пример #9
0
class Migration(migrations.Migration):

    dependencies = [
        ('categories', '0014_auto_20170726_2337'),
    ]

    operations = [
        migrations.AlterField(
            model_name='servicepage',
            name='body',
            field=wagtail.core.fields.StreamField((('subheading', wagtail.core.blocks.CharBlock(classname='title', icon='title', template='categories/blocks/subheading.html')), ('paragraph', wagtail.core.blocks.RichTextBlock(icon='pilcrow', template='categories/blocks/paragraph.html')), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.RichTextBlock(blank=True))))), ('pullquote', wagtail.core.blocks.StructBlock((('quote', wagtail.core.blocks.TextBlock('quote title')), ('name', wagtail.core.blocks.CharBlock(blank=True)), ('position', wagtail.core.blocks.CharBlock(blank=True, label='Position or affiliation'))))), ('snippet', wagtail.core.blocks.RichTextBlock(label='Callout', template='categories/blocks/snippet.html')), ('html', categories.models.EmbedHTML(label='Embed code'))), null=True, verbose_name='Page content'),
        ),
        migrations.AlterField(
            model_name='specialcollection',
            name='image',
            field=models.ForeignKey(blank=True, help_text='2x1 aspect ratio preferred, will be sized to 910x400px at its largest.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image'),
        ),
    ]
Пример #10
0
class Migration(migrations.Migration):

    dependencies = [
        ('exhibitions', '0006_exhib_display'),
    ]

    operations = [
        migrations.AlterField(
            model_name='exhibitartwork',
            name='embed_code',
            field=models.TextField(blank=True, help_text='Also used for YouTube or Vimeo. Just copy the URL of the video e.g. https://www.youtube.com/watch?v=F1B9Fk_SgI0 and not the full <iframe> wrapped HTML.'),
        ),
        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='Description'),
        ),
        migrations.AlterField(
            model_name='headerimage',
            name='image',
            field=models.ForeignKey(help_text='Single header images should be ≥ 1360px wide; they will be strecthed if not. Foursquare images are sized to a 400x400 square but you can upload larger images.', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.Image'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('wagtailimages', '0019_delete_filter'),
        ('categories', '0011_auto_20170721_2130'),
    ]

    operations = [
        migrations.AddField(
            model_name='servicepage',
            name='main_image',
            field=models.ForeignKey(
                blank=True,
                help_text='Try to ALWAYS provide a main image.',
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name='+',
                to='wagtailimages.Image'),
        ),
        migrations.AlterField(
            model_name='aboutuspage',
            name='body',
            field=wagtail.core.fields.StreamField(
                (('subheading',
                  wagtail.core.blocks.CharBlock(
                      classname='title',
                      icon='title',
                      template='categories/blocks/subheading.html')),
                 ('paragraph',
                  wagtail.core.blocks.RichTextBlock(
                      icon='pilcrow',
                      template='categories/blocks/paragraph.html')),
                 ('image',
                  wagtail.core.blocks.StructBlock(
                      (('image', wagtail.images.blocks.ImageChooserBlock()),
                       ('caption',
                        wagtail.core.blocks.RichTextBlock(blank=True))))),
                 ('pullquote',
                  wagtail.core.blocks.StructBlock(
                      (('quote', wagtail.core.blocks.TextBlock('quote title')),
                       ('name', wagtail.core.blocks.CharBlock(blank=True)),
                       ('position',
                        wagtail.core.blocks.CharBlock(
                            blank=True, label='Position or affiliation'))))),
                 ('snippet',
                  wagtail.core.blocks.RichTextBlock(
                      template='categories/blocks/snippet.html')),
                 ('html', categories.models.EmbedHTML(label='Embed code'))),
                null=True,
                verbose_name='Page content'),
        ),
        migrations.AlterField(
            model_name='servicepage',
            name='body',
            field=wagtail.core.fields.StreamField(
                (('subheading',
                  wagtail.core.blocks.CharBlock(
                      classname='title',
                      icon='title',
                      template='categories/blocks/subheading.html')),
                 ('paragraph',
                  wagtail.core.blocks.RichTextBlock(
                      icon='pilcrow',
                      template='categories/blocks/paragraph.html')),
                 ('image',
                  wagtail.core.blocks.StructBlock(
                      (('image', wagtail.images.blocks.ImageChooserBlock()),
                       ('caption',
                        wagtail.core.blocks.RichTextBlock(blank=True))))),
                 ('pullquote',
                  wagtail.core.blocks.StructBlock(
                      (('quote', wagtail.core.blocks.TextBlock('quote title')),
                       ('name', wagtail.core.blocks.CharBlock(blank=True)),
                       ('position',
                        wagtail.core.blocks.CharBlock(
                            blank=True, label='Position or affiliation'))))),
                 ('snippet',
                  wagtail.core.blocks.RichTextBlock(
                      template='categories/blocks/snippet.html')),
                 ('html', categories.models.EmbedHTML(label='Embed code'))),
                null=True,
                verbose_name='Page content'),
        ),
    ]
Пример #12
0
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'),
        ),
    ]
Пример #13
0
class ProductView(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)
Пример #14
0
class ProductColor(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    color_code = models.CharField(max_length=250)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now_add=True)