text: # -*- coding: utf-8 -*-
  # Generated by Django 1.9.1 on 2016-02-04 17:07
  from __future__ import unicode_literals
  
  import datetime
  import os
  
  import django.db.models.deletion
  from django.db import migrations, models
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ("product", "0010_auto_20160129_0826"),
          ("discount", "0001_initial"),
      ]
  
      operations = [
          migrations.CreateModel(
              name="Voucher",
              fields=[
                  (
                      "id",
                      models.AutoField(
                          auto_created=True,
                          primary_key=True,
                          serialize=False,
                          verbose_name="ID",
                      ),
                  ),
                  (
                      "type",
                      models.CharField(
                          choices=[
                              ("product", "Product"),
                              ("category", "Category"),
                              ("shipping", "Shipping"),
                              ("basket", "Baskets over"),
                          ],
                          max_length=20,
                      ),
                  ),
                  ("name", models.CharField(blank=True, max_length=255, null=True)),
                  ("code", models.CharField(db_index=True, max_length=12, unique=True)),
                  (
                      "usage_limit",
                      models.PositiveIntegerField(
                          blank=True, help_text="Unlimited if empty", null=True
                      ),
                  ),
                  ("used", models.PositiveIntegerField(default=0, editable=False)),
                  ("start_date", models.DateField(default=datetime.date.today)),
                  (
                      "end_date",
                      models.DateField(
                          blank=True, help_text="Never expire if empty", null=True
                      ),
                  ),
                  (
                      "discount_value_type",
                      models.CharField(
                          choices=[
                              ("fixed", os.environ.get("DEFAULT_CURRENCY", "USD")),
                              ("percentage", "%"),
                          ],
                          default="fixed",
                          max_length=10,
                      ),
                  ),
                  (
                      "discount_value",
                      models.DecimalField(decimal_places=2, max_digits=12),
                  ),
                  ("apply_to", models.CharField(blank=True, max_length=20, null=True)),
                  (
                      "limit",
                      models.DecimalField(
                          blank=True, decimal_places=2, max_digits=12, null=True
                      ),
                  ),
                  (
                      "category",
                      models.ForeignKey(
                          blank=True,
                          null=True,
                          on_delete=django.db.models.deletion.CASCADE,
                          to="product.Category",
                      ),
                  ),
                  (
                      "product",
                      models.ForeignKey(
                          blank=True,
                          null=True,
                          on_delete=django.db.models.deletion.CASCADE,
                          to="product.Product",
                      ),
                  ),
              ],
          )
      ]
  