python - django-tables - cannot concatenate 'str' and 'tuple' -


i'm trying use django-tables2 in project.

here model

class client(models.model):     comp = models.foreignkey(company)     user = models.foreignkey(user)     def __unicode__(self):         return u'%s\'s client data' % self.user     class meta:         unique_together = (('user', 'comp')) 

my table

class clienttable(tables.table):     class meta:         model = client         fields = ('user')         empty_text = _('no client') 

my view

@login_required def client_list(request):     obj = {}     try:         clients = request.user.staff.company.client_set.all()         client_table = clienttable(clients) # <-- error here     except staff.doesnotexist:         raise http404     obj['client_table'] = client_table     obj['client_nb'] = clients.count()     return render_to_response('company/client_list.html',         obj, context_instance=requestcontext(request),) 

this gives me error:

cannot concatenate 'str' , 'tuple' objects
...
/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py in init
self._sequence = sequence(self._meta.fields + ('...',))

in table definition, field attribute must tuple.

fields = ('user') 

this considered string, have use

fields = ('user',) 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -