File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,29 @@ <h1>Django Jquery file upload demo</h1>
42
42
< table class ="files "> </ table >
43
43
< div class ="fileupload-progressbar "> </ div >
44
44
</ div >
45
+
46
+ < div >
47
+ {% if pictures %}
48
+ < h2 > Already uploaded</ h2 >
49
+ < table class ="table table-striped ">
50
+ {% for picture in pictures %}
51
+ < tr >
52
+ < td class ="preview ">
53
+ < img src ="{{ picture.file.url }} ">
54
+ </ td >
55
+ < td class ="name "> {{ picture.slug }}</ td >
56
+ < td class ="delete ">
57
+ < a class ="btn btn-danger " href ="{% url 'upload-delete' picture.id %} ">
58
+ < i class ="icon-trash icon-white "> </ i >
59
+ < span > Delete</ span >
60
+ </ button >
61
+ </ td >
62
+ </ tr >
63
+ {% endfor %}
64
+ </ table >
65
+ < p > (Removing from this list is left as an exercise to the reader)</ p >
66
+ {% endif %}
67
+ </ div >
45
68
</ div >
46
69
<!-- modal-gallery is the modal dialog used for the image gallery -->
47
70
< div id ="modal-gallery " class ="modal modal-gallery hide fade " data-filter =":odd ">
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ def form_valid(self, form):
24
24
response ['Content-Disposition' ] = 'inline; filename=files.json'
25
25
return response
26
26
27
+ def get_context_data (self , ** kwargs ):
28
+ context = super (PictureCreateView , self ).get_context_data (** kwargs )
29
+ context ['pictures' ] = Picture .objects .all ()
30
+ return context
31
+
27
32
28
33
class PictureDeleteView (DeleteView ):
29
34
model = Picture
You can’t perform that action at this time.
0 commit comments