From d9f9af9827bfc6f8a693178ab61f85e05dff0777 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Mon, 22 Aug 2016 10:35:30 +1000 Subject: [PATCH] Modifies the Category model to allow for ITEM_QUANTITY forms --- .../migrations/0002_auto_20160822_0034.py | 20 +++++++++++++++++++ registrasion/models/inventory.py | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 registrasion/migrations/0002_auto_20160822_0034.py diff --git a/registrasion/migrations/0002_auto_20160822_0034.py b/registrasion/migrations/0002_auto_20160822_0034.py new file mode 100644 index 00000000..ab346388 --- /dev/null +++ b/registrasion/migrations/0002_auto_20160822_0034.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-08-22 00:34 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('registrasion', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='category', + name='render_type', + field=models.IntegerField(choices=[(1, 'Radio button'), (2, 'Quantity boxes'), (3, 'Product selector and quantity box')], help_text='The registration form will render this category in this style.', verbose_name='Render type'), + ), + ] diff --git a/registrasion/models/inventory.py b/registrasion/models/inventory.py index 84f386e1..a84f0fa8 100644 --- a/registrasion/models/inventory.py +++ b/registrasion/models/inventory.py @@ -36,6 +36,12 @@ class Category(models.Model): where the user can specify a quantity of each Product type. This is useful for additional extras, like Dinner Tickets. + ``RENDER_TYPE_ITEM_QUANTITY`` shows a select menu to select a + Product type, and an input field, where the user can specify the + quantity for that Product type. This is useful for categories that + have a lot of options, from which the user is not going to select + all of the options. + limit_per_user (Optional[int]): This restricts the number of items from this Category that each attendee may claim. This extends across multiple Invoices. @@ -56,10 +62,12 @@ class Category(models.Model): RENDER_TYPE_RADIO = 1 RENDER_TYPE_QUANTITY = 2 + RENDER_TYPE_ITEM_QUANTITY = 3 CATEGORY_RENDER_TYPES = [ (RENDER_TYPE_RADIO, _("Radio button")), (RENDER_TYPE_QUANTITY, _("Quantity boxes")), + (RENDER_TYPE_ITEM_QUANTITY, _("Product selector and quantity box")), ] name = models.CharField(