Revision 6795eb09 snf-astakos-app/astakos/im/tables.py

b/snf-astakos-app/astakos/im/tables.py
42 42
import django_tables2 as tables
43 43

  
44 44
from astakos.im.models import *
45
from astakos.im.templatetags.filters import truncatename
45 46

  
46 47
DEFAULT_DATE_FORMAT = "d/m/Y"
47 48

  
......
56 57
     -1: _('Unregistered'),
57 58
}
58 59

  
60
class TruncatedLinkColumn(tables.LinkColumn):
61

  
62
    def __init__(self, *args, **kwargs):
63
        self.truncate_chars = kwargs.pop('truncate_chars', 10)
64
        super(TruncatedLinkColumn, self).__init__(*args, **kwargs)
65

  
66

  
67
    def render_link(self, uri, text, attrs=None):
68
        text = truncatename(text, self.truncate_chars)
69
        return super(TruncatedLinkColumn, self).render_link(uri, text, attrs)
70

  
71

  
59 72
# Helper columns
60 73
class RichLinkColumn(tables.TemplateColumn):
61 74

  
......
213 226
class UserProjectApplicationsTable(UserTable):
214 227
    caption = _('My projects')
215 228

  
216
    name = tables.LinkColumn('astakos.im.views.project_detail', args=(A('pk'),))
229
    name = TruncatedLinkColumn('astakos.im.views.project_detail',
230
                                                truncate_chars=25,
231
                                                args=(A('pk'),))
217 232
    issue_date = tables.DateColumn(format=DEFAULT_DATE_FORMAT)
218 233
    start_date = tables.DateColumn(format=DEFAULT_DATE_FORMAT)
219 234
    end_date = tables.DateColumn(format=DEFAULT_DATE_FORMAT)

Also available in: Unified diff