File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 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>
4242 < table class ="files "> </ table >
4343 < div class ="fileupload-progressbar "> </ div >
4444 </ 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 >
4568</ div >
4669<!-- modal-gallery is the modal dialog used for the image gallery -->
4770< 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):
2424 response ['Content-Disposition' ] = 'inline; filename=files.json'
2525 return response
2626
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+
2732
2833class PictureDeleteView (DeleteView ):
2934 model = Picture
You can’t perform that action at this time.
0 commit comments