I am trying to create some tables for my application using django-tables2 and running into some difficulties. I am using Python 2.7, and Django 1.7. I am following the tutorial, and I ran into problems.
I reach the point where I need to create a Table class for customization. However, whenever I do so, I get the following error:
Expected table or queryset, not 'str'.
After doing some research it looks like I am using an older version of django-tables2. However, I just installed it yesterday using pip install django-tables2
and updated it a half an hour ago. Any idea how I can get django-tables2 to work properly?
EDIT - Problem solved. I was using {% render_table people %}
instead of {% render_table table %}
I encountered that problem, too. The first thing you should do is to check your updates:
sudo pip install django-tables2 --upgrade
sudo pip install django-tables2-reports --upgrade
Upgrades didn't fix my problem either.
If you have already upgraded version of these. You should check your implementation. If you are using Class Based View and you probably implemented the view,template,table. You probably forget the urls:
/* I give the example with respect to other post*/
urls.py /*Same dic with table.py,models..etc*/
from .views import SomeTableView
urlpatterns = patterns('',
url(r"^$", SomeTableView.as_view(), name="index"),
)
If it is not index of your website you have to probably change the r"^$"
and name="index"