Browse Source

fix for image caching

Juan Carlos 4 years ago
parent
commit
9933dda8c4

BIN
marktplatz/static/css/.DS_Store


+ 2 - 2
marktplatz/templates/marktplatz/file_upload.html

@@ -17,7 +17,7 @@
 
     {% for pic in images %}
     <tr class=""   >
-        <td  scope="col"><img src="{{pic.image_small.url}}"  width="50" height="50" alt="{{ pic.name_for }}"> </td>
+        <td  scope="col"><img src="{{  pic.image_small.url  }}?v={{ pic.pk }}"  width="50" height="50" alt="{{ pic.name_for }}"> </td>
         <td  scope="col">    {{pic.name_for }} </td>
         <td scope="col"> <a href="{% url 'delete-media' pk=pic.pk %}"><button  type="button" class="btn btn-default"><i class="fas fa-trash-alt"></i> Löschen</button> </a> </td>
 
@@ -25,7 +25,7 @@
     {% endfor %}
       {% for pic in video %}
     <tr class=""   >
-        <td  scope="col"><img src="{{pic.image.url}}"  width="50" height="50" alt="Video: {{ pic.name_for }}"> </td>
+        <td  scope="col"><img src="{{pic.image.url}}?v={{ pic.pk }}"  width="50" height="50" alt="Video: {{ pic.name_for }}"> </td>
         <td  scope="col">    {{pic.name_for }} </td>
 
         <td scope="col" > <a href="{% url 'delete-video' pk=pic.pk %}"><button  type="button" class="btn btn-default"><i class="fas fa-trash-alt"></i> Löschen</button> </a></td>

+ 2 - 2
marktplatz/templates/marktplatz/media_overview.html

@@ -15,7 +15,7 @@
 
     {% for pic in media %}
     <tr class=""   >
-        <td  scope="col"><img src="{{pic.image_small.url}}"  width="50" height="50" alt="{{ pic.name_for }}"> </td>
+        <td  scope="col"><img src="{{pic.image_small.url}}?v={{ pic.pk }}"  width="50" height="50" alt="{{ pic.name_for }}"> </td>
         <td  scope="col">    {{pic.name_for }} </td>
         <td scope="col"> <a href="{% url 'delete-media' pk=pic.pk %}"><button  type="button" class="btn btn-default"><i class="fas fa-trash-alt"></i> Löschen</button> </a> </td>
 
@@ -23,7 +23,7 @@
     {% endfor %}
       {% for pic in video %}
     <tr class=""   >
-        <td  scope="col"><img src="{{pic.image.url}}"  width="50" height="50" alt="Video: {{ pic.name_for }}"> </td>
+        <td  scope="col"><img src="{{pic.image.url}}?v={{ pic.pk }}"  width="50" height="50" alt="Video: {{ pic.name_for }}"> </td>
         <td  scope="col">    {{pic.name_for }} </td>
 
         <td scope="col" > <a href="{% url 'delete-video' pk=pic.pk %}"><button  type="button" class="btn btn-default"><i class="fas fa-trash-alt"></i> Löschen</button> </a></td>

+ 1 - 1
marktplatz/templates/marktplatz/myProducts.html

@@ -42,7 +42,7 @@
     {% for product in object_list %}
     <div class="row proj-{{ product.pk }}" id="proj-id-{{ product.pk }}">
         <!-- image -->
-        <div class="col-sm-1"><img src="{{product.media_set.first.image_small.url}}"  width="50" height="50" alt="{{ product.pk }}"></div>
+        <div class="col-sm-1"><img src="{{product.media_set.first.image_small.url}}?v={{ product.media_set.first.pk }}"  width="50" height="50" alt="{{ product.pk }}"></div>
         <!-- titel -->
         <div class="col-sm-4"><a href="{% url 'product-detail-type' type=product.type pk=product.pk  %}">   {{ product.name }} </a></div>
         <div class="col-sm-3">{% if product.edit %} <a href="{% url 'projekt-bearbeiten-type' type=product.type pk=product.pk %}"> Projekt bearbeiten</a> <br> <a href="{% url 'add-image' product.pk %}"> Media bearbeiten </a> {% else %} Es kann nicht bearbeitet werden {% endif %} </div>

+ 3 - 4
marktplatz/templates/marktplatz/product_detail.html

@@ -169,7 +169,7 @@
 							{% if not forloop.first %}
 								{% if forloop.counter < 6  %}
 									<div class="image-detail" style="flex: {% get_ratio media %}; ">
-										<img href="{{media.image_big.url}}" src="{{media.image_norm.url }}" class="gallery img-fluid img-responsive"  alt="" style="width: 100%;height: auto;vertical-align: middle;">
+										<img href="{{media.image_big.url}}" src="{{ media.image_norm.url }}?v={{ media.pk }}" class="gallery img-fluid img-responsive"  alt="" style="width: 100%;height: auto;vertical-align: middle;">
 									</div>
 								{% endif %}
 							{% endif %}
@@ -188,10 +188,9 @@
 
 
 					<div class="image-detail" style="">
-						<img href="{{object.media_set.first.image_big.url}}"  src="{{object.media_set.first.image_norm.url }}" class="gallery img-fluid img-responsive"  alt="" style="width: 100%;height: auto;vertical-align: middle;">
+						<img href="{{object.media_set.first.image_big.url}}"  src="{{ object.media_set.first.image_norm.url }}?v={{ object.media_set.first.pk }}" class="gallery img-fluid img-responsive"  alt="" style="width: 100%;height: auto;vertical-align: middle;">
 					</div>
 
-
 					<br />
 					<h5 class=" mediumkur">Kontakt</h5>
 					<br />
@@ -321,7 +320,7 @@
 						{% for media in object.media_set.all %}
 							{% if forloop.counter > 5  %}
 								<div style="flex: {% get_ratio media %}; margin:40px 60px 40px 0px;">
-									<img href="{{media.image_big.url}}"  src="{{media.image_norm.url }}" class="gallery img-fluid img-responsive"  alt="" style="width: 100%;height: auto;vertical-align: middle;">
+									<img href="{{media.image_big.url}}"  src="{{  media.image_norm.url  }}?v={{  media.pk  }}" class="gallery img-fluid img-responsive"  alt="" style="width: 100%;height: auto;vertical-align: middle;">
 								</div>
 							{% endif %}
 						{% endfor %}

+ 1 - 1
marktplatz/templates/marktplatz/product_detail_card.html

@@ -46,7 +46,7 @@
 			<h2 class="titlepro" style="margin-top: 7px; font-weight: bold">{{ object.name }} </h2>
 			<p class="lead kur"> {{ object.claim }}</p>
 			<div class="image-detail" style="">
-				<img href="{{object.media_set.first.image_big.url}}" src="{{object.media_set.first.image_norm.url }}" class="gallery img-fluid img-responsive" alt="" style="width: 100%;height: auto;vertical-align: middle;">
+				<img href="{{object.media_set.first.image_big.url}}" src="{{  object.media_set.first.image_norm.url }}?v={{ object.media_set.first.pk }}" class="gallery img-fluid img-responsive" alt="" style="width: 100%;height: auto;vertical-align: middle;">
 			</div>
 			<br />
 			<h5 class=" mediumkur">Kontakt</h5>

+ 1 - 1
marktplatz/templates/marktplatz/product_list.html

@@ -36,7 +36,7 @@
 
 
   <div class="row">
-    <div class="col-sm-2"><img src="{{product.media_set.first.image_small.url}}" width="50" height="50" alt="{{ product.pk }}"> </div>
+    <div class="col-sm-2"><img src="{{  product.media_set.first.image_small.url  }}?v={{ product.media_set.first.pk }}" width="50" height="50" alt="{{ product.pk }}"> </div>
     <div class="col-sm-2"><a href="{% url 'product-detail-type' type=product.type pk=product.pk  %}"> {{product.name|upper }} </a></div>
     <div class="col-sm-2"> <span>{{product.claim }}</span></div>
     <div class="col-sm-2"> <span>{{product.get_status_display }}</span></div>

+ 1 - 1
marktplatz/templates/marktplatz/product_overview.html

@@ -352,7 +352,7 @@ $(document).ready(function(){
             <a href="{% url 'product-detail-type' type=product.type pk=product.pk  %}">
               <div style="position: relative;text-align: center;">
                 <img class="{% for category in product.category.all %} {{category.short_name}} {% endfor %} card-img-top" data-otherclass="rounded-0"
-                  src="{{product.media_set.first.image_norm.url}}" alt="image" loading="lazy">
+                  src="{{product.media_set.first.image_norm.url}}?v={{ product.media_set.first.pk }}" alt="image" loading="lazy">
                 <div class="mab-product-title" style=""><span>{{product.name }}</span></div>
 
                 {% if product.frei == 'JAJA' %} <div class="mab-product-button" style="">

+ 0 - 3
marktplatz/views.py

@@ -696,15 +696,12 @@ class EnergyProjektProjektDetailView(ProduktDetailView):
     model = EnergyProjekt
     template_name = 'marktplatz/product_detail.html'
 
-
-
 class ProduktCardDetailView(ProduktDetailView):
 
     template_name = 'marktplatz/product_detail_card.html'
 
 
 
-
 #
 #
 # CREATE CREATE CREATE CREATE CREATE CREATE CREATE CREATE CREATE