Search code examples
pythondjangodjango-lfs

Override templates in Django-LFS


I'm a n00b in django, I have done the polls tutorial and not too much more. I want to set up an online shop with Lightning Fast Shop (LFS), which does pretty much anything I need. I know it would be desirable to have a better django base...

One of the first steps I want to do, is to customize a little bit the templates. Here is an explanation about how to do it:

http://play.pixelblaster.ro/blog/archive/2009/09/17/customizing-django-lfs-lightning-fast-shop-for-the-non-django-developer

The FLS frameworks is properly installed: I can open the site, define products, add products to the cart, etc.

I have configured the settings.TEMPLATE_DIRS so that it points to a inner folder into my project. It seems I got it right, because when I drop there a template base.html, I get the following error:

NoReverseMatch at /
'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.

... a lot of information...

Error during template rendering

In template c:\development\......\lfs-installer\lfs_project\theme\templates\lfs\base.html, error at line 47
'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.
37              <script type="text/javascript" src="{{ STATIC_URL }}jquery/lightbox/jquery.lightbox-0.5.js"></script>
38              <script type="text/javascript" src="{{ STATIC_URL }}js/lfs.js"></script>
39          {% endcompress %}
40  
41      </head>
42      <body class="{% block section %}lfs{% endblock %}">
43          <div id="header">
44              <div class="container">
45                  {% block header %}
46                      <div class="span-6 logo">
47                          <a href="{% url lfs.core.views.shop_view %}">
48                              <img class="logo"
49                                   src="{{ STATIC_URL }}img/logo.jpg"
50                                   alt="Logo" />
51                          </a>
52                      </div>
53                      <div class="span-18 search last">
54                          {% if user.is_authenticated %}
55                              {% if user.first_name %}
56                                  <span>{{ user.first_name }} {{user.last_name}}</span>
57                              {% else %}

I have tried to copy the whole templates from the flstheme package, but it still does not work.

There are good explanation on this topic for pure django, but it FLS is an extra complexity layer and I cant get it right. Thanks a lot in advance.

EDIT This is a freeze of my virtualenv:

Django==1.6.5
Pillow==1.7.5
South==0.7.3
django-appconf==0.6
django-compressor==1.1.1
django-countries==1.5
django-lfs==0.7.8
django-lfstheme==0.7.4
django-pagination==1.0.7
django-paypal==0.1.2
django-piston==0.2.3
django-portlets==1.1.1
django-postal==0.92
django-reviews==0.2.1
django-tagging==0.3.1
lfs-contact==1.0
lfs-order-numbers==1.0b1
six==1.7.3

Solution

  • As the traceback states, the url tag in line 47 should look like this

    {% url 'lfs.core.views.shop_view' %}
    

    This has been changed in Django 1.5.

    Make also sure that you are using Django 1.3.* with LFS 0.7.*. If you do this, the above error shouldn't rise up at all.

    LFS 0.9 (which is in alpha state at the moment) is using Django 1.6.*, though.