Changeset - 8d66ed57150d
[Not reviewed]
0 6 0
Christopher Neugebauer - 8 years ago 2016-03-25 03:51:39
chrisjrn@gmail.com
Fix flake8 warnings
5 files changed with 21 insertions and 13 deletions:
0 comments (0 inline, 0 general)
registrasion/forms.py
Show inline comments
...
 
@@ -44,5 +44,4 @@ def CategoryForm(category):
 
                    self.disable_product(product)
 

	
 

	
 
    products = rego.Product.objects.filter(category=category).order_by("order")
 
    for product in products:
registrasion/templatetags/registrasion_tags.py
Show inline comments
...
 
@@ -5,4 +5,5 @@ from django import template
 
register = template.Library()
 

	
 

	
 
@register.assignment_tag(takes_context=True)
 
def available_categories(context):
registrasion/tests/test_voucher.py
Show inline comments
...
 
@@ -96,11 +96,11 @@ class VoucherTestCases(RegistrationCartTestCase):
 

	
 
    def test_voucher_codes_unique(self):
 
        voucher1 = self.new_voucher(code="VOUCHER")
 
        self.new_voucher(code="VOUCHER")
 
        with self.assertRaises(IntegrityError):
 
            voucher2 = self.new_voucher(code="VOUCHER")
 
            self.new_voucher(code="VOUCHER")
 

	
 
    def test_multiple_vouchers_work(self):
 
        voucher1 = self.new_voucher(code="VOUCHER1")
 
        voucher2 = self.new_voucher(code="VOUCHER2")
 
        self.new_voucher(code="VOUCHER1")
 
        self.new_voucher(code="VOUCHER2")
 

	
 
    def test_vouchers_case_insensitive(self):
registrasion/urls.py
Show inline comments
...
 
@@ -9,4 +9,5 @@ urlpatterns = patterns(
 
    url(r"^profile$", "edit_profile", name="profile"),
 
    url(r"^register$", "guided_registration", name="guided_registration"),
 
    url(r"^register/([0-9]+)$", "guided_registration", name="guided_registration"),
 
    url(r"^register/([0-9]+)$", "guided_registration",
 
        name="guided_registration"),
 
)
registrasion/views.py
Show inline comments
...
 
@@ -3,5 +3,4 @@ from registrasion import models as rego
 
from registrasion.controllers.cart import CartController
 
from registrasion.controllers.invoice import InvoiceController
 
from registrasion.controllers.product import ProductController
 

	
 
from django.contrib.auth.decorators import login_required
...
 
@@ -84,4 +83,5 @@ def edit_profile(request):
 
    return render(request, "profile_form.html", data)
 

	
 

	
 
@login_required
 
def product_category(request, category_id):
...
 
@@ -104,9 +104,15 @@ def product_category(request, category_id):
 

	
 
    if request.method == "POST":
 
        cat_form = CategoryForm(request.POST, request.FILES, prefix=PRODUCTS_FORM_PREFIX)
 
        cat_form = CategoryForm(
 
            request.POST,
 
            request.FILES,
 
            prefix=PRODUCTS_FORM_PREFIX)
 
        cat_form.disable_products_for_user(request.user)
 
        voucher_form = forms.VoucherForm(request.POST, prefix=VOUCHERS_FORM_PREFIX)
 
        voucher_form = forms.VoucherForm(
 
            request.POST,
 
            prefix=VOUCHERS_FORM_PREFIX)
 

	
 
        if voucher_form.is_valid() and voucher_form.cleaned_data["voucher"].strip():
 
        if (voucher_form.is_valid() and
 
                voucher_form.cleaned_data["voucher"].strip()):
 
            # Apply voucher
 
            # leave
...
 
@@ -120,5 +126,5 @@ def product_category(request, category_id):
 
            try:
 
                handle_valid_cat_form(cat_form, current_cart)
 
            except ValidationError as ve:
 
            except ValidationError:
 
                pass
 

	
...
 
@@ -154,5 +160,4 @@ def product_category(request, category_id):
 
        for product in products:
 
            # Only add items that are enabled.
 
            prod = ProductController(product)
 
            try:
 
                quantity = items.get(product=product).quantity
...
 
@@ -167,5 +172,4 @@ def product_category(request, category_id):
 
        voucher_form = forms.VoucherForm(prefix=VOUCHERS_FORM_PREFIX)
 

	
 

	
 
    data = {
 
        "category": category,
...
 
@@ -176,4 +180,5 @@ def product_category(request, category_id):
 
    return render(request, "product_category.html", data)
 

	
 

	
 
@transaction.atomic
 
def handle_valid_cat_form(cat_form, current_cart):
...
 
@@ -188,4 +193,5 @@ def handle_valid_cat_form(cat_form, current_cart):
 
    current_cart.end_batch()
 

	
 

	
 
@login_required
 
def checkout(request):
...
 
@@ -213,4 +219,5 @@ def invoice(request, invoice_id):
 
    return render(request, "invoice.html", data)
 

	
 

	
 
@login_required
 
def pay_invoice(request, invoice_id):
0 comments (0 inline, 0 general)