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