File tree 3 files changed +8
-18
lines changed
3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,3 @@ def get_template_names(self):
16
16
17
17
def get_template_fields (self ):
18
18
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 %}
8
1
< table class ="table table-striped table-advance table-hover ">
9
2
< thead >
10
3
< tr >
15
8
</ tr >
16
9
</ thead >
17
10
< tbody >
18
- {% for item in data %}
11
+ {% for item in items %}
19
12
{{ item }}
20
13
< tr >
21
14
{% for header in headers %}
24
17
< td >
25
18
< button class ="btn btn-success btn-xs "> < i class ="fa fa-check "> </ i > </ button >
26
19
< 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 >
28
21
</ td >
29
22
</ tr >
30
23
{% endfor %}
31
24
</ tbody >
32
25
</ table >
33
- {% endblock %}
Original file line number Diff line number Diff line change @@ -8,3 +8,9 @@ def lookup(d, key):
8
8
if key not in d :
9
9
return None
10
10
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