kopia lustrzana https://github.com/longclawshop/longclaw
Longclaw 1.0 (#205)
* Compatibility with Wagtail 2 and Django 2 * Fixes #154 Wagtail 2 compatibility: * Fixes references to Wagtail packages which use the `wagtail.wagtail*` naming scheme. Wagtail 2 removes the redundancy. * Wraps imports in `try`/`except` blocks to maintain compatibility with Wagtail 1. Django 2 comaptibility: Included because Wagtail 2 adds support for Django 2. * Adds `on_delete` to all `ForeignKey` model fields, which is now required by Django 2. * Updates for wagtail 2 * rename modules * Longclaw v2: Rename and new migrations * Longclaw 2: Reduce fails to 2 errors * Longclaw v2: All tests passing * Update travisconf * Travis: Enable py37 * Update project template for v2 * longclawv2: update project template * Fix migrations for longclaw 2 * Corrections in project template for longclaw1.0 * Correct location of templates and update docs * Automatically load shipping countries * Add loadcountries command * Add info on loading country datapull/207/head
rodzic
3ffae36fd5
commit
8ff51b9274
|
@ -3,13 +3,13 @@ max-line-length: 160
|
|||
uses:
|
||||
- django
|
||||
ignore-paths:
|
||||
- longclaw/longclawbasket/migrations
|
||||
- longclaw/longclawcheckout/migrations
|
||||
- longclaw/longclawcore/migrations
|
||||
- longclaw/longclaworders/migrations
|
||||
- longclaw/longclawproducts/migrations
|
||||
- longclaw/longclawsettings/migrations
|
||||
- longclaw/longclawshipping/migrations
|
||||
- longclaw/basket/migrations
|
||||
- longclaw/checkout/migrations
|
||||
- longclaw/core/migrations
|
||||
- longclaw/orders/migrations
|
||||
- longclaw/products/migrations
|
||||
- longclaw/settings/migrations
|
||||
- longclaw/shipping/migrations
|
||||
python-targets:
|
||||
- 2
|
||||
- 3
|
||||
|
|
12
.travis.yml
12
.travis.yml
|
@ -5,18 +5,20 @@ cache: pip
|
|||
|
||||
matrix:
|
||||
include:
|
||||
- env: TOX_ENV=py34-django-111
|
||||
python: 3.4
|
||||
- env: TOX_ENV=py35-django-111
|
||||
- env: TOX_ENV=py35-django-213
|
||||
python: 3.5
|
||||
- env: TOX_ENV=py36-django-111
|
||||
- env: TOX_ENV=py36-django-213
|
||||
python: 3.6
|
||||
- env: TOX_ENV=py37-django-213
|
||||
python: 3.7
|
||||
dist: xenial
|
||||
sudo: true
|
||||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
||||
install:
|
||||
- . $HOME/.nvm/nvm.sh
|
||||
- nvm install stable
|
||||
- nvm use stable
|
||||
- pip install -r requirements_test.txt
|
||||
- pip install -r requirements_dev.txt
|
||||
- cd longclaw/client && npm install
|
||||
|
||||
# command to run tests using coverage, e.g. python setup.py test
|
||||
|
|
|
@ -6,7 +6,7 @@ History
|
|||
1.0.0 (In development)
|
||||
+++++++++++++++++++++++
|
||||
|
||||
* Reworked the longclawproducts app to make customisation easier (#76 and #47)
|
||||
* Reworked the products app to make customisation easier (#76 and #47)
|
||||
|
||||
|
||||
0.2.0 (2017-07)
|
||||
|
|
|
@ -60,7 +60,7 @@ Before you submit a pull request, check that it meets these guidelines:
|
|||
1. If the pull request adds functionality, the docs should be updated. Put
|
||||
your new functionality into a function with a docstring, and add the
|
||||
feature to the list in README.rst.
|
||||
3. The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5. Check
|
||||
3. The pull request should work for Python 3.5 and above. Check
|
||||
https://travis-ci.org/JamesRamm/longclaw/pull_requests
|
||||
and make sure that the tests pass for all supported Python versions.
|
||||
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,7 +1,7 @@
|
|||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017, James Ramm
|
||||
Copyright (c) 2018, James Ramm
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ Each ``BasketItem`` has a ``basket_id`` allowing items to be grouped together in
|
|||
Fetching the basket
|
||||
-------------------
|
||||
|
||||
The function ``longclaw.longclawbasket.utils.get_basket_items`` will return all ``BasketItem`` for the current
|
||||
session. This accepts a django ``request`` object and uses ``longclaw.longclawbasket.utils.basket_id`` to
|
||||
The function ``longclaw.basket.utils.get_basket_items`` will return all ``BasketItem`` for the current
|
||||
session. This accepts a django ``request`` object and uses ``longclaw.basket.utils.basket_id`` to
|
||||
fetch the underlying ``basket_id`` on which to filter the ``BasketItem`` objects.
|
||||
|
||||
On the front end, you can use the API endpoint ``<api_prefix>/basket/`` or the django view ``basket/``. You should
|
||||
|
@ -73,7 +73,7 @@ Other API endpoints:
|
|||
``<api_prefix>/basket/count/``
|
||||
get total number of items in the basket
|
||||
|
||||
All basket items can be deleted using the ``longclaw.longclawbasket.utils.destroy_basket`` function.
|
||||
All basket items can be deleted using the ``longclaw.basket.utils.destroy_basket`` function.
|
||||
When an order is successfully placed, the basket will be automatically destroyed.
|
||||
|
||||
.. note:: Longclaw does not automatically clean up abandoned baskets. This can occur when a session ends
|
||||
|
|
|
@ -7,8 +7,8 @@ Longclaw provides a simple, single checkout view.
|
|||
The URL for the checkout is ``'checkout/'``.
|
||||
After a successful checkout, it is redirected to ``checkout/success/``.
|
||||
|
||||
To implement the checkout, simply provide ``'longclawcheckout/checkout.html'`` and
|
||||
``'longclawcheckout/success.html'`` templates. (Empty templates will have been created if
|
||||
To implement the checkout, simply provide ``'checkout/checkout.html'`` and
|
||||
``'checkout/success.html'`` templates. (Empty templates will have been created if
|
||||
you ran the longclaw CLI to start your project)
|
||||
|
||||
There are three forms provided in the checkout view:
|
||||
|
|
|
@ -132,13 +132,13 @@ Python example:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from longclaw.longclawshipping import utils
|
||||
from longclaw.longclawsettings.models import LongclawSettings
|
||||
from longclaw.shipping import utils
|
||||
from longclaw.configuration.models import Configuration
|
||||
|
||||
country_code = "GB" # ISO 2-letter country code for a configured shipping rate
|
||||
option = "standard" # Name of shipping rate configured through longclaw admin (only used if more than one shipping rate exists for the given country)
|
||||
|
||||
settings = LongclawSettings.for_site(request.site)
|
||||
settings = Configuration.for_site(request.site)
|
||||
|
||||
try:
|
||||
data = utils.get_shipping_cost(country_code, option, settings)
|
||||
|
|
|
@ -9,10 +9,10 @@ To select the payment gateway to use, you must specify the ``PAYMENT_GATEWAY`` a
|
|||
|
||||
The options are:
|
||||
|
||||
- ``longclaw.longclawcheckout.gateways.base.BasePayment``. A do-nothing base implementation
|
||||
- ``longclaw.longclawcheckout.gateways.stripe.StripePayment``. Capture payments using Stripe.
|
||||
- ``longclaw.longclawcheckout.gateways.braintree.BraintreePayment``. Capture payments using Braintree.
|
||||
- ``longclaw.longclawcheckout.gateways.braintree.PaypalVZeroPayment``. Capture Paypal payments using the braintree v.zero SDK.
|
||||
- ``longclaw.checkout.gateways.base.BasePayment``. A do-nothing base implementation
|
||||
- ``longclaw.checkout.gateways.stripe.StripePayment``. Capture payments using Stripe.
|
||||
- ``longclaw.checkout.gateways.braintree.BraintreePayment``. Capture payments using Braintree.
|
||||
- ``longclaw.checkout.gateways.braintree.PaypalVZeroPayment``. Capture Paypal payments using the braintree v.zero SDK.
|
||||
|
||||
|
||||
Additional Settings and dependencies
|
||||
|
@ -43,10 +43,10 @@ Custom Integrations
|
|||
|
||||
To implement your own payment integration, you must implement the payment gateway interface. This is simple:
|
||||
|
||||
- Inherit from ``longclaw.longclawcheckout.gateways.base.BasePayment``
|
||||
- Inherit from ``longclaw.checkout.gateways.base.BasePayment``
|
||||
- Implement ``create_payment``. This should take a ``request`` object, an ``amount`` and optionally a ``description``.
|
||||
It should use these to capture the payment using your chosen provider. For examples see the implementations in
|
||||
``longclaw.longclawcheckout.gateways``
|
||||
``longclaw.checkout.gateways``
|
||||
- Implement the ``get_token`` method. This method should generate tokens used by the payment provider. It accepts a ``request``
|
||||
object containing post data (``request.data``). Tokens returned may represent different things depending on the
|
||||
payment provider - e.g. it may be used to tokenize payment details or generate authentication tokens.
|
||||
|
|
|
@ -26,7 +26,7 @@ Writing the templates
|
|||
|
||||
Since ``ProductIndex`` and ``Product`` are Wagtail pages, HTML templates should be created for each.
|
||||
The developer should refer to the `Wagtail documentation <http://docs.wagtail.io/en/v1.8.1/topics/writing_templates.html>`_ for further details.
|
||||
Basic example templates are provided in ``your_project/templates/longclawproducts/`` when creating a project
|
||||
Basic example templates are provided in ``your_project/templates/products/`` when creating a project
|
||||
with the longclaw project template.
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Displaying the Basket
|
|||
|
||||
Longclaw provides a REST API endpoint for retrieving basket data and a django view.
|
||||
|
||||
To use the django view, we must provide a template titled ``longclawbasket/basket.html``.
|
||||
To use the django view, we must provide a template titled ``basket/basket.html``.
|
||||
It is common to provide a link to the basket page in the header. We can use the ``url`` tag in
|
||||
our site header to provide the link::
|
||||
|
||||
|
@ -17,4 +17,4 @@ In the basket template, we have access to all basket items under the ``basket``
|
|||
...
|
||||
{% endfor %}
|
||||
|
||||
For the full implementation of the basket template, take a look at the `longclaw demo repository <https://github.com/JamesRamm/longclaw_demo/blob/master/longclaw_demo/templates/longclawbasket/basket.html>`_
|
||||
For the full implementation of the basket template, take a look at the `longclaw demo repository <https://github.com/JamesRamm/longclaw_demo/blob/master/longclaw_demo/templates/basket/basket.html>`_
|
||||
|
|
|
@ -13,7 +13,7 @@ The payment gateway to use must be set in the settings file:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
PAYMENT_GATEWAY = 'longclaw.longclawcheckout.gateways.braintree.BraintreePayment'
|
||||
PAYMENT_GATEWAY = 'longclaw.checkout.gateways.braintree.BraintreePayment'
|
||||
|
||||
|
||||
We also need to define settings for access tokens;
|
||||
|
|
|
@ -53,7 +53,7 @@ The ``products`` folder contains a skeleton model for our product `variants` whi
|
|||
Before proceeding, we need to setup our ``settings`` file, in ``my_shop/settings/base.py``.
|
||||
|
||||
We need to configure which payment gateway we are using. Change the entry for ``PAYMENT_GATEWAY`` from
|
||||
``'longclaw.longclawcheckout.gateways.BasePayment'`` to ``'longclaw.longclawcheckout.gateways.braintree.BraintreePayment'``
|
||||
``'longclaw.checkout.gateways.BasePayment'`` to ``'longclaw.checkout.gateways.braintree.BraintreePayment'``
|
||||
|
||||
We also need to set the access tokens for the braintree backend. Add the following settings:
|
||||
|
||||
|
@ -70,5 +70,8 @@ you have set environment variables on your OS with the access tokens.
|
|||
.. note: Don't forget that Longclaw is a Wagtail project. You may need to configure additional settings
|
||||
for wagtail.
|
||||
|
||||
.. note: If you have a problem with the initial migration (`python manage.py migrate`) relating to `InvalidBasesError`, try commenting out all longclaw apps
|
||||
(and your shop apps, `home`, `search` and the project name app), plus the `ROOT_URLCONF` line and run the migrations again. Next, add back the apps and `ROOT_URLCONF` and
|
||||
run the migrations one more time. If you encounter problems at runtime, such as `OperationalError: no such table`, try running `migrate` again with the `--run-syncdb` option.
|
||||
|
||||
Great! Now we are setup, we can start :ref:`adding products <tutorial_products>`
|
|
@ -8,7 +8,7 @@ requirements of different shops can be wide and varied.
|
|||
|
||||
It is required that you create a ``ProductVariant`` model (it can be called anything) and implement
|
||||
a small number of fields Longclaw expects.
|
||||
The easiest way to do this is by inheriting from ``longclaw.longclawproducts.ProductVariantBase``.
|
||||
The easiest way to do this is by inheriting from ``longclaw.products.ProductVariantBase``.
|
||||
Longclaws' project template will have setup a ``products`` app for you, with a ``ProductVariant`` model.
|
||||
|
||||
You will also notice that the settings file has ``PRODUCT_VARIANT_MODEL`` set to the ``ProductVariant`` model.
|
||||
|
@ -97,8 +97,8 @@ The Wagtail documentation already comprehensively covers `writing templates <htt
|
|||
|
||||
Our template project already has some basic templates for ``ProductIndex`` and ``Product``:
|
||||
|
||||
- ``my_shop/my_shop/templates/longclawproducts/product_index.html``
|
||||
- ``my_shop/my_shop/templates/longclawproducts/product.html``
|
||||
- ``my_shop/my_shop/templates/products/product_index.html``
|
||||
- ``my_shop/my_shop/templates/products/product.html``
|
||||
|
||||
They contain just enough information to demonstrate how to traverse the products and their fields.
|
||||
For a more complete template, take a look at the `demo project <https://github.com/JamesRamm/longclaw_demo>`_.
|
||||
|
@ -107,11 +107,11 @@ Adding Products to the Basket
|
|||
-----------------------------
|
||||
|
||||
Longclaw offers a helpful template tag to create an ``Add To Basket`` button for your products.
|
||||
In your template, load the longclawbasket tags::
|
||||
In your template, load the basket tags::
|
||||
|
||||
.. code-block:: django
|
||||
|
||||
{% load longclawbasket_tags %}
|
||||
{% load basket_tags %}
|
||||
|
||||
You can now use the tag to render a button for each product variant:
|
||||
|
||||
|
|
|
@ -11,6 +11,13 @@ Per Country Rates
|
|||
------------------
|
||||
|
||||
Shipping rates are set on a per-country basis via the ``Shipping`` page in the wagtail admin.
|
||||
Initially, no countries will be available - Longclaw comes with a set of country data which can be loaded into the database
|
||||
using the ``loadcountries`` command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python manage.py loadcountries
|
||||
|
||||
|
||||
In the image below, we set a standard rate for the UK. It is possible to select multiple countries
|
||||
for a rate to apply to. We can also create more than one shipping rate for the same country.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from rest_framework.decorators import detail_route, list_route
|
||||
from rest_framework import permissions, status, viewsets
|
||||
from rest_framework.response import Response
|
||||
from longclaw.longclawbasket.models import BasketItem
|
||||
from longclaw.longclawbasket.serializers import BasketItemSerializer
|
||||
from longclaw.longclawbasket import utils
|
||||
from longclaw.basket.models import BasketItem
|
||||
from longclaw.basket.serializers import BasketItemSerializer
|
||||
from longclaw.basket import utils
|
||||
from longclaw.utils import ProductVariant
|
||||
|
||||
class BasketViewSet(viewsets.ModelViewSet):
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class basketConfig(AppConfig):
|
||||
name = 'basket'
|
|
@ -1,6 +1,6 @@
|
|||
import datetime
|
||||
from django.core.management import BaseCommand
|
||||
from longclaw.longclawbasket.models import BasketItem
|
||||
from longclaw.basket.models import BasketItem
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""Remove old BasketItems.
|
|
@ -1,10 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-06 09:49
|
||||
from __future__ import unicode_literals
|
||||
# Generated by Django 2.1.4 on 2018-12-22 14:47
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.conf import settings
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -12,9 +10,7 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('longclawproducts', '0001_initial'),
|
||||
(settings.PRODUCT_VARIANT_MODEL.split(".")[0], '0001_initial')
|
||||
|
||||
(settings.PRODUCT_VARIANT_MODEL.split(".")[0], '__first__'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
@ -25,7 +21,7 @@ class Migration(migrations.Migration):
|
|||
('basket_id', models.CharField(max_length=32)),
|
||||
('date_added', models.DateTimeField(auto_now_add=True)),
|
||||
('quantity', models.IntegerField(default=1)),
|
||||
('variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.PRODUCT_VARIANT_MODEL)),
|
||||
('variant', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.PRODUCT_VARIANT_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['date_added'],
|
|
@ -1,14 +1,11 @@
|
|||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from longclaw.settings import PRODUCT_VARIANT_MODEL
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class BasketItem(models.Model):
|
||||
basket_id = models.CharField(max_length=32)
|
||||
date_added = models.DateTimeField(auto_now_add=True)
|
||||
quantity = models.IntegerField(default=1)
|
||||
variant = models.ForeignKey(PRODUCT_VARIANT_MODEL, unique=False)
|
||||
variant = models.ForeignKey(PRODUCT_VARIANT_MODEL, unique=False, on_delete=models.PROTECT)
|
||||
|
||||
class Meta:
|
||||
ordering = ['date_added']
|
|
@ -1,7 +1,7 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from longclaw.longclawproducts.serializers import ProductVariantSerializer
|
||||
from longclaw.longclawbasket.models import BasketItem
|
||||
from longclaw.products.serializers import ProductVariantSerializer
|
||||
from longclaw.basket.models import BasketItem
|
||||
|
||||
class BasketItemSerializer(serializers.ModelSerializer):
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from django import template
|
||||
from longclaw.longclawbasket.utils import get_basket_items
|
||||
from longclaw.basket.utils import get_basket_items
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
@ -12,7 +12,7 @@ def basket(context):
|
|||
return items
|
||||
|
||||
|
||||
@register.inclusion_tag('longclawbasket/add_to_basket.html')
|
||||
@register.inclusion_tag('basket/add_to_basket.html')
|
||||
def add_to_basket_btn(variant_id, btn_class="btn btn-default", btn_text="Add To Basket"):
|
||||
"""Button to add an item to the basket
|
||||
"""
|
|
@ -8,9 +8,9 @@ from django.core.management import call_command
|
|||
from django.utils.six import StringIO
|
||||
|
||||
from longclaw.tests.utils import LongclawTestCase, BasketItemFactory, ProductVariantFactory
|
||||
from longclaw.longclawbasket.utils import basket_id
|
||||
from longclaw.longclawbasket.templatetags import longclawbasket_tags
|
||||
from longclaw.longclawbasket.context_processors import stripe_key
|
||||
from longclaw.basket.utils import basket_id
|
||||
from longclaw.basket.templatetags import basket_tags
|
||||
from longclaw.basket.context_processors import stripe_key
|
||||
|
||||
|
||||
class CommandTests(TestCase):
|
||||
|
@ -76,7 +76,7 @@ class BasketTest(LongclawTestCase):
|
|||
def test_add_to_cart_btn(self):
|
||||
"""Test the add to cart tag responds
|
||||
"""
|
||||
result = longclawbasket_tags.add_to_basket_btn(1)
|
||||
result = basket_tags.add_to_basket_btn(1)
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
def test_ctx_proc(self):
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from longclaw.longclawbasket import api
|
||||
from longclaw.longclawbasket import views
|
||||
from longclaw.basket import api
|
||||
from longclaw.basket import views
|
||||
from longclaw.settings import API_URL_PREFIX
|
||||
|
||||
basket_list = api.BasketViewSet.as_view({
|
|
@ -1,5 +1,5 @@
|
|||
import random
|
||||
from longclaw.longclawbasket.models import BasketItem
|
||||
from longclaw.basket.models import BasketItem
|
||||
|
||||
BASKET_ID_SESSION_KEY = 'basket_id'
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
from django.views.generic import ListView
|
||||
from longclaw.longclawbasket.models import BasketItem
|
||||
from longclaw.longclawbasket import utils
|
||||
from longclaw.basket.models import BasketItem
|
||||
from longclaw.basket import utils
|
||||
|
||||
class BasketView(ListView):
|
||||
model = BasketItem
|
||||
template_name = "longclawbasket/basket.html"
|
||||
template_name = "basket/basket.html"
|
||||
def get_context_data(self, **kwargs):
|
||||
items, _ = utils.get_basket_items(self.request)
|
||||
total_price = sum(item.total() for item in items)
|
|
@ -1,4 +1,3 @@
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import subprocess
|
||||
import argparse
|
||||
import sys
|
||||
|
@ -29,7 +28,7 @@ def create_project(args):
|
|||
'django-admin.py',
|
||||
'startproject',
|
||||
'--template={}'.format(template_path),
|
||||
'--ext=html,css,js,py,txt',
|
||||
'--extension=html,css,js,py,txt',
|
||||
args.project_name
|
||||
))
|
||||
utility.execute()
|
||||
|
|
|
@ -6,9 +6,9 @@ from django.db import transaction
|
|||
from rest_framework.decorators import api_view, permission_classes
|
||||
from rest_framework import permissions, status
|
||||
from rest_framework.response import Response
|
||||
from longclaw.longclawbasket.utils import destroy_basket
|
||||
from longclaw.longclawcheckout.utils import create_order, GATEWAY
|
||||
from longclaw.longclawcheckout.errors import PaymentError
|
||||
from longclaw.basket.utils import destroy_basket
|
||||
from longclaw.checkout.utils import create_order, GATEWAY
|
||||
from longclaw.checkout.errors import PaymentError
|
||||
|
||||
@api_view(['GET'])
|
||||
@permission_classes([permissions.AllowAny])
|
|
@ -2,4 +2,4 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class LongclawCheckoutConfig(AppConfig):
|
||||
name = 'longclawcheckout'
|
||||
name = 'checkout'
|
|
@ -1,4 +1,4 @@
|
|||
"""
|
||||
Gateways module to hold payment processor backend logic
|
||||
"""
|
||||
from longclaw.longclawcheckout.gateways.base import BasePayment
|
||||
from longclaw.checkout.gateways.base import BasePayment
|
|
@ -1,4 +1,4 @@
|
|||
from longclaw.longclawcheckout.errors import PaymentError
|
||||
from longclaw.checkout.errors import PaymentError
|
||||
|
||||
class BasePayment(object):
|
||||
"""
|
|
@ -1,8 +1,8 @@
|
|||
import braintree
|
||||
from longclaw import settings
|
||||
from longclaw.longclawsettings.models import LongclawSettings
|
||||
from longclaw.longclawcheckout.errors import PaymentError
|
||||
from longclaw.longclawcheckout.gateways import BasePayment
|
||||
from longclaw.configuration.models import Configuration
|
||||
from longclaw.checkout.errors import PaymentError
|
||||
from longclaw.checkout.gateways import BasePayment
|
||||
|
||||
class BraintreePayment(BasePayment):
|
||||
"""
|
||||
|
@ -55,12 +55,12 @@ class PaypalVZeroPayment(BasePayment):
|
|||
self.gateway = braintree.BraintreeGateway(access_token=settings.VZERO_ACCESS_TOKEN)
|
||||
|
||||
def create_payment(self, request, amount, description=''):
|
||||
longclaw_settings = LongclawSettings.for_site(request.site)
|
||||
config = Configuration.for_site(request.site)
|
||||
nonce = request.POST.get('payment_method_nonce')
|
||||
result = self.gateway.transaction.sale({
|
||||
"amount": str(amount),
|
||||
"payment_method_nonce": nonce,
|
||||
"merchant_account_id": longclaw_settings.currency,
|
||||
"merchant_account_id": config.currency,
|
||||
"options": {
|
||||
"paypal": {
|
||||
"description": description
|
|
@ -1,9 +1,9 @@
|
|||
import math
|
||||
import stripe
|
||||
from longclaw.settings import STRIPE_SECRET
|
||||
from longclaw.longclawsettings.models import LongclawSettings
|
||||
from longclaw.longclawcheckout.errors import PaymentError
|
||||
from longclaw.longclawcheckout.gateways import BasePayment
|
||||
from longclaw.configuration.models import Configuration
|
||||
from longclaw.checkout.errors import PaymentError
|
||||
from longclaw.checkout.gateways import BasePayment
|
||||
|
||||
|
||||
class StripePayment(BasePayment):
|
||||
|
@ -15,7 +15,7 @@ class StripePayment(BasePayment):
|
|||
|
||||
def create_payment(self, request, amount, description=''):
|
||||
try:
|
||||
currency = LongclawSettings.for_site(request.site).currency
|
||||
currency = Configuration.for_site(request.site).currency
|
||||
charge = stripe.Charge.create(
|
||||
amount=int(math.ceil(amount * 100)), # Amount in pence
|
||||
currency=currency.lower(),
|
|
@ -0,0 +1,12 @@
|
|||
# Generated by Django 2.1.4 on 2018-12-22 14:48
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
|
@ -1,5 +1,5 @@
|
|||
from django import template
|
||||
from longclaw.longclawcheckout.utils import GATEWAY
|
||||
from longclaw.checkout.utils import GATEWAY
|
||||
|
||||
register = template.Library()
|
||||
|
|
@ -12,11 +12,11 @@ from longclaw.tests.utils import (
|
|||
CountryFactory,
|
||||
OrderFactory
|
||||
)
|
||||
from longclaw.longclawcheckout.utils import create_order
|
||||
from longclaw.longclawcheckout.forms import CheckoutForm
|
||||
from longclaw.longclawcheckout.views import CheckoutView
|
||||
from longclaw.longclawcheckout.templatetags import longclawcheckout_tags as tags
|
||||
from longclaw.longclawbasket.utils import basket_id
|
||||
from longclaw.checkout.utils import create_order
|
||||
from longclaw.checkout.forms import CheckoutForm
|
||||
from longclaw.checkout.views import CheckoutView
|
||||
from longclaw.checkout.templatetags import longclawcheckout_tags as tags
|
||||
from longclaw.basket.utils import basket_id
|
||||
|
||||
|
||||
class CheckoutApiTest(LongclawTestCase):
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from longclaw.longclawcheckout import api, views
|
||||
from longclaw.checkout import api, views
|
||||
from longclaw.settings import API_URL_PREFIX
|
||||
|
||||
urlpatterns = [
|
|
@ -3,12 +3,12 @@ from django.utils.module_loading import import_string
|
|||
from django.utils import timezone
|
||||
from ipware.ip import get_real_ip
|
||||
|
||||
from longclaw.longclawbasket.utils import get_basket_items, destroy_basket
|
||||
from longclaw.longclawshipping.utils import get_shipping_cost
|
||||
from longclaw.longclawcheckout.errors import PaymentError
|
||||
from longclaw.longclaworders.models import Order, OrderItem
|
||||
from longclaw.longclawshipping.models import Address
|
||||
from longclaw.longclawsettings.models import LongclawSettings
|
||||
from longclaw.basket.utils import get_basket_items, destroy_basket
|
||||
from longclaw.shipping.utils import get_shipping_cost
|
||||
from longclaw.checkout.errors import PaymentError
|
||||
from longclaw.orders.models import Order, OrderItem
|
||||
from longclaw.shipping.models import Address
|
||||
from longclaw.configuration.models import Configuration
|
||||
from longclaw.utils import GATEWAY
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ def create_order(email,
|
|||
|
||||
ip_address = get_real_ip(request)
|
||||
if shipping_country and shipping_option:
|
||||
site_settings = LongclawSettings.for_site(request.site)
|
||||
site_settings = Configuration.for_site(request.site)
|
||||
shipping_rate = get_shipping_cost(
|
||||
site_settings,
|
||||
shipping_address.country.pk,
|
|
@ -8,21 +8,21 @@ try:
|
|||
except ImportError:
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from longclaw.longclawshipping.forms import AddressForm
|
||||
from longclaw.longclawcheckout.forms import CheckoutForm
|
||||
from longclaw.longclawcheckout.utils import create_order
|
||||
from longclaw.longclawbasket.utils import get_basket_items
|
||||
from longclaw.longclaworders.models import Order
|
||||
from longclaw.shipping.forms import AddressForm
|
||||
from longclaw.checkout.forms import CheckoutForm
|
||||
from longclaw.checkout.utils import create_order
|
||||
from longclaw.basket.utils import get_basket_items
|
||||
from longclaw.orders.models import Order
|
||||
|
||||
|
||||
@require_GET
|
||||
def checkout_success(request, pk):
|
||||
order = get_object_or_404(Order, id=pk)
|
||||
return render(request, "longclawcheckout/success.html", {'order': order})
|
||||
return render(request, "checkout/success.html", {'order': order})
|
||||
|
||||
|
||||
class CheckoutView(TemplateView):
|
||||
template_name = "longclawcheckout/checkout.html"
|
||||
template_name = "checkout/checkout.html"
|
||||
checkout_form = CheckoutForm
|
||||
shipping_address_form = AddressForm
|
||||
billing_address_form = AddressForm
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
]
|
||||
},
|
||||
output: {
|
||||
path: path.resolve('../longclawcore/static/longclawcore/js/'),
|
||||
path: path.resolve('../core/static/core/js/'),
|
||||
filename: "[name].bundle.js"
|
||||
},
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
]
|
||||
},
|
||||
output: {
|
||||
path: path.resolve('../longclawcore/static/longclawcore/js/'),
|
||||
path: path.resolve('../core/static/core/js/'),
|
||||
filename: "[name].bundle.js"
|
||||
},
|
||||
|
||||
|
|
|
@ -2,5 +2,5 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class LongclawSettingsConfig(AppConfig):
|
||||
name = 'longclawsettings'
|
||||
verbose_name = 'Longclaw Settings'
|
||||
name = 'configuration'
|
||||
verbose_name = 'Longclaw Configuration'
|
|
@ -0,0 +1,8 @@
|
|||
from longclaw.configuration.models import Configuration
|
||||
|
||||
def currency(request):
|
||||
config = Configuration.for_site(request.site)
|
||||
return {
|
||||
'currency_html_code': config.currency_html_code,
|
||||
'currency': config.currency
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-12 14:22
|
||||
from __future__ import unicode_literals
|
||||
# Generated by Django 2.1.4 on 2018-12-22 14:48
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
@ -11,17 +9,19 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('wagtailcore', '0030_index_on_pagerevision_created_at'),
|
||||
('wagtailcore', '0041_group_collection_permissions_verbose_name_plural'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='LongclawSettings',
|
||||
name='Configuration',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('default_shipping_rate', models.DecimalField(decimal_places=2, help_text='The default shipping rate for countries which have not been configured', max_digits=12)),
|
||||
('default_shipping_carrier', models.CharField(help_text='The default shipping carrier', max_length=32)),
|
||||
('default_shipping_rate', models.DecimalField(decimal_places=2, default=3.95, help_text='The default shipping rate for countries which have not been configured', max_digits=12)),
|
||||
('default_shipping_carrier', models.CharField(default='Royal Mail', help_text='The default shipping carrier', max_length=32)),
|
||||
('default_shipping_enabled', models.BooleanField(default=False, help_text='Whether to enable default shipping. This essentially means you ship to all countries, not only those with configured shipping rates')),
|
||||
('currency_html_code', models.CharField(default='£', help_text='The HTML code for the currency symbol. Used for display purposes only', max_length=12)),
|
||||
('currency', models.CharField(default='GBP', help_text='The iso currency code to use for payments', max_length=6)),
|
||||
('site', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Site')),
|
||||
],
|
||||
options={
|
|
@ -2,12 +2,12 @@
|
|||
Admin confiurable settings for longclaw apps
|
||||
"""
|
||||
from wagtail.contrib.settings.models import BaseSetting, register_setting
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
from wagtail.admin.edit_handlers import FieldPanel
|
||||
from django.db import models
|
||||
|
||||
|
||||
@register_setting
|
||||
class LongclawSettings(BaseSetting):
|
||||
class Configuration(BaseSetting):
|
||||
default_shipping_rate = models.DecimalField(
|
||||
default=3.95,
|
||||
max_digits=12,
|
|
@ -1,26 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-09-22 12:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ProductRequest',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_data', models.DateTimeField(auto_now_add=True)),
|
||||
('email', models.EmailField(blank=True, help_text='Optional email of the customer who made the request', max_length=254, null=True)),
|
||||
('variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='requests', to='products.ProductVariant')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-10-08 16:57
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('productrequests', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='productrequest',
|
||||
old_name='created_data',
|
||||
new_name='created_date',
|
||||
),
|
||||
]
|
|
@ -1,7 +1,6 @@
|
|||
{% extends "wagtailadmin/base.html" %}
|
||||
{% load wagtailadmin_tags %}
|
||||
{% load wagtailcore_tags %}
|
||||
{% load gravatar %}
|
||||
{% load i18n %}
|
||||
{% load l10n %}
|
||||
{% block titletag %}{% blocktrans with title=page.get_admin_display_title page_type=content_type.model_class.get_verbose_name %}Requests For {{ page_type }}: {{ title }}{% endblocktrans %}{% endblock %}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
from django.shortcuts import render
|
||||
from django.views.decorators.http import require_GET
|
||||
from wagtail.wagtailcore.models import Page
|
||||
try:
|
||||
from wagtail.core.models import Page
|
||||
except ImportError:
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from longclaw.utils import ProductVariant
|
||||
from longclaw.contrib.productrequests.models import ProductRequest
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ try:
|
|||
except ImportError:
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailadmin import widgets
|
||||
from wagtail.core import hooks
|
||||
from wagtail.admin import widgets
|
||||
from longclaw.utils import ProductVariant
|
||||
|
||||
@hooks.register('register_page_listing_buttons')
|
||||
|
|
|
@ -2,4 +2,4 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class LongclawcoreConfig(AppConfig):
|
||||
name = 'longclawcore'
|
||||
name = 'core'
|
|
@ -3,13 +3,13 @@ from longclaw import settings
|
|||
|
||||
register = template.Library()
|
||||
|
||||
@register.inclusion_tag("longclawcore/script.html")
|
||||
@register.inclusion_tag("core/script.html")
|
||||
def longclaw_vendors_bundle():
|
||||
return {'path': 'longclawcore/js/vendors.bundle.js'}
|
||||
return {'path': 'core/js/vendors.bundle.js'}
|
||||
|
||||
@register.inclusion_tag("longclawcore/script.html")
|
||||
@register.inclusion_tag("core/script.html")
|
||||
def longclaw_client_bundle():
|
||||
return {'path': 'longclawcore/js/longclawclient.bundle.js'}
|
||||
return {'path': 'core/js/longclawclient.bundle.js'}
|
||||
|
||||
@register.simple_tag
|
||||
def longclaw_api_url_prefix():
|
|
@ -3,7 +3,7 @@ from django.test import TestCase
|
|||
from django.contrib.staticfiles import finders
|
||||
|
||||
from longclaw import settings
|
||||
from longclaw.longclawcore.templatetags import longclawcore_tags
|
||||
from longclaw.core.templatetags import longclawcore_tags
|
||||
|
||||
class TagTests(TestCase):
|
||||
|
||||
|
@ -14,6 +14,7 @@ class TagTests(TestCase):
|
|||
|
||||
def test_vendors_bundle(self):
|
||||
ctx = longclawcore_tags.longclaw_vendors_bundle()
|
||||
print(ctx)
|
||||
self._test_static_file(ctx['path'])
|
||||
|
||||
def test_client_bundle(self):
|
|
@ -1,5 +0,0 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class LongclawBasketConfig(AppConfig):
|
||||
name = 'longclawbasket'
|
|
@ -1,29 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-06 09:49
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ShippingCountry',
|
||||
fields=[
|
||||
('country_code', models.CharField(max_length=3, primary_key=True, serialize=False)),
|
||||
('country_name', models.CharField(max_length=32)),
|
||||
('standard_rate', models.DecimalField(decimal_places=2, max_digits=12)),
|
||||
('standard_rate_carrier', models.CharField(default='Royal Mail', max_length=64)),
|
||||
('standard_rate_description', models.CharField(default='Royal Mail standard shipping', max_length=128)),
|
||||
('premium_rate', models.DecimalField(decimal_places=2, max_digits=12)),
|
||||
('premium_rate_carrier', models.CharField(default='Royal Mail', max_length=64)),
|
||||
('premium_rate_description', models.CharField(default='Royal Mail tracked and signed for', max_length=128)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-11 16:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawcheckout', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='ShippingCountry',
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-08 10:10
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='order',
|
||||
name='shipping_rate',
|
||||
field=models.DecimalField(decimal_places=2, default=3.95, max_digits=12),
|
||||
),
|
||||
]
|
|
@ -1,30 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-11 16:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawshipping', '__first__'),
|
||||
('longclaworders', '0002_order_shipping_rate'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='billing_address',
|
||||
field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders_billing_address', to='longclawshipping.Address'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='shipping_address',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='orders_shipping_address', to='longclawshipping.Address'),
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Address',
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-12 16:05
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0003_auto_20170211_1632'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='shipping_rate',
|
||||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True),
|
||||
),
|
||||
]
|
|
@ -1,27 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-03-11 21:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0004_auto_20170212_1605'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='order',
|
||||
name='created_date',
|
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='payment_date',
|
||||
field=models.DateTimeField(),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-03-11 21:55
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0005_auto_20170311_2142'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='order',
|
||||
name='transaction_id',
|
||||
field=models.CharField(blank=True, max_length=256, null=True),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-03-13 08:46
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0006_order_transaction_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='payment_date',
|
||||
field=models.DateTimeField(blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-05-16 16:29
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0007_auto_20170313_0846'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='shipping_address',
|
||||
field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders_shipping_address', to='longclawshipping.Address'),
|
||||
),
|
||||
]
|
|
@ -1,26 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-05-26 21:04
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0008_auto_20170516_1629'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='billing_address',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders_billing_address', to='longclawshipping.Address'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='shipping_address',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders_shipping_address', to='longclawshipping.Address'),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-10-08 14:49
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0009_auto_20170526_2104'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='status',
|
||||
field=models.IntegerField(choices=[(1, 'Submitted'), (2, 'Fulfilled'), (3, 'Cancelled'), (4, 'Refunded')], default=1),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-12-19 10:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclaworders', '0010_auto_20171008_1449'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='order',
|
||||
name='status',
|
||||
field=models.IntegerField(choices=[(1, 'Submitted'), (2, 'Fulfilled'), (3, 'Cancelled'), (4, 'Refunded'), (5, 'Payment Failed')], default=1),
|
||||
),
|
||||
]
|
|
@ -1,90 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-06 09:49
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django_extensions.db.fields
|
||||
import modelcluster.contrib.taggit
|
||||
import modelcluster.fields
|
||||
import wagtail.wagtailcore.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('taggit', '0002_auto_20150616_2121'),
|
||||
('wagtailcore', '0030_index_on_pagerevision_created_at'),
|
||||
('wagtailimages', '0015_fill_filter_spec_field'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Product',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
('description', wagtail.wagtailcore.fields.RichTextField()),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ProductImage',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
|
||||
('caption', models.CharField(blank=True, max_length=255)),
|
||||
('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.Image')),
|
||||
('product', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='longclawproducts.Product')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['sort_order'],
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ProductIndex',
|
||||
fields=[
|
||||
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ProductTag',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('content_object', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='tagged_items', to='longclawproducts.Product')),
|
||||
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='longclawproducts_producttag_items', to='taggit.Tag')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ProductVariant',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('price', models.DecimalField(decimal_places=2, max_digits=12)),
|
||||
('ref', models.CharField(max_length=32)),
|
||||
('slug', django_extensions.db.fields.AutoSlugField(blank=True, editable=False, populate_from=('product', 'ref'), separator='')),
|
||||
('description', wagtail.wagtailcore.fields.RichTextField()),
|
||||
('stock', models.IntegerField(default=0)),
|
||||
('product', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='variants', to='longclawproducts.Product')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='product',
|
||||
name='tags',
|
||||
field=modelcluster.contrib.taggit.ClusterTaggableManager(blank=True, help_text='A comma-separated list of tags.', through='longclawproducts.ProductTag', to='taggit.Tag', verbose_name='Tags'),
|
||||
),
|
||||
]
|
|
@ -1,22 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-19 08:04
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawproducts', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='productvariant',
|
||||
name='product',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ProductVariant',
|
||||
),
|
||||
]
|
|
@ -1,30 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-09-03 16:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wagtailcore', '0032_add_bulk_delete_page_permission'),
|
||||
('wagtailforms', '0003_capitalizeverbose'),
|
||||
('longclawproducts', '0002_auto_20170219_0804'),
|
||||
('wagtailredirects', '0005_capitalizeverbose'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='Product',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ProductImage',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ProductIndex',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ProductTag',
|
||||
),
|
||||
]
|
|
@ -1,8 +0,0 @@
|
|||
from longclaw.longclawsettings.models import LongclawSettings
|
||||
|
||||
def currency(request):
|
||||
settings = LongclawSettings.for_site(request.site)
|
||||
return {
|
||||
'currency_html_code': settings.currency_html_code,
|
||||
'currency': settings.currency
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-12 14:23
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawsettings', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='longclawsettings',
|
||||
name='default_shipping_carrier',
|
||||
field=models.CharField(default='Royal Mail', help_text='The default shipping carrier', max_length=32),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='longclawsettings',
|
||||
name='default_shipping_rate',
|
||||
field=models.DecimalField(decimal_places=2, default=3.95, help_text='The default shipping rate for countries which have not been configured', max_digits=12),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-12 15:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawsettings', '0002_auto_20170212_1423'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='longclawsettings',
|
||||
name='currency_html_code',
|
||||
field=models.CharField(default='£', max_length=12),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-12 16:05
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawsettings', '0003_longclawsettings_currency_html_code'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='longclawsettings',
|
||||
name='currency',
|
||||
field=models.CharField(default='GBP', max_length=6),
|
||||
),
|
||||
]
|
|
@ -1,25 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-02-12 16:09
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawsettings', '0004_longclawsettings_currency'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='longclawsettings',
|
||||
name='currency',
|
||||
field=models.CharField(default='GBP', help_text='The iso currency code to use for payments', max_length=6),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='longclawsettings',
|
||||
name='currency_html_code',
|
||||
field=models.CharField(default='£', help_text='The HTML code for the currency symbol. Used for display purposes only', max_length=12),
|
||||
),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-04-10 16:20
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
import django_countries.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawshipping', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='address',
|
||||
name='country',
|
||||
field=django_countries.fields.CountryField(max_length=2),
|
||||
),
|
||||
]
|
|
@ -1,37 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-05-16 16:29
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawshipping', '0002_auto_20170410_1620'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Country',
|
||||
fields=[
|
||||
('iso', models.CharField(max_length=2, primary_key=True, serialize=False)),
|
||||
('name_official', models.CharField(max_length=128)),
|
||||
('name', models.CharField(max_length=128)),
|
||||
('sort_priority', models.PositiveIntegerField(default=0)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Countries',
|
||||
'ordering': ('-sort_priority', 'name'),
|
||||
},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='shippingrate',
|
||||
name='countries',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='shippingrate',
|
||||
name='countries',
|
||||
field=models.ManyToManyField(to='longclawshipping.Country'),
|
||||
),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-05-18 10:26
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawshipping', '0003_auto_20170516_1629'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='address',
|
||||
name='country',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='longclawshipping.Country'),
|
||||
),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-05-18 10:58
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawshipping', '0004_auto_20170518_0526'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='address',
|
||||
name='country',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='longclawshipping.Country'),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-05-21 08:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longclawshipping', '0005_auto_20170518_0558'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='shippingrate',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Unique name to refer to this shipping rate by', max_length=32, unique=True),
|
||||
),
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue