File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,11 +16,3 @@ def get_template_names(self):
1616
1717 def get_template_fields (self ):
1818 return self .template_fields
19-
20- def list (self , request ):
21- response = super (ViewSetTemplateMixin , self ).list (request )
22-
23- if request .accepted_renderer .format == 'html' :
24- response .data = {'data' : response .data ,
25- 'headers' : self .get_template_fields ()}
26- return response
Original file line number Diff line number Diff line change 1- {% extends "base.html" %}
2-
3- {% block title %}
4- Collaboration - Projects
5- {% endblock %}
6-
7- {% block content %}
81< table class ="table table-striped table-advance table-hover ">
92 < thead >
103 < tr >
158 </ tr >
169 </ thead >
1710 < tbody >
18- {% for item in data %}
11+ {% for item in items %}
1912 {{ item }}
2013 < tr >
2114 {% for header in headers %}
2417 < td >
2518 < button class ="btn btn-success btn-xs "> < i class ="fa fa-check "> </ i > </ button >
2619 < button class ="btn btn-primary btn-xs "> < i class ="fa fa-pencil "> </ i > </ button >
27- < button class ="btn btn-danger btn-xs "> < i class ="fa fa-trash-o "> </ i > </ button >
20+ < button class ="btn btn-danger btn-xs "> < i class ="fa fa-trash-o "> </ i > </ button >
2821 </ td >
2922 </ tr >
3023 {% endfor %}
3124 </ tbody >
3225</ table >
33- {% endblock %}
Original file line number Diff line number Diff line change @@ -8,3 +8,9 @@ def lookup(d, key):
88 if key not in d :
99 return None
1010 return d [key ]
11+
12+
13+ @register .inclusion_tag ('components/list.html' )
14+ def component_list (view ):
15+ return {'headers' : view .get_template_fields (),
16+ 'items' : view .Meta .Model .objects .all ()}
You can’t perform that action at this time.
0 commit comments