Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'releases/0.2'

  • Loading branch information...
commit a30fd1e9f6d3d5aee5e6267c9b29ec227c1e638f 2 parents 534f09c + 6ed506e
@codeinthehole codeinthehole authored
View
20 README.rst
@@ -1,13 +1,22 @@
-============================================
-Django-Oscar - Flexible e-commerce on Django
-============================================
+.. image:: http://img94.imageshack.us/img94/9094/oscarza.jpg
-*django-oscar* is an e-commerce framework for Django designed for building
+===================================
+Domain-driven e-commerce for Django
+===================================
+
+Oscar is an e-commerce framework for Django designed for building
domain-driven e-commerce sites. It is structured such that any part of the
core functionality can be customised to suit the needs of your project. This
allows it to handle a wide range of e-commerce requirements, from large-scale B2C
sites to complex B2B sites rich in domain-specific business logic.
+Oscar is used in production by:
+
+* Tata - http://www.landmarkonthenet.com
+* Carlsberg's global business platform is powered by Oscar.
+* Dolbeau - http://www.dolbeau.ca/
+* The UK Labour party
+
This README is just a stub - see the following links for more details
information:
@@ -29,8 +38,9 @@ information:
.. _`Twitter account for news and updates`: https://twitter.com/#!/django_oscar
.. _`Twitter account of all commits`: https://twitter.com/#!/oscar_django
-Oscar was written by David Winterbottom (`@codeinthehole`_) and is developed
+Oscar was written by `David Winterbottom`_ (`@codeinthehole`_) and is developed
and maintained by `Tangent Labs`_, a London-based digital agency.
+.. _`David Winterbottom`: http://codeinthehole.com
.. _`@codeinthehole`: https://twitter.com/codeinthehole
.. _`Tangent Labs`: http://www.tangentlabs.co.uk
View
25 oscar/templates/basket/basket.html
@@ -1,6 +1,6 @@
{% extends "layout.html" %}
{% load currency_filters %}
-{% load product_tags %}
+{% load thumbnail %}
{% block title %}
Basket | {{ block.super }}
@@ -50,10 +50,14 @@ <h4 class="span1">Price</h4>
<div class="row-fluid">
<div class="span6">
{{ form.id }}
- {% product_image form.instance.product as product_image %}
<div class="image_container">
- <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}"></a>
+ {% with image=form.instance.product.primary_image %}
+ {% thumbnail image.original "200x200" upscale=False as thumb %}
+ <a href="{{ form.instance.product.get_absolute_url }}"><img class="thumbnail" src="{{ thumb.url }}" alt="{{ product.get_title }}"></a>
+ {% endthumbnail %}
+ {% endwith %}
</div>
+
<h4><a href="{{ form.instance.product.get_absolute_url }}">{{ form.instance.description }}</a></h4>
<p class="app-ico instock avaliability ">{{ form.instance.product.stockrecord.availability }}</p>
</div>
@@ -180,6 +184,7 @@ <h4 class="span1">Price</h4>
{% endif %}
+{% if request.user.is_authenticated %}
<div class="well">
<div class="sub-header">
<h3>To buy later</h3>
@@ -200,12 +205,13 @@ <h4 class="span4">Price</h4>
<div class="row-fluid basket-items">
<div class="span8">
{{ form.id }}
- {% product_image form.instance.product as product_image %}
- <div class="image_container">
- <a href="{{ product.get_absolute_url }}">
- <img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}">
- </a>
- </div>
+ <div class="image_container">
+ {% with image=form.instance.product.primary_image %}
+ {% thumbnail image.original "200x200" upscale=False as thumb %}
+ <a href="{{ form.instance.product.get_absolute_url }}"><img class="thumbnail" src="{{ thumb.url }}" alt="{{ product.get_title }}"></a>
+ {% endthumbnail %}
+ {% endwith %}
+ </div>
<h4><a href="{{ form.instance.product.get_absolute_url }}">{{ form.instance.description }}</a></h4>
<p class="app-ico instock avaliability ">{{ form.instance.product.stockrecord.availability }}</p>
<a href="#" data-id="{{ forloop.counter0 }}" data-behaviours="remove">Remove</a>
@@ -221,6 +227,7 @@ <h4 class="span4">Price</h4>
</form>
{% endif %}
</div>
+{% endif %}
{% endblock content %}
{% block onbodyload %}
View
402 oscar/templates/basket/basket.html.orig
@@ -1,402 +0,0 @@
-{% extends "layout.html" %}
-{% load currency_filters %}
-{% load product_tags %}
-
-{% block title %}
-Basket | {{ block.super }}
-{% endblock %}
-
-{% block checkout-nav %}
-<<<<<<< HEAD
-<nav class="checkoutNav">
- <ul class="nav row-fluid">
- <li class="active span3">
- <h3>1. Basket</h3>
- </li>
- <li class="disabled span2">
- <h3>2. Shipping Address</h3>
- </li>
- <li class="disabled span2">
- <h3>3. Shipping Options</h3>
- </li>
- <li class="disabled span2">
- <h3>4. Payment</h3>
- </li>
- <li class="disabled span2">
- <h3>5. Place Order</h3>
- </li>
- </ul>
-</nav>
-=======
-{% include 'checkout/nav.html' with step=1 %}
->>>>>>> 098e234ffd914d89b8ef0c6df5df2bbecad70b45
-{% endblock %}
-
-{% block header %}
-<div class="page-header">
- <h1>Basket</h1>
-</div>
-{% endblock header %}
-
-
-{% block content %}
-
-{% if basket_warnings %}
- <h5>Important messages about items in your basket</h5>
- {% for warning in basket_warnings %}
- <div class="alert">{{ warning }}</div>
- {% endfor %}
-{% endif %}
-
-{% if not basket.is_empty %}
-
-<<<<<<< HEAD
- <div class="well">
- <a href="{% url checkout:index %}" class="pull-right btn btn-primary">Proceed to Checkout</a>
- </div>
-<form action="." method="post" class="basket_summary">
- {% csrf_token %}
- {{ formset.management_form }}
- <!-- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th></th>
- <th>Product</th>
- <th>Availability</th>
- <th>Quantity</th>
- <th>Unit price</th>
- <th>Subtotal</th>
- {% if request.user.is_authenticated %}
- <th>Save for later&hellip;</th>
- {% endif %}
- <th>Remove?</th>
- </tr>
- </thead>
-=======
-<form action="." method="post" class="basket_summary" id="basket_formset">
- {% csrf_token %}
- {{ formset.management_form }}
- <table class="table table-striped table-bordered">
->>>>>>> 098e234ffd914d89b8ef0c6df5df2bbecad70b45
- <tbody>
- {% for form in formset %}
- <tr>
- <td>
- {{ form.id }}
- {% product_image form.instance.product as product_image %}
- <div style="width:100px">
- <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}"></a>
- </div>
- <a href="{{ form.instance.product.get_absolute_url }}">{{ form.instance.description }}</a><br/>
- {{ form.instance.product.stockrecord.availability }}
- </td>
- <td>
- {{ form.quantity }} <button class="btn btn-small">Update</button><br/>
- <a href="#" data-id="{{ forloop.counter0 }}" class="remove">Remove</a>
- {% if request.user.is_authenticated %}
- | <a href="#" data-id="{{ forloop.counter0 }}" class="save">Save for later</a>
- {% endif %}
- <div style="display:none">
- {{ form.save_for_later }}
- {{ form.DELETE }}
- </div>
- </td>
- <td>{{ form.instance.unit_price_incl_tax|currency }}</td>
- <td>{{ form.instance.line_price_incl_tax|currency }}</td>
- </tr>
- {% endfor %}
- </tbody>
-<<<<<<< HEAD
- </table> -->
-
- <form action="." method="post" class="basket_summary">
- {% csrf_token %}
- {{ formset.management_form }}
-
- <!-- <table class="table">
- <thead>
- <tr>
- <th></th>
- <th>Product</th>
- <th>Availability</th>
- <th>Quantity</th>
- <th>Unit Price Excl. Tax</th>
- <th>Tax</th>
- <th>Line Price Excl. Tax</th>
- <th>Line Price Incl. Tax</th>
- <th>Save for later&hellip;</th>
- <th>Delete?</th>
- </tr>
- </thead>
- <tbody> -->
- {% for form in formset %}
- <div class="row-fluid basket-products">
- <div class="span2">
- {% product_image form.instance.product as product_image %}
- <div style="width:100px">
- <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}"></a>
- </div>
- </div>
- <div class="span3">{{ form.id }}
- <a href="{{ form.instance.product.get_absolute_url }}">{{ form.instance.description }}</a>
- <label class="checkbox">
- <p><input id="optionsCheckbox" type="checkbox" value="option1">{{ form.instance.product.stockrecord.availability }}</p>
- </label>
- </div>
- <div class="span2">
- <form>
- <div class="checkout-quantity">{{ form.quantity }}</div>
- <span class="help-inline">Delete? {{ form.DELETE }}</span>
- <input type="submit" value="Update" class="btn"/>
- </div>
- <div class="span3">
- Item Price: {{ form.instance.line_price_incl_tax|currency }}
- <p>RRP:</p>
- <p>You Save</p>
- <p>RRP:$2.00 (32%)</p>
- </div>
- <div class="span2">
- Save for later? {{ form.save_for_later }}
- </div>
- </div>
-
- <!-- <td>{{ form.quantity }}</td>
- <td>{{ form.instance.unit_price_excl_tax|currency }}</td>
- <td>{{ form.instance.unit_tax|currency }}</td>
- <td>{{ form.instance.line_price_excl_tax|currency }}</td>
- <td>{{ form.instance.line_price_incl_tax|currency }}</td>
- <td>{{ form.save_for_later }}</td>
- <td>{{ form.DELETE }}</td>
- </div> -->
- {% endfor %}
- {% for discount in basket.discounts %}
- <!-- <tr>
- <td colspan="7">{{ discount.name }}</td>
- <td colspan="3">-{{ discount.discount|currency }}</td>
- </tr> -->
- {% endfor %}
- <!-- <tr>
- <td colspan="6">Total</td>
- <td>{{ request.basket.total_excl_tax|currency }}</td>
- <td>{{ basket.total_incl_tax|currency }}</td>
- <td></td>
- <td></td>
- </tr>
- </tbody>
- </table> -->
-
-
-
- <div class="well">
- <div class="sub-heading">
- <h3>Basket Updates</h3>
- </div>
- </div>
-
- <div class="row-fluid">
- <div class="span5">
- <div class="sub-header">
- <h2>Voucher/Promo Code</h2>
- </div>
- If you have a voucher or promo code, please enter it here.
-
- {% if request.basket.pk %}
-
- <ul>
- {% for voucher in basket.vouchers.all %}
- <li>
- <form action="{% url basket:vouchers-remove voucher.id %}" method="POST">
- {% csrf_token %}
- {{ voucher.name }} ({{ voucher.code }})
- <input type="submit" value="Remove" class="btn"/>
- </form>
- </li>
- {% endfor %}
- </ul>
- {% endif %}
-
- <form action="{% url basket:vouchers-add %}" method="post" class="form-horizontal">
- {% csrf_token %}
- {% include "partials/form_fields.html" with form=voucher_form %}
- <div class="form-actions">
- <input type="submit" value="Add voucher" class="btn"/>
- </div>
- </form>
-
- </div>
- <div class="span7">
- <div class="sub-header">
- <h2>Basket Totals</h2>
- </div>
- <table class="table table-striped table-condensed">
- <tbody>
- <tr>
- <th>Basket Subtotal</th>
- <td> {{ basket.total_incl_tax|currency }}</td>
- </tr>
- <tr>
- <th>Delivery From</th>
- <td>{{ shipping_charge_incl_tax|currency }}</td>
- </tr>
- <tr>
- <th>Total</th>
- <td>{{ order_total_incl_tax|currency }}</td>
- </tr>
- </tbody>
- </table>
- <div class="form-actions">
- Made changes? <input type="submit" value="Update basket" class="btn"/>
- <a href="{% url checkout:index %}" class="pull-right btn btn-primary">Proceed to Checkout</a>
- </div>
- </div>
- </div>
- </form>
-
- <div class="row-fluid">
- <div class="sub-header">
- <h2>Saved Items</h2>
- </div>
- <p>These products are ones you have saved for later</p>
- <div class="span2"><!-- Product image -->
- </div>
- </div>
-=======
- </table>
-</form>
-
-<p id="voucher_form_link"><a href="#voucher">I have a voucher code...</a></p>
-<div id="voucher_form_container" style="display:none">
- <h4>Voucher code</h4>
- <form action="{% url basket:vouchers-add %}" method="post" class="form-horizontal">
- {% csrf_token %}
- {% include "partials/form_fields.html" with form=voucher_form %}
- <div class="form-actions">
- <button class="btn btn-info">Add voucher</button>
- or <a href="#" id="voucher_form_cancel">cancel</a>
- </div>
- </form>
-</div>
-
-<div id="basket_totals">
- <table>
- {% with offer_discounts=basket.offer_discounts voucher_discounts=basket.grouped_voucher_discounts %}
- {% if offer_discounts or voucher_discounts %}
- <tr>
- <th>Basket total (before discounts)</th>
- <td>{{ basket.total_incl_tax_excl_discounts|currency }}</td>
- </tr>
- {% if offer_discounts %}
- <tr>
- <th>Site offers</th>
- <td></td>
- </tr>
- {% for discount in offer_discounts %}
- <tr>
- <td>{{ discount.name }}</td>
- <td>-{{ discount.discount|currency }}</td>
- </tr>
- {% endfor %}
- {% endif %}
- {% if voucher_discounts %}
- <tr>
- <th>Vouchers</th>
- <td></td>
- </tr>
- {% for discount in voucher_discounts %}
- <tr>
- <td>
- {{ discount.voucher.name }} ({{ discount.voucher.code }})
- <form action="{% url basket:vouchers-remove discount.voucher.id %}" method="POST">
- {% csrf_token %}
- <input type="submit" value="Remove" class="btn btn-small btn-danger"/>
- </form>
- </td>
- <td>-{{ discount.discount|currency }}</td>
- </tr>
- {% endfor %}
- {% endif %}
- <tr>
- <th>Basket total (after discounts)</th>
- <td>{{ basket.total_incl_tax|currency }}</td>
- </tr>
- {% else %}
- <tr>
- <th>Basket total</th>
- <td>{{ basket.total_incl_tax|currency }}</td>
- </tr>
- {% endif %}
- {% endwith %}
- <tr>
- <th>Shipping ({{ shipping_method.name }})</th>
- <td>{{ shipping_charge_incl_tax|currency }}</td>
- </tr>
- <tr>
- <th>Order total</th>
- <td>{{ order_total_incl_tax|currency }}</td>
- </tr>
- </table>
-</div>
-
-<div class="form-actions">
- <a href="{% url checkout:index %}" class="pull-right btn btn-large btn-primary">Proceed to checkout</a>
-</div>
->>>>>>> 098e234ffd914d89b8ef0c6df5df2bbecad70b45
-
-
-{% else %}
-
- <p>Your basket is empty, you should probably add some items to buy.</p>
-
-{% endif %}
-
-
-<div class="sub-header">
- <h3>To buy later</h3>
-</div>
-
-{% if not saved_formset %}
-<p>Your saved basket is empty.</p>
-
-{% else %}
-<form action="{% url basket:saved %}" method="post" class="form-stacked later_summary" id="saved_basket_formset">
- {% csrf_token %}
-
- {{ saved_formset.management_form }}
-
- <table class="bordered-table zebra-striped">
- <tbody>
- {% for form in saved_formset %}
- <tr>
- <td>
- {{ form.id }}
- {% product_image form.instance.product as product_image %}
- <div style="width:100px">
- <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}"></a>
- </div>
- <a href="{{ form.instance.product.get_absolute_url }}">{{ form.instance.description }}</a><br/>
- {{ form.instance.product.stockrecord.availability }}
- </td>
- <td>
- <a href="#" data-id="{{ forloop.counter0 }}" class="remove">Remove</a>
- | <a href="#" data-id="{{ forloop.counter0 }}" class="move">Move to basket</a>
- <div style="display:none">
- {{ form.move_to_basket }}
- {{ form.DELETE }}
- </div>
- </td>
- <td>{{ form.instance.unit_price_incl_tax|currency }}</td>
- <td>{{ form.instance.line_price_incl_tax|currency }}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
-
-</form>
-{% endif %}
-
-{% endblock content %}
-
-{% block onbodyload %}
-oscar.basket.init();
-{% endblock %}
-
View
11 oscar/templates/promotions/partials/product_carousel.html
@@ -1,10 +1,15 @@
{% load currency_filters %}
-{% load product_tags %}
+{% load thumbnail %}
+
<article class="product_pod">
- {% product_image product as product_image %}
<div class="image_container">
- <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}"></a>
+ {% with image=product.primary_image %}
+ {% thumbnail image.original "400x400" upscale=False as thumb %}
+ <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ thumb.url }}" alt="{{ product.get_title }}"></a>
+ {% endthumbnail %}
+ {% endwith %}
</div>
+
<h3><a href="{{ product.get_absolute_url }}">{{ product.get_title|truncatewords:5|slice:"-4" }}</a></h3>
{% if product.is_group %}
<h4 class="group-price"><span>From</span> <strong>{{ product.min_variant_price_incl_tax|currency }}</strong></h4>
View
9 oscar/templates/promotions/singleproduct.html
@@ -1,6 +1,6 @@
{% load currency_filters %}
{% load basket_tags %}
-{% load product_tags %}
+{% load thumbnail %}
<article class="well promotion_single">
<div class="sub-header">
@@ -8,9 +8,12 @@
</div>
<div class="row-fluid">
<div class="span3">
- {% product_image product as product_image %}
<div class="image_container">
- <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ product_image.thumbnail_url }}" alt="{{ product.get_title }}"></a>
+ {% with image=product.primary_image %}
+ {% thumbnail image.original "400x400" upscale=False as thumb %}
+ <a href="{{ product.get_absolute_url }}"><img class="thumbnail" src="{{ thumb.url }}" alt="{{ product.get_title }}"></a>
+ {% endthumbnail %}
+ {% endwith %}
</div>
</div>
<div class="span9">
View
37 oscar/templatetags/product_tags.py
@@ -1,37 +0,0 @@
-from django import template
-from django.db.models import get_model
-from django.conf import settings
-Product = get_model('catalogue', 'product')
-
-register = template.Library()
-
-
-@register.tag(name="product_image")
-def do_basket_form(parse, token):
- """
- Template tag for adding the product image data to the context
- """
- tokens = token.split_contents()
- if len(tokens) != 2 and len(tokens) != 4:
- raise template.TemplateSyntaxError("%r tag uses the following syntax: {%% product_image product_var [as variable_name] %%}" % tokens[0])
- product_var = tokens[1]
- context_key = tokens[3] if len(tokens) == 4 else 'image'
- return ProductImageNode(product_var, context_key)
-
-
-class ProductImageNode(template.Node):
- def __init__(self, product_var, context_key):
- self.product_var = template.Variable(product_var)
- self.context_key = context_key
-
- def render(self, context):
- try:
- product = self.product_var.resolve(context)
- except template.VariableDoesNotExist:
- return ''
- try:
- image = product.images.all().order_by('display_order')[0]
- except IndexError:
- image = {'thumbnail_url': settings.OSCAR_MISSING_IMAGE_URL}
- context[self.context_key] = image
- return ''
View
1  tests/config.py
@@ -25,6 +25,7 @@
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
+ 'sorl.thumbnail',
] + OSCAR_CORE_APPS,
TEMPLATE_CONTEXT_PROCESSORS=(
"django.contrib.auth.context_processors.auth",
Please sign in to comment.
Something went wrong with that request. Please try again.