How to use djblets (I get error)

44 views
Skip to first unread message

Ernesto

unread,
Feb 9, 2014, 12:15:43 AM2/9/14
to django...@googlegroups.com
Hello, I am trying to use djblets but I have this error:

Error during template rendering

In template /usr/lib/python2.6/site-packages/djblets/util/templates/js/jquery.html, error at line 1
Invalid block tag: 'static'


1    <script type="text/javascript" src="{% static "djblets/js/jquery-1.8.2.min.js" %}"></script>


settings.py:
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'cpvru',
    'south',
    'djblets.auth',
    'djblets.datagrid',
    'djblets.extensions',
    'djblets.feedview',
    'djblets.gravatars',
    'djblets.log',
    'djblets.pipeline',
    'djblets.siteconfig',
    'djblets.testing',
    'djblets.util',
    'djblets.webapi',  
)


views.py:
from django.http import HttpResponse
from django.shortcuts import render
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from cpvru.models import Miembro
from cpvru.datagrids import UserDataGrid

from djblets.datagrid.grids import Column, DataGrid

def index(request, template_name='datagrid/datagrid.html'):
    return UserDataGrid(request).render_to_response(template_name)

datagrids.py:
from django.contrib.auth.models import User
from djblets.datagrid.grids import Column, DataGrid

class UserDataGrid(DataGrid):
    username = Column("Username", sortable=True)
    first_name = Column("First Name", sortable=True)
    last_name = Column("Last Name", sortable=True)

    def __init__(self, request):
        DataGrid.__init__(self, request, User.objects.filter(is_active=True), "Users")
        self.default_sort = ['username']
        self.default_columns = ['username', 'first_name', 'last_name']


I think I am missing importing something?

Thanks you.

Daniel Roseman

unread,
Feb 9, 2014, 4:40:38 AM2/9/14
to django...@googlegroups.com
So, given the error is in the template, you didn't think it would be a good idea to post that, instead of a load of other code?

You have probably forgotten to do {% load static %}. Nor this has nothing to do with djblets.
--
DR.

Reply all
Reply to author
Forward
0 new messages