Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Override voucher name field to avoid django-oscar's unique constraint #4054

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by Django 3.2.20 on 2023-11-14 11:56
# Generated by Django 3.2.20 on 2023-11-15 10:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('voucher', '0013_make_voucher_names_unique'),
('voucher', '0012_voucher_is_public'),
]

operations = [
Expand Down Expand Up @@ -36,11 +36,6 @@ class Migration(migrations.Migration):
name='date_created',
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name='voucher',
name='name',
field=models.CharField(help_text='This will be shown in the checkout and basket once the voucher is entered', max_length=128, unique=True, verbose_name='Name'),
),
migrations.AlterField(
model_name='voucherapplication',
name='date_created',
Expand Down

This file was deleted.

9 changes: 9 additions & 0 deletions ecommerce/extensions/voucher/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ class OrderLineVouchers(models.Model):


class Voucher(AbstractVoucher):
name = models.CharField(
_("Name"),
max_length=128,
help_text=_(
"This will be shown in the checkout"
" and basket once the voucher is"
" entered"
),
)
SINGLE_USE, MULTI_USE, ONCE_PER_CUSTOMER, MULTI_USE_PER_CUSTOMER = (
'Single use', 'Multi-use', 'Once per customer', 'Multi-use-per-Customer')
USAGE_CHOICES = (
Expand Down
Loading