0001-WIP-configure-displayed-columns-22470.patch
fargo/fargo/tables.py | ||
---|---|---|
1 |
from django.conf import settings |
|
1 | 2 |
from django.utils.translation import ugettext_lazy as _ |
2 | 3 | |
3 | 4 |
import django_tables2 as tables |
... | ... | |
12 | 13 |
verbose_name=_('size').title()) |
13 | 14 |
created = tables.DateTimeColumn(verbose_name=_('creation date').title()) |
14 | 15 | |
16 |
def __init__(self, data, *args, **kwargs): |
|
17 |
super(DocumentTable, self).__init__(data, *args, **kwargs) |
|
18 | ||
19 |
for column in settings.FARGO_TABLE_COLUMNS: |
|
20 |
if not hasattr(self, column) and hasattr(self.Meta.model, column): |
|
21 |
setattr(self, column, tables.Column(verbose_name=column.title())) |
|
22 | ||
15 | 23 |
class Meta: |
16 | 24 |
model = models.Document |
17 |
fields = ('size', 'created')
|
|
25 |
fields = settings.FARGO_TABLE_COLUMNS
|
|
18 | 26 |
empty_text = _('You currently have no documents') |
fargo/settings.py | ||
---|---|---|
155 | 155 | |
156 | 156 |
FARGO_VALIDATION_LIFETIME = 3600 * 24 * 31 * 6 # nearly 6 months |
157 | 157 | |
158 |
FARGO_TABLE_COLUMNS = ('size', 'creation_date', 'filename') |
|
159 | ||
158 | 160 |
FARGO_DOCUMENT_TYPES = [ |
159 | 161 |
{ |
160 | 162 |
'name': 'avis-d-imposition', |
161 |
- |