В чем проблема?
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from things.models import Path, Margin, Sell, View, Tissue, Thing
@register.filter(needs_autoescape=True)
def price(id, autoescape=None):
m3 = Thing.objects.get(id=id)
price = m3.price
if m3.sell.name_sell=="product_today":
summa = m3.price+((m3.price/100)*m3.margin.how_mach + m3.margin.how_maney) - ((m3.price/100)*m3.sell.how_mach + m3.sell.how_maney)
else:
how_mach_sell = m3.name.sell.how_mach + m3.path.sell.how_mach + m3.tissue.sell.how_mach + m3.sell.how_mach
how_maney_sell = m3.name.sell.how_maney + m3.path.sell.how_maney + m3.tissue.sell.how_maney + m3.sell.how_maney
how_mach_margin = m3.name.margin.how_mach + m3.path.margin.how_mach + m3.tissue.margin.how_mach + m3.margin.how_mach
how_maney_margin = m3.name.margin.how_maney + m3.path.margin.how_maney + m3.tissue.margin.how_maney + m3.margin.how_maney
summa = (m3.price + ((m3.price/100)*how_mach_margin + how_maney_margin)) - ((m3.price/100)*how_mach_sell + how_maney_sell)
result = '%s%s' % ((price), (summa))
return mark_safe(result)
Приложения для шаблонов лежит в папке templatetags, в папке с приложением things.
init.py лежит в этой же папке - скопированное из папки приложения - файл пустой, как и в приложении.
В настройках прописано приложение, sell - не прописано, пытался прописать что-то вроде things.sell - не вышло.
В шаблоне приписал {% load sell %}
Решил посмотреть - что получится.
В итоге:
IndentationError at /
expected an indented block (sell.py, line 10)
Файл sell.py перед Вами, отступы расставлены правильно.
В чем проблема?
Updated 16 July 2012, 17:17 by xxnikolayxx.