Make GenericProduct slug unique

This commit is contained in:
PCoder 2018-10-02 10:00:59 +02:00
parent 930333357e
commit 3bad37c605
2 changed files with 3 additions and 2 deletions

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-10-02 07:25 # Generated by Django 1.9.4 on 2018-10-02 07:57
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
@ -25,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_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)), ('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), bases=(utils.mixins.AssignPermissionsMixin, models.Model),
), ),

View file

@ -72,6 +72,7 @@ class GenericProduct(AssignPermissionsMixin, models.Model):
product_is_subscription = models.BooleanField(default=True) product_is_subscription = models.BooleanField(default=True)
product_slug = models.SlugField( product_slug = models.SlugField(
blank=True, null=True, blank=True, null=True,
unique=True,
help_text=( help_text=(
'An optional html id for the Section. Required to set as target ' 'An optional html id for the Section. Required to set as target '
'of a link on page' 'of a link on page'