Update GenericProduct

Remove url field
Make slug mandatory
This commit is contained in:
PCoder 2018-10-03 09:58:40 +02:00
parent e4bfdec0b6
commit 74ec39498e
2 changed files with 7 additions and 10 deletions

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-10-02 07:57
# Generated by Django 1.9.4 on 2018-10-03 07:57
from __future__ import unicode_literals
from django.db import migrations, models
@ -19,13 +19,12 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('product_name', models.CharField(default='', max_length=128)),
('product_slug', models.SlugField(help_text='An optional html id for the Section. Required to set as target of a link on page', unique=True)),
('product_description', models.CharField(default='', max_length=500)),
('created_at', models.DateTimeField(auto_now_add=True)),
('product_url', models.URLField(blank=True, max_length=1000, null=True)),
('product_price', models.DecimalField(decimal_places=2, max_digits=6)),
('product_vat', models.DecimalField(decimal_places=4, default=0, max_digits=6)),
('product_is_subscription', models.BooleanField(default=True)),
('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, unique=True)),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),

View file

@ -64,20 +64,18 @@ class OrderDetail(AssignPermissionsMixin, models.Model):
class GenericProduct(AssignPermissionsMixin, models.Model):
permissions = ('view_genericproduct',)
product_name = models.CharField(max_length=128, default="")
product_description = models.CharField(max_length=500, default="")
created_at = models.DateTimeField(auto_now_add=True)
product_url = models.URLField(max_length=1000, null=True, blank=True)
product_price = models.DecimalField(max_digits=6, decimal_places=2)
product_vat = models.DecimalField(max_digits=6, decimal_places=4, default=0)
product_is_subscription = models.BooleanField(default=True)
product_slug = models.SlugField(
blank=True, null=True,
unique=True,
help_text=(
'An optional html id for the Section. Required to set as target '
'of a link on page'
)
)
product_description = models.CharField(max_length=500, default="")
created_at = models.DateTimeField(auto_now_add=True)
product_price = models.DecimalField(max_digits=6, decimal_places=2)
product_vat = models.DecimalField(max_digits=6, decimal_places=4, default=0)
product_is_subscription = models.BooleanField(default=True)
def __str__(self):
return self.product_name