fix media setup to deliver content
parent
1d91c5da38
commit
eea3d117bc
|
|
@ -0,0 +1 @@
|
|||
*
|
||||
|
|
@ -120,6 +120,9 @@ USE_TZ = True
|
|||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = 'static/'
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = '/app/media/'
|
||||
|
||||
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000
|
||||
|
||||
LOGGING = {
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ from django.conf.urls.static import static
|
|||
urlpatterns = [
|
||||
url(r'^parts/', include('parts.urls'), name="parts"),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Sketch(PartModel):
|
|||
image = models.FileField(upload_to="sketches/", blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return "Sketch: " + self.name + " (" + str(self.brand) + ")"
|
||||
return "Sketch: " + self.name + " (" + str(self.product) + ")"
|
||||
|
||||
def get_product(self):
|
||||
if self.product:
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
{% endfor %}
|
||||
|
||||
<tr>
|
||||
<td>Summe:</td>
|
||||
<td>Summe Teile:</td>
|
||||
<td>{{len}}</td>
|
||||
{% for product in product_sums %}
|
||||
<td>{{product}}</td>
|
||||
{% endfor %}
|
||||
<td>Teile</td>
|
||||
<td>{{total_sum}}</td>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<h1>{{sketch.name}}</h1>
|
||||
<a href="{{sketch.image.url}}"><img src="{{sketch.image.url}}" /></a>
|
||||
<h2>{% for brand in sketch.get_brand %}{{brand.name}},{% endfor%} - {% for product in sketch.get_product %}{{product.name}},{% endfor%}</h2>
|
||||
<ul>
|
||||
{% for usage in sketch.usage_set.all %}
|
||||
|
|
|
|||
|
|
@ -63,13 +63,15 @@ def parts(request):
|
|||
"sum": sum(prod_qtys),
|
||||
"id": part.id,
|
||||
})
|
||||
|
||||
|
||||
product_sum = [product_sums[prod.name] for prod in products]
|
||||
context = {
|
||||
'products': products,
|
||||
'parts': parts,
|
||||
'quantities': quantities,
|
||||
'len': len(quantities),
|
||||
'product_sums': [product_sums[prod.name] for prod in products]
|
||||
'product_sums': product_sum,
|
||||
'total_sum': sum(product_sum),
|
||||
}
|
||||
return render(request, 'parts/parts.html', context)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue