|
|
@ -205,9 +205,13 @@ def get_product(request, product_id): |
|
|
|
'product_info.html', |
|
|
|
'product_info.html', |
|
|
|
{'product': product}) |
|
|
|
{'product': product}) |
|
|
|
else: |
|
|
|
else: |
|
|
|
|
|
|
|
form = ProductForm(request) |
|
|
|
|
|
|
|
if form.is_valid(): |
|
|
|
|
|
|
|
form.save() |
|
|
|
|
|
|
|
|
|
|
|
return render(request, |
|
|
|
return render(request, |
|
|
|
'invalid.html', |
|
|
|
'product_info.html', |
|
|
|
{'reason': 'Can\'t create products yet'}) |
|
|
|
{'form': form}) |
|
|
|
</code></pre> |
|
|
|
</code></pre> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|
|
|
|
|
|
|
|
@ -223,7 +227,13 @@ def get_product(request, product_id): |
|
|
|
<pre><code class="hljs"> |
|
|
|
<pre><code class="hljs"> |
|
|
|
{% extends 'base.html' %} |
|
|
|
{% extends 'base.html' %} |
|
|
|
<ul> |
|
|
|
<ul> |
|
|
|
|
|
|
|
{% if product %} |
|
|
|
<li>Product name: {{ product.name }}</li> |
|
|
|
<li>Product name: {{ product.name }}</li> |
|
|
|
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% if form %} |
|
|
|
|
|
|
|
{{ form }} |
|
|
|
|
|
|
|
{% endif %} |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</code></pre> |
|
|
|
</code></pre> |
|
|
|
|
|
|
|
|
|
|
|