This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FixedShippingCosts(BaseCartModifier): | |
| """ | |
| This will add a fixed amount of money for shipping costs. | |
| """ | |
| def add_extra_cart_price_field(self, cart): | |
| cart.extra_price_fields.append( | |
| ('Shipping costs', decimal.Decimal( | |
| settings.SHOP_SHIPPING_FLAT_RATE))) | |
| return cart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SHOP_CART_MODIFIERS = [ | |
| 'shop_simplevariations.cart_modifier.ProductOptionsModifier', | |
| 'myshop.modifiers.FixedShippingCosts', | |
| 'myshop.modifiers.FixedTaxRate', | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <body> | |
| <h1>Shipping and Billing</h1> | |
| <form method="POST"> | |
| {% csrf_token %} | |
| <h3>Your shipping address</h3> | |
| {{ shipping_address.as_p }} | |
| <h3>Your billing address</h3> | |
| {{ billing_address.as_p }} | |
| <input type=hidden name="shipping_method" value="skip-shipping" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """Shipping backend that skips the whole shipping process.""" | |
| from django.conf.urls.defaults import patterns, url | |
| class SkipShippingBackend(object): | |
| backend_name = "Skip Shipping Backend" | |
| url_namespace = "skip-shipping" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.conf.urls.defaults import patterns, url | |
| from django.conf.urls.static import static | |
| from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
| # The next two lines enable the admin and load each admin.py file: | |
| from django.contrib import admin | |
| admin.autodiscover() | |
| urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="pagination"> | |
| <span class="step-links"> | |
| {% if page_obj.has_previous %} | |
| <a id="paginLeft" href="?page={{ page_obj.previous_page_number }}">previous</a> | |
| {% endif %} | |
| <span class="current"> | |
| {{ page_obj.number }} {% trans "of" %} {{ page_obj.paginator.num_pages }} | |
| </span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """A ghetto stupid dead simple approach for model translation.""" | |
| from django.utils.translation import get_language | |
| class LanguageFieldProxy(object): | |
| """ | |
| Thanks to ojii for providing this snippet. | |
| Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add this soewhere where it gets loaded very early, i.e. | |
| # your shop's models.py | |
| from django.contrib.auth import login | |
| from django.contrib.auth.signals import user_logged_in | |
| from django.dispatch import receiver | |
| from registration.signals import user_activated | |
| from shop.models.defaults.cart import Cart | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.conf.urls.defaults import * | |
| from django.conf.urls.static import static | |
| from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
| # The next two lines enable the admin and load each admin.py file: | |
| from django.contrib import admin | |
| admin.autodiscover() | |
| urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| import md5 | |
| from django.contrib.auth.models import User | |
| import factory | |
| class UserFactory(factory.Factory): | |
| """ |