Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ArticlegroupTable(tables.Table):
- artg_name = LinkIfAuthorizedColumn(
- 'ArticlegroupUpdate',
- args=["popup", A('pk')],
- edit_perm="articles.maintenance",
- )
- class ArticlegroupTable(tables.Table):
- artg_name = LinkIfAuthorizedColumn(
- 'ArticlegroupUpdate',
- args=[A('popup'), A('pk')],
- edit_perm="articles.maintenance",
- )
- def get_context_data(self, ** kwargs):
- # get context data to be passed to the respective templates
- context = super(ArticlegroupSearch, self).get_context_data(**kwargs)
- data = self.get_queryset()
- table = ArticlegroupTable(data, self.request)
- RequestConfig(self.request, paginate={
- "per_page": 5,
- }).configure(table)
- context.update({'table': table})
- if 'popup' in self.kwargs:
- context.update({'popup': self.kwargs['popup']})
- return context
- class ArticlegroupTable(tables.Table):
- def __init__(self, *args, **kwargs):
- if kwargs.pop("popup", False):
- for column in self.base_columns.values():
- if isinstance(column, tables.LinkColumn):
- column.args.insert(0, "popup")
- super(Table, self).__init__(*args, **kwargs)
- # …
- def get_context_data(self, ** kwargs):
- # get context data to be passed to the respective templates
- context = super(ArticlegroupSearch, self).get_context_data(**kwargs)
- data = self.get_queryset()
- popup = self.kwargs.get('popup')
- table = ArticlegroupTable(data, self.request, popup=popup)
- RequestConfig(self.request, paginate={
- "per_page": 5,
- }).configure(table)
- context.update({'table': table, 'popup': popup})
- return context
Add Comment
Please, Sign In to add comment