Skip to content
This repository
Browse code

added documentation / tests / runtests.sh

  • Loading branch information...
commit 9dfb098aa914cc4ec61d240960011c619cc8dc8e 1 parent ba2aca5
Martin Brochhaus mbrochh authored
91 README.rst
Source Rendered
@@ -2,10 +2,12 @@
2 2 django SHOP - Simple Variations
3 3 ================================
4 4
5   -This app's purpose is to provide a way to quickly create product variations for most simple cases.
  5 +This app's purpose is to provide a way to quickly create product variations for
  6 +most simple cases.
6 7
7   -It considers variations as a {label: value} entry in the cart modifiers, so it is perfect for things like
8   -differently priced colors, or build-your-own computers for example.
  8 +It considers variations as a {label: value} entry in the cart modifiers, so it
  9 +is perfect for things like differently priced colors, or build-your-own
  10 +computers for example.
9 11
10 12
11 13 Installation
@@ -13,21 +15,92 @@ Installation
13 15
14 16 This requires django SHOP to work (https://github.com/chrisglass/django-shop)
15 17
16   -* Add the app to your installed app
17   -* Add `shop_simplevariations.cart_modifier.ProductOptionsModifier` to your `SHOP_CART_MODIFIERS` setting.
  18 +* Add the app to your INSTALLED_APPS in your settings.py
  19 +* Add `shop_simplevariations.cart_modifier.ProductOptionsModifier` to your
  20 + `SHOP_CART_MODIFIERS` setting.
  21 +* Add `(r'^shop/cart/', include(simplevariations_urls)),` to your `urls.py`
  22 + just before `(r'^shop/', include(shop_urls)),`
  23 +
  24 +Your urls.py should look like this:
  25 +
  26 +::
  27 +
  28 + from django.conf.urls.defaults import *
  29 + from django.contrib import admin
  30 +
  31 + from shop import urls as shop_urls
  32 + from shop_simplevariations import urls as simplevariations_urls
  33 +
  34 +
  35 + admin.autodiscover()
  36 +
  37 +
  38 + urlpatterns = patterns('',
  39 + (r'^admin/', include(admin.site.urls)),
  40 + (r'^shop/cart/', include(simplevariations_urls)),
  41 + (r'^shop/', include(shop_urls)),
  42 + )
18 43
19 44 Usage
20   -======
  45 +=====
21 46
22 47 * Create an Option group in the admin view
23 48 * Bind it to a product
24 49 * Add options and the corresponding price to the group.
25   -* When a `CartItemOption` object is linked to a `CartItem`, the option's value will be added to the CartItem's price
26   - and a corresponding extra field willbe added to the Cart/Order.
  50 +* When a `CartItemOption` object is linked to a `CartItem`, the option's value
  51 + will be added to the CartItem's price and a corresponding extra field willbe
  52 + added to the Cart/Order.
  53 +* Override django-shop's `product_detail.html` template and add selection
  54 + elements so that your users can select variations.
  55 +
  56 +
  57 +The product_detail.html template
  58 +================================
  59 +The simple `product_detail.html` that ships with the shop doesn't take
  60 +variations into consideration.
  61 +
  62 +Therefore you need to override the template. django-shop-simplevariations
  63 +ships with two templatetags that help creating drop down lists so that a
  64 +customer can actually chose variation.
  65 +
  66 +First make sure to load the simplecariation templatetags:
  67 +
  68 +::
  69 +
  70 + {% load simplevariation_tags %}
  71 + <h1>Product detail:</h1>
  72 + ...
  73 +
  74 +Next create the drop down lists of OptionsGroups and Options:
  75 +
  76 +::
27 77
  78 + <form method="post" action="{% url cart %}">{% csrf_token %}
  79 + {% with option_groups=object|get_option_groups %}
  80 + {% if option_groups %}
  81 + <div>
  82 + <h2>Variations:</h2>
  83 + {% for option_group in option_groups %}
  84 + <label for="add_item_option_group_{{ option_group.id }}">{{ option_group.name }}</label>
  85 + {% with options=option_group|get_options %}
  86 + <select name="add_item_option_group_{{ option_group.id }}">
  87 + {% for option in options %}
  88 + <option value="{{ option.id }}">{{ option.name }}</option>
  89 + {% endfor %}
  90 + </select>
  91 + {% endwith %}
  92 + {% endfor %}
  93 + </div>
  94 + {% endif %}
  95 + {% endwith %}
  96 + <input type="hidden" name="add_item_id" value="{{object.id}}">
  97 + <input type="hidden" name="add_item_quantity" value="1">
  98 + <input type="submit" value="Add to cart">
  99 + </form>
28 100
29 101 Contributing
30 102 ============
31 103
32 104 Feel free to fork this project on github, send pull requests...
33   -development discussion happends on the django SHOP mailing list (django-shop@googlegroups.com)
  105 +development discussion happends on the django SHOP mailing list
  106 +(django-shop@googlegroups.com)
61 runtests.sh
... ... @@ -0,0 +1,61 @@
  1 +#!/bin/bash
  2 +
  3 +args=("$@")
  4 +num_args=${#args[@]}
  5 +index=0
  6 +
  7 +suite='shop_simplevariations'
  8 +coverage=false
  9 +documentation=false
  10 +ci=false
  11 +
  12 +while [ "$index" -lt "$num_args" ]
  13 +do
  14 + case "${args[$index]}" in
  15 + "--with-docs")
  16 + documentation=true
  17 + ;;
  18 + "--with-coverage")
  19 + coverage=true
  20 + ;;
  21 + "--ci")
  22 + ci=true
  23 + ;;
  24 + *)
  25 + suite="shop.${args[$index]}"
  26 + esac
  27 +let "index = $index + 1"
  28 +done
  29 +if [ $ci == true ]; then
  30 + pushd .
  31 + cd tests/testapp
  32 + coverage run manage.py test $suite
  33 + coverage xml
  34 + popd
  35 +
  36 +elif [ $coverage == true ]; then
  37 + pushd .
  38 + cd tests/testapp
  39 + coverage run manage.py test $suite
  40 + coverage html
  41 + #x-www-browser htmlcov/index.html
  42 + popd
  43 +
  44 +else
  45 +
  46 + # the default case...
  47 + pushd .
  48 + cd tests/testapp
  49 + python manage.py test $suite
  50 + popd
  51 +
  52 +fi
  53 +
  54 +if [ $documentation == true ]; then
  55 + pushd .
  56 + cd docs/
  57 + make html
  58 + x-www-browser _build/html/index.html
  59 + popd
  60 +fi
  61 +
