On Github ComSource / Oscar-DjangoCong-2013
September, 28th 2013 - UTMB, Belfort, France
# settings.py TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) TEMPLATE_DIRS = ( location('templates'), ) from oscar import OSCAR_MAIN_TEMPLATE_DIR TEMPLATE_DIRS = TEMPLATE_DIRS + (OSCAR_MAIN_TEMPLATE_DIR,)
# base.html {% extends 'oscar/base.html' %} {% block styles %} <link rel="stylesheet" type="text/css" href="{% static "oscar/css/styles.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "oscar/css/responsive.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "batzeko/css/batzeko.css" %}" /> {% endblock styles %}
# base.html {% extends 'oscar/base.html' %} {% block extrascripts %} {{ block.super }} ... {% endblock extrascripts %}
# settings.py from oscar import get_core_app INSTALLED_APPS = [ 'django.contrib.auth', ... ] + get_core_apps( overrides=( 'apps.catalogue', 'apps.checkout', 'apps.promotions', ) )
from django.db.loading import get_model Category = get_model('catalogue', 'Category')
apps ├── __init__.py ├── catalogue │ ├── __init__.py │ ├── app.py │ ├── models.py │ ├── views.py ├── checkout │ ├── __init__.py │ ├── app.py │ ├── models.py │ ├── views.py └── promotions ├── __init__.py ├── app.py ├── models.py └── views.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from oscar.apps.catalogue.abstract_models import AbstractCategory class Category(AbstractCategory): """ Link categories to stores """ store = models.ForeignKey('stores.Store', related_name='categories', null=True, blank=True) from oscar.apps.catalogue.models import *
from oscar.apps.checkout import views class PaymentDetailsView(views.PaymentDetailsView): def handle_payment(self, order_number, total_incl_tax, **kwargs): # Get PayPal transaction try: adaptive_transaction = AdaptiveTransaction.objects.get( pay_key=self.pay_key) except: raise exceptions.UnableToTakePayment( _('PayPal adaptive transaction not found!')) #...