SHARE
TWEET

Untitled

a guest Jan 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ArticlegroupTable(tables.Table):
  2.  
  3.     artg_name = LinkIfAuthorizedColumn(
  4.         'ArticlegroupUpdate',
  5.         args=["popup", A('pk')],
  6.         edit_perm="articles.maintenance",
  7.     )
  8.    
  9. class ArticlegroupTable(tables.Table):
  10.  
  11. artg_name = LinkIfAuthorizedColumn(
  12.     'ArticlegroupUpdate',
  13.     args=[A('popup'), A('pk')],
  14.     edit_perm="articles.maintenance",
  15. )
  16.    
  17. def get_context_data(self, ** kwargs):
  18.     # get context data to be passed to the respective templates
  19.     context = super(ArticlegroupSearch, self).get_context_data(**kwargs)
  20.     data = self.get_queryset()
  21.     table = ArticlegroupTable(data, self.request)
  22.     RequestConfig(self.request, paginate={
  23.         "per_page": 5,
  24.         }).configure(table)
  25.     context.update({'table': table})
  26.     if 'popup' in self.kwargs:
  27.         context.update({'popup': self.kwargs['popup']})
  28.     return context
  29.    
  30. class ArticlegroupTable(tables.Table):
  31.     def __init__(self, *args, **kwargs):
  32.         if kwargs.pop("popup", False):
  33.             for column in self.base_columns.values():
  34.                 if isinstance(column, tables.LinkColumn):
  35.                     column.args.insert(0, "popup")
  36.         super(Table, self).__init__(*args, **kwargs)
  37.  
  38.     # …
  39.    
  40. def get_context_data(self, ** kwargs):
  41.     # get context data to be passed to the respective templates
  42.     context = super(ArticlegroupSearch, self).get_context_data(**kwargs)
  43.     data = self.get_queryset()
  44.     popup = self.kwargs.get('popup')
  45.     table = ArticlegroupTable(data, self.request, popup=popup)
  46.     RequestConfig(self.request, paginate={
  47.         "per_page": 5,
  48.         }).configure(table)
  49.     context.update({'table': table, 'popup': popup})
  50.     return context
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top