This file contains 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 Foo(object): | |
"""Epic Docstring. What if it has 80 characters. Will gist add a scrollbar?""" | |
def __init__(self): | |
self.bar = 'foobar' |
This file contains 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
# kudos to https://github.com/drewlesueur | |
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535 | |
git checkout -b upstream-master | |
git remote add upstream git://github.com/documentcloud/underscore.git | |
git pull upstream master | |
git checkout master // [my master branch] | |
git merge upstream-master | |
git push origin master |
This file contains 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
mkvirtualenv -p python2.7 --no-site-packages django-shop-adventures | |
workon django-shop-adventures | |
pip install django==1.3 | |
pip install south | |
pip install django-shop | |
# this folder structure is not a must | |
# it helps if you want to host your app at webfaction.com | |
mkdir $HOME/Projects/django-shop-adventures/src/webapps/django | |
mkdir $HOME/Projects/django-shop-adventures/src/webapps/static |
This file contains 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.db import models | |
from shop.models.productmodel import Product | |
class Category(models.Model): | |
"""Master data: Names of categories.""" | |
name = models.CharField(max_length=256) | |
def __unicode__(self): | |
return self.name |
This file contains 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.contrib import admin | |
from myshop import models as shop_models | |
class LEDAdmin(admin.ModelAdmin): | |
prepopulated_fields = {"slug": ("name",)} | |
admin.site.register(shop_models.Category) | |
admin.site.register(shop_models.Distributor) |
This file contains 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_SHIPPING_FLAT_RATE = '-30' | |
SHOP_SHIPPING_BACKENDS = [ | |
'shop.shipping.backends.flat_rate.FlatRateShipping', | |
] | |
SHOP_PAYMENT_BACKENDS = [ | |
'shop.payment.backends.pay_on_delivery.PayOnDeliveryBackend' | |
] |
This file contains 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
"""View classes for the get_client_info application.""" | |
from shop.views import ShopTemplateView | |
from shop.views.checkout import SelectShippingView | |
class GetClientInfoView(SelectShippingView): | |
"""Displays form for gathering shipping and billing address.""" |
This file contains 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.urls.defaults import * | |
from django.contrib import admin | |
from shop import urls as shop_urls | |
from shop_simplevariations import urls as simplevariations_urls | |
admin.autodiscover() | |
This file contains 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
{% load simplevariation_tags %} | |
<!-- Your product detail view here --> | |
<form method="post" action="{% url cart %}">{% csrf_token %} | |
{% with option_groups=object|get_option_groups %} | |
{% if option_groups %} | |
<div> | |
<h2>Variations:</h2> | |
{% for option_group in option_groups %} | |
<label for="add_item_option_group_{{ option_group.id }}">{{ option_group.name }}</label> | |
{% with options=option_group|get_options %} |
This file contains 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
""" Cart modifierts for the myshop app of django-shop-adventures.""" | |
import decimal | |
from django.conf import settings | |
from shop.cart.cart_modifiers_base import BaseCartModifier | |
class FixedTaxRate(BaseCartModifier): | |
""" |
OlderNewer