dchaplinsky  committed b636e90

LFS urlname refactoring:
* All occurences of url tags, get_absolute_url and reverse reviewed and updated to use urlnames instead of direct paths to views
* order_paid signal is now sent by mark_payment helper

  • Participants
  • Parent commits 3c85af7
  • Branches default

Comments (0)

Files changed (9)

File lfs/cart/

 from lfs.core import utils as core_utils
 from lfs.catalog.models import Product
 from lfs.catalog.models import Property
-from lfs.catalog.settings import QUANTITY_FIELD_INTEGER
 from lfs.cart import utils as cart_utils
 from lfs.cart.models import CartItem
 from lfs.core.models import Country
-from lfs.core.utils import l10n_float
 from lfs.core.utils import LazyEncoder
 from lfs.shipping import utils as shipping_utils
 from lfs.payment import utils as payment_utils
         url_name = settings.LFS_AFTER_ADD_TO_CART
     except AttributeError:
-        url_name = "lfs.cart.views.added_to_cart"
+        url_name = "lfs_added_to_cart"
     if message:
         return lfs.core.utils.set_message_cookie(reverse(url_name), message)

File lfs/catalog/

 # Python imports
 import locale
 import math
-import re
 import uuid
 # django imports
 from django.db import models
 from django.utils.translation import ugettext_lazy as _
 from django.conf import settings
-from django.utils.importlib import import_module
 # lfs imports
 import lfs.catalog.utils
     def get_absolute_url(self):
         """Returns the absolute_url.
-        return ("lfs.catalog.views.category_view", (), {"slug": self.slug})
+        return ("lfs_category", (), {"slug": self.slug})
     get_absolute_url = models.permalink(get_absolute_url)
     def get_absolute_url(self):
         """Returns the absolute url of the product.
-        return ("lfs.catalog.views.product_view", (), {"slug": self.slug})
+        return ("lfs_product", (), {"slug": self.slug})
     get_absolute_url = models.permalink(get_absolute_url)

File lfs/checkout/

 from lfs.checkout.settings import INVOICE_PREFIX, SHIPPING_PREFIX
 from lfs.customer import utils as customer_utils
 from lfs.core.models import Country
-from lfs.customer.models import Address
 from lfs.customer.models import BankAccount
 from lfs.customer.forms import RegisterForm
 from lfs.customer.views import address_inline, save_address
 from lfs.payment.models import PaymentMethod
-from lfs.payment.settings import PAYPAL
 from lfs.payment.settings import DIRECT_DEBIT
-from lfs.payment.settings import CREDIT_CARD
 from lfs.voucher.models import Voucher
 from lfs.voucher.settings import MESSAGES
     return render_to_response(template_name, RequestContext(request, {
-        "shopping_url": reverse("lfs.core.views.shop_view"),
+        "shopping_url": reverse("lfs_shop_view"),

File lfs/manage/categories/

 from lfs.core.utils import set_category_levels
 from lfs.core.widgets.image import LFSImageInput
 from lfs.manage import utils as manage_utils
-from lfs.manage.categories.products import manage_products
 from lfs.manage.categories.view import category_view
 from lfs.manage.categories.portlet import manage_categories_portlet
 from lfs.manage.seo.views import SEOView
     products are displayed by slug, for the manager by id).
     category = Category.objects.get(pk=category_id)
-    url = reverse("lfs.catalog.views.category_view", kwargs={"slug": category.slug})
+    url = reverse("lfs_category", kwargs={"slug": category.slug})
     return HttpResponseRedirect(url)

File lfs/manage/product/

     products are displayed by slug, for the manager by id).
     product = Product.objects.get(pk=product_id)
-    url = reverse("lfs.catalog.views.product_view", kwargs={"slug": product.slug})
+    url = reverse("lfs_product", kwargs={"slug": product.slug})
     return HttpResponseRedirect(url)

File lfs/manage/

     url(r'^sort-actions$', "sort_actions", name="lfs_sort_actions"),
-# Prodcut Taxes
+# Product Taxes
 urlpatterns += patterns('lfs.manage.product_taxes.views',
     url(r'^add-product-tax$', "add_tax", name="lfs_manage_add_tax"),
     url(r'^delete-product-tax/(?P<id>\d*)$', "delete_tax", name="lfs_delete_tax"),

File lfs/payment/

 from lfs.order.settings import PAID, PAYMENT_FAILED, PAYMENT_FLAGGED
 from lfs.mail import utils as mail_utils
 from models import PayPalOrderTransaction
+from lfs.core.signals import order_paid
 # other imports
 import logging
         order = Order.objects.get(uuid=order_uuid)
         if order is not None:
             if order.state != PAID and order_state == PAID:
+                order_paid.send({"order": order, "request": None})
                 if getattr(settings, 'LFS_SEND_ORDER_MAIL_ON_PAYMENT', False):
             order.state = order_state
     except Order.DoesNotExist, e:

File lfs/templates/manage/order/orders_inline.html

             {% for order in page.object_list %}
                 <tr class="clickable {% cycle 'even' 'odd' %}"
-                    onclick="window.location='{% url lfs.manage.views.order_view %}'">
+                    onclick="window.location='{% url lfs_manage_order %}'">
                         {{ order.number|default_if_none:"-" }}

File lfs/templates/manage/order/selectable_orders_inline.html

 {% for order in page.object_list %}
     <div class="navigation-body">
-        <a href="{% url lfs.manage.views.order_view %}"
+        <a href="{% url lfs_manage_order %}"
            class="selectable {% ifequal %}selected{% endifequal %}">
             {% if order.number %}
                 {{ order.number }}