GenericProduct: Remove image field and add slug field

This commit is contained in:
PCoder 2018-10-02 09:27:20 +02:00
parent dd9e7dde35
commit 930333357e
2 changed files with 9 additions and 8 deletions

View file

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-09-26 07:23 # Generated by Django 1.9.4 on 2018-10-02 07:25
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
import filer.fields.image
import utils.mixins import utils.mixins
@ -26,7 +25,7 @@ class Migration(migrations.Migration):
('product_price', models.DecimalField(decimal_places=2, max_digits=6)), ('product_price', models.DecimalField(decimal_places=2, max_digits=6)),
('product_vat', models.DecimalField(decimal_places=4, default=0, max_digits=6)), ('product_vat', models.DecimalField(decimal_places=4, default=0, max_digits=6)),
('product_is_subscription', models.BooleanField(default=True)), ('product_is_subscription', models.BooleanField(default=True)),
('product_image', filer.fields.image.FilerImageField(blank=True, help_text='The product image', null=True, on_delete=django.db.models.deletion.CASCADE, to='filer.Image')), ('product_slug', models.SlugField(blank=True, help_text='An optional html id for the Section. Required to set as target of a link on page', null=True)),
], ],
bases=(utils.mixins.AssignPermissionsMixin, models.Model), bases=(utils.mixins.AssignPermissionsMixin, models.Model),
), ),

View file

@ -8,7 +8,6 @@ from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
from datacenterlight.models import VMPricing, VMTemplate from datacenterlight.models import VMPricing, VMTemplate
from filer.fields.image import FilerImageField
from membership.models import StripeCustomer, CustomUser from membership.models import StripeCustomer, CustomUser
from utils.mixins import AssignPermissionsMixin from utils.mixins import AssignPermissionsMixin
from utils.models import BillingAddress from utils.models import BillingAddress
@ -67,14 +66,17 @@ class GenericProduct(AssignPermissionsMixin, models.Model):
product_name = models.CharField(max_length=128, default="") product_name = models.CharField(max_length=128, default="")
product_description = models.CharField(max_length=500, default="") product_description = models.CharField(max_length=500, default="")
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
product_image = FilerImageField(
on_delete=models.CASCADE, null=True, blank=True,
help_text='The product image'
)
product_url = models.URLField(max_length=1000, null=True, blank=True) product_url = models.URLField(max_length=1000, null=True, blank=True)
product_price = models.DecimalField(max_digits=6, decimal_places=2) product_price = models.DecimalField(max_digits=6, decimal_places=2)
product_vat = models.DecimalField(max_digits=6, decimal_places=4, default=0) product_vat = models.DecimalField(max_digits=6, decimal_places=4, default=0)
product_is_subscription = models.BooleanField(default=True) product_is_subscription = models.BooleanField(default=True)
product_slug = models.SlugField(
blank=True, null=True,
help_text=(
'An optional html id for the Section. Required to set as target '
'of a link on page'
)
)
def __str__(self): def __str__(self):
return self.product_name return self.product_name