2  shop_simplevariations/templatetags/simplevariation_tags.py
... ... @@ -1,7 +1,5 @@
1 1 from django import template
2 2
3   -from ..models import CartItemOption
4   -
5 3 register = template.Library()
6 4
7 5
3  shop_simplevariations/tests/__init__.py
... ... @@ -0,0 +1,3 @@
  1 +from .cart_modifier import *
  2 +from .simplevariation_tags import *
  3 +from .views import *
69 shop_simplevariations/tests/product_options.py → shop_simplevariations/tests/cart_modifier.py
@@ -9,20 +9,21 @@
9 9 from shop.tests.utils.context_managers import SettingsOverride
10 10 from shop_simplevariations.models import OptionGroup, Option, CartItemOption
11 11
  12 +
12 13 class ProductOptionsTestCase(TestCase):
13   -
  14 +
14 15 PRODUCT_PRICE = Decimal('100')
15   - AWESOME_OPTION_PRICE = Decimal('50') # The price of awesome?
  16 + AWESOME_OPTION_PRICE = Decimal('42') # The price of awesome?
16 17 TEN_PERCENT = Decimal(10) / Decimal(100)
17   -
18   - def create_fixtures(self):
  18 +
  19 + def create_fixtures(self, quantity=1):
19 20 cart_modifiers_pool.USE_CACHE=False
20   -
21   - self.user = User.objects.create(username="test",
  21 +
  22 + self.user = User.objects.create(username="test",
22 23 email="test@example.com",
23 24 first_name="Test",
24 25 last_name = "Toto")
25   -
  26 +
26 27 self.product = Product()
27 28 self.product.name = "TestPrduct"
28 29 self.product.slug = "TestPrduct"
@@ -31,55 +32,75 @@ def create_fixtures(self):
31 32 self.product.active = True
32 33 self.product.unit_price = self.PRODUCT_PRICE
33 34 self.product.save()
34   -
  35 +
35 36 self.ogroup = OptionGroup()
36 37 self.ogroup.product = self.product
37 38 self.ogroup.name = 'Test group'
38 39 self.ogroup.save()
39   -
  40 +
40 41 self.option = Option()
41 42 self.option.group = self.ogroup
42 43 self.option.name = "Awesome"
43 44 self.option.price = self.AWESOME_OPTION_PRICE
44 45 self.option.save()
45   -
  46 +
46 47 self.cart = Cart()
47 48 self.cart.user = self.user
48 49 self.cart.save()
49   -
  50 +
50 51 self.cartitem = CartItem()
51 52 self.cartitem.cart = self.cart
52   - self.cartitem.quantity = 1
  53 + self.cartitem.quantity = quantity
53 54 self.cartitem.product = self.product
54 55 self.cartitem.save()
55   -
  56 +
56 57 def test_01_no_options_yield_normal_price(self):
57 58 self.create_fixtures()
58   - MODIFIERS = ['shop.cart.modifiers.product_options.ProductOptionsModifier']
  59 + MODIFIERS = ['shop_simplevariations.cart_modifier.ProductOptionsModifier']
59 60 with SettingsOverride(SHOP_CART_MODIFIERS=MODIFIERS):
60 61 #No need to add a product there is already on in the fixtures
61 62 self.cart.update()
62 63 self.cart.save()
63   - sub_should_be = 1*self.PRODUCT_PRICE
64   - total_should_be = sub_should_be
65   -
  64 + sub_should_be = 1*self.PRODUCT_PRICE
  65 + total_should_be = sub_should_be
  66 +
66 67 self.assertEqual(self.cart.subtotal_price, sub_should_be)
67 68 self.assertEqual(self.cart.total_price, total_should_be)
68   -
  69 +
69 70 def test_02_awesome_option_increases_price_by_its_value(self):
70 71 self.create_fixtures()
71   -
  72 +
72 73 c_item_option = CartItemOption()
73 74 c_item_option.option = self.option
74 75 c_item_option.cartitem = self.cartitem
75 76 c_item_option.save()
76   -
77   - MODIFIERS = ['shop.cart.modifiers.product_options.ProductOptionsModifier']
  77 +
  78 + MODIFIERS = ['shop_simplevariations.cart_modifier.ProductOptionsModifier']
78 79 with SettingsOverride(SHOP_CART_MODIFIERS=MODIFIERS):
79 80 self.cart.update()
80 81 self.cart.save()
81 82 sub_should_be = (1*self.PRODUCT_PRICE) + (1*self.AWESOME_OPTION_PRICE)
82   - total_should_be = sub_should_be
83   -
  83 + total_should_be = sub_should_be
  84 +
84 85 self.assertEqual(self.cart.subtotal_price, sub_should_be)
85   - self.assertEqual(self.cart.total_price, total_should_be)
  86 + self.assertEqual(self.cart.total_price, total_should_be)
  87 +
  88 + def test03_quantity_should_be_used_by_modifier(self):
  89 + quantity = 2
  90 + self.create_fixtures(quantity=quantity)
  91 +
  92 + c_item_option = CartItemOption()
  93 + c_item_option.option = self.option
  94 + c_item_option.cartitem = self.cartitem
  95 + c_item_option.save()
  96 +
  97 + MODIFIERS = ['shop_simplevariations.cart_modifier.ProductOptionsModifier']
  98 + with SettingsOverride(SHOP_CART_MODIFIERS=MODIFIERS):
  99 + self.cart.update()
  100 + self.cart.save()
  101 + sub_should_be = (quantity*self.PRODUCT_PRICE) \
  102 + + (quantity*self.AWESOME_OPTION_PRICE)
  103 + total_should_be = sub_should_be
  104 +
  105 + self.assertEqual(self.cart.subtotal_price, sub_should_be)
  106 + self.assertEqual(self.cart.total_price, total_should_be)
27 shop_simplevariations/tests/simplevariation_tags.py
... ... @@ -0,0 +1,27 @@
  1 +#-*- coding: utf-8 -*-
  2 +"""Tests for templatetags of the shop_simplevariation application."""
  3 +from django.test.testcases import TestCase
  4 +
  5 +from shop.models.productmodel import Product
  6 +
  7 +from ..models import OptionGroup
  8 +from ..templatetags.simplevariation_tags import get_options, get_option_groups
  9 +from .test_utils import create_fixtures
  10 +
  11 +
  12 +class GetOptionGroupsTestCase(TestCase):
  13 + """Tests for the get_option_groups templatetag."""
  14 + def test01_should_return_all_option_groups_for_a_product(self):
  15 + create_fixtures(options=True)
  16 + product = Product.objects.all()[0]
  17 + option_groups = get_option_groups(product)
  18 + self.assertEqual(len(option_groups), 1)
  19 +
  20 +
  21 +class GetOptionsTestCase(TestCase):
  22 + """Tests for the get_options templatetag."""
  23 + def test01_should_return_all_options_for_an_option_group(self):
  24 + create_fixtures(options=True)
  25 + option_group = OptionGroup.objects.all()[0]
  26 + options = get_options(option_group)
  27 + self.assertEqual(len(options), 2)
18 shop_simplevariations/tests/test_utils.py
... ... @@ -0,0 +1,18 @@
  1 +"""Commonly used methods for shop_simplevariation tests."""
  2 +from shop.models.productmodel import Product
  3 +
  4 +from ..models import CartItemOption, Option, OptionGroup
  5 +
  6 +
  7 +def create_fixtures(options=False):
  8 + product = Product( name='product 1', slug='product-1', active=True,
  9 + unit_price=43)
  10 + product.save()
  11 + if not options:
  12 + return
  13 + option_group = OptionGroup(name='option group 1', slug='option-group-1')
  14 + option_group.save()
  15 + option_group.products.add(product)
  16 +
  17 + Option.objects.create(name='option 1', price='42', group=option_group)
  18 + Option.objects.create(name='option 2', price='84', group=option_group)
52 shop_simplevariations/tests/views.py
... ... @@ -0,0 +1,52 @@
  1 +#-*- coding: utf-8 -*-
  2 +"""Tests for view classes of the shop_simplevariation application."""
  3 +from django.core.urlresolvers import reverse
  4 +from django.test.testcases import TestCase
  5 +
  6 +from shop.models.cartmodel import CartItem
  7 +
  8 +from .test_utils import create_fixtures
  9 +
  10 +
  11 +class SimplevariationCartDetailsTestCase(TestCase):
  12 + """Tests for the SimplevariationCartDetails view class."""
  13 +
  14 + def test01_cart_is_callable(self):
  15 + resp = self.client.get(reverse('cart'))
  16 + self.assertEqual(resp.status_code, 200)
  17 +
  18 + def test02_post_adds_new_cart_item(self):
  19 + create_fixtures()
  20 + data = {
  21 + 'add_item_id': '1',
  22 + 'add_item_quantity': '2',
  23 + 'Add to cart': '',
  24 + }
  25 + resp = self.client.post(reverse('cart_item_add'), data=data)
  26 + self.assertEqual(len(CartItem.objects.all()), 1)
  27 +
  28 + def test03_post_adds_different_cart_items_if_different_variations(self):
  29 + create_fixtures(options=True)
  30 + data = {
  31 + 'add_item_id': '1',
  32 + 'add_item_quantity': '2',
  33 + 'Add to cart': '',
  34 + 'add_item_option_group_1': '1',
  35 + }
  36 + resp = self.client.post(reverse('cart_item_add'), data=data)
  37 + data.update({'add_item_option_group_1': '2'})
  38 + resp = self.client.post(reverse('cart_item_add'), data=data)
  39 + self.assertEqual(len(CartItem.objects.all()), 2)
  40 +
  41 + def test04_post_adds_to_same_cart_item_if_same_variations(self):
  42 + create_fixtures(options=True)
  43 + data = {
  44 + 'add_item_id': '1',
  45 + 'add_item_quantity': '2',
  46 + 'Add to cart': '',
  47 + 'add_item_option_group_1': '1',
  48 + }
  49 + resp = self.client.post(reverse('cart_item_add'), data=data)
  50 + resp = self.client.post(reverse('cart_item_add'), data=data)
  51 + self.assertEqual(len(CartItem.objects.all()), 1)
  52 + self.assertEqual(CartItem.objects.all()[0].quantity, 4)
1  shop_simplevariations/views.py
@@ -37,6 +37,7 @@ def post(self, *args, **kwargs):
37 37 if len(cartitemoptions) == len(option_ids):
38 38 found_cartitem_id = cartitem.id
39 39 merge = True
  40 + break
40 41
41 42 #if we found a CartItem object that has the same options, we need
42 43 #to select this one instead of just any CartItem that belongs to this
12 tests/testapp/.coveragerc
... ... @@ -0,0 +1,12 @@
  1 +[run]
  2 +branch = True
  3 +source =
  4 + shop
  5 + shop.addressmodel
  6 +omit =
  7 + ../../*migrations*
  8 + ../../*tests*
  9 + /usr/share/*
  10 +[report]
  11 +precision = 2
  12 +
0  tests/testapp/__init__.py
No changes.
13 tests/testapp/manage.py
... ... @@ -0,0 +1,13 @@
  1 +#!/usr/bin/python
  2 +import os, sys
  3 +from django.core.management import execute_manager
  4 +sys.path.insert(0, os.path.abspath('./../../'))
  5 +try:
  6 + import settings # Assumed to be in the same directory.
  7 +except ImportError:
  8 + import sys
  9 + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
  10 + sys.exit(1)
  11 +
  12 +if __name__ == "__main__":
  13 + execute_manager(settings)
0  tests/testapp/project/__init__.py
No changes.
26 tests/testapp/project/models.py
... ... @@ -0,0 +1,26 @@
  1 +from django.db import models
  2 +
  3 +from shop.models.productmodel import Product
  4 +from shop.util.fields import CurrencyField
  5 +
  6 +
  7 +class BookProduct(Product):
  8 + isbn = models.CharField(max_length=255)
  9 + number_of_pages = models.IntegerField()
  10 +
  11 +
  12 +class CompactDiscProduct(Product):
  13 + number_of_tracks = models.IntegerField()
  14 +
  15 +
  16 +class BaseProduct(models.Model):
  17 + unit_price = CurrencyField()
  18 +
  19 +
  20 +class ProductVariation(Product):
  21 + baseproduct = models.ForeignKey(BaseProduct)
  22 +
  23 + def get_price(self):
  24 + return self.baseproduct.unit_price
  25 +
  26 +
29 tests/testapp/project/templates/project/bookproduct_detail.html
... ... @@ -0,0 +1,29 @@
  1 +<h1>Book Product detail:</h1>
  2 +{{object.name}}<br />
  3 +{{object.slug}}<br />
  4 +{{object.short_description}}<br />
  5 +{{object.long_description}}<br />
  6 +{{object.active}}<br />
  7 +
  8 +{{object.date_added}}<br />
  9 +{{object.last_modified}}<br />
  10 +
  11 +{{object.unit_price}}<br />
  12 +
  13 +{% if object.category %}
  14 +{{object.category.name}}
  15 +{% else %}
  16 +(Product is at root category)
  17 +{% endif %}
  18 +<br />
  19 +
  20 +<h2>Book specifics:</h2><br />
  21 +ISBN: {{object.isbn}}<br />
  22 +Pages: {{object.number_of_pages}}<br />
  23 +
  24 +
  25 +<form method="post" action="{% url cart %}">{% csrf_token %}
  26 +<input type="hidden" name="add_item_id" value="{{object.id}}">
  27 +<input type="hidden" name="add_item_quantity" value="1">
  28 +<input type="submit" value="Add to cart">
  29 +</form>
23 tests/testapp/project/tests.py
... ... @@ -0,0 +1,23 @@
  1 +"""
  2 +This file demonstrates two different styles of tests (one doctest and one
  3 +unittest). These will both pass when you run "manage.py test".
  4 +
  5 +Replace these with more appropriate tests for your application.
  6 +"""
  7 +
  8 +from django.test import TestCase
  9 +
  10 +class SimpleTest(TestCase):
  11 + def test_basic_addition(self):
  12 + """
  13 + Tests that 1 + 1 always equals 2.
  14 + """
  15 + self.failUnlessEqual(1 + 1, 2)
  16 +
  17 +__test__ = {"doctest": """
  18 +Another way to test that 1 + 1 is equal to 2.
  19 +
  20 +>>> 1 + 1 == 2
  21 +True
  22 +"""}
  23 +
1  tests/testapp/project/views.py
... ... @@ -0,0 +1 @@
  1 +# Create your views here.
113 tests/testapp/settings.py
... ... @@ -0,0 +1,113 @@
  1 +# Django settings for example project.
  2 +
  3 +
  4 +DEBUG = True
  5 +TEMPLATE_DEBUG = DEBUG
  6 +
  7 +ADMINS = (
  8 + ('Christopher Glass', 'tribaal@gmail.com'),
  9 +)
  10 +
  11 +MANAGERS = ADMINS
  12 +
  13 +DATABASES = {
  14 + 'default': {
  15 + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  16 + 'NAME': 'test.sqlite', # Or path to database file if using sqlite3.
  17 + 'USER': '', # Not used with sqlite3.
  18 + 'PASSWORD': '', # Not used with sqlite3.
  19 + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
  20 + 'PORT': '', # Set to empty string for default. Not used with sqlite3.
  21 + }
  22 +}
  23 +
  24 +# Local time zone for this installation. Choices can be found here:
  25 +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  26 +# although not all choices may be available on all operating systems.
  27 +# On Unix systems, a value of None will cause Django to use the same
  28 +# timezone as the operating system.
  29 +# If running in a Windows environment this must be set to the same as your
  30 +# system time zone.
  31 +TIME_ZONE = 'Europe/Zurich'
  32 +
  33 +# Language code for this installation. All choices can be found here:
  34 +# http://www.i18nguy.com/unicode/language-identifiers.html
  35 +LANGUAGE_CODE = 'en-us'
  36 +
  37 +SITE_ID = 1
  38 +
  39 +# If you set this to False, Django will make some optimizations so as not
  40 +# to load the internationalization machinery.
  41 +USE_I18N = True
  42 +
  43 +# If you set this to False, Django will not format dates, numbers and
  44 +# calendars according to the current locale
  45 +USE_L10N = True
  46 +
  47 +# Absolute path to the directory that holds media.
  48 +# Example: "/home/media/media.lawrence.com/"
  49 +MEDIA_ROOT = ''
  50 +
  51 +# URL that handles the media served from MEDIA_ROOT. Make sure to use a
  52 +# trailing slash if there is a path component (optional in other cases).
  53 +# Examples: "http://media.lawrence.com", "http://example.com/media/"
  54 +MEDIA_URL = ''
  55 +
  56 +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
  57 +# trailing slash.
  58 +# Examples: "http://foo.com/media/", "/media/".
  59 +ADMIN_MEDIA_PREFIX = '/media/'
  60 +
  61 +# Make this unique, and don't share it with anybody.
  62 +SECRET_KEY = 'h2%uf!luks79rw^4!5%q#v2znc87g_)@^jf1og!04@&&tsf7*9'
  63 +
  64 +# List of callables that know how to import templates from various sources.
  65 +TEMPLATE_LOADERS = (
  66 + 'django.template.loaders.filesystem.Loader',
  67 + 'django.template.loaders.app_directories.Loader',
  68 +# 'django.template.loaders.eggs.Loader',
  69 +)
  70 +
  71 +MIDDLEWARE_CLASSES = [
  72 + 'django.middleware.common.CommonMiddleware',
  73 + 'django.contrib.sessions.middleware.SessionMiddleware',
  74 + 'django.middleware.csrf.CsrfViewMiddleware',
  75 + 'django.contrib.auth.middleware.AuthenticationMiddleware',
  76 + 'django.contrib.messages.middleware.MessageMiddleware',
  77 +]
  78 +
  79 +import django
  80 +if django.VERSION[0] < 1 or django.VERSION[1] <3:
  81 + MIDDLEWARE_CLASSES.append('cbv.middleware.DeferredRenderingMiddleware')
  82 +
  83 +ROOT_URLCONF = 'testapp.urls'
  84 +
  85 +TEMPLATE_DIRS = (
  86 + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  87 + # Always use forward slashes, even on Windows.
  88 + # Don't forget to use absolute paths, not relative paths.
  89 +)
  90 +
  91 +INSTALLED_APPS = (
  92 + 'django.contrib.auth',
  93 + 'django.contrib.contenttypes',
  94 + 'django.contrib.sessions',
  95 + 'django.contrib.sites',
  96 + 'django.contrib.messages',
  97 + # Uncomment the next line to enable the admin:
  98 + 'django.contrib.admin',
  99 + # Uncomment the next line to enable admin documentation:
  100 + 'django.contrib.admindocs',
  101 + 'polymorphic', # We need polymorphic installed for the shop
  102 + 'shop', # The django SHOP application
  103 + 'shop.addressmodel',
  104 + 'shop_simplevariations',
  105 + 'project', # the test project application
  106 +)
  107 +
  108 +# The shop settings:
  109 +SHOP_CART_MODIFIERS= ['shop.cart.modifiers.rebate_modifiers.BulkRebateModifier']
  110 +SHOP_SHIPPING_BACKENDS=['shop.shipping.backends.flat_rate.FlatRateShipping']
  111 +
  112 +# Shop module settings
  113 +SHOP_SHIPPING_FLAT_RATE = '10' # That's just for the flat rate shipping backend
19 tests/testapp/urls.py
... ... @@ -0,0 +1,19 @@
  1 +from django.conf.urls.defaults import *
  2 +
  3 +# Uncomment the next two lines to enable the admin:
  4 +from django.contrib import admin
  5 +admin.autodiscover()
  6 +
  7 +from shop_simplevariations import urls as simplevariations_urls
  8 +
  9 +
  10 +urlpatterns = patterns('',
  11 + # Example:
  12 + #(r'^example/', include('example.foo.urls')),
  13 + # Uncomment the admin/doc line below to enable admin documentation:
  14 + (r'^admin/doc/', include('django.contrib.admindocs.urls')),
  15 + # Uncomment the next line to enable the admin:
  16 + (r'^admin/', include(admin.site.urls)),
  17 + (r'^shop/cart/', include(simplevariations_urls)),
  18 + (r'^shop/', include('shop.urls')),
  19 +)

0 comments on commit 9dfb098

Please sign in to comment.
Something went wrong with that request. Please try again.