mirror of
https://github.com/nanoy42/coope
synced 2024-11-26 06:32:27 +00:00
Merge branch 'fix-retour-modification-produit' into dev
This commit is contained in:
commit
9750035fd7
2 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block entete %}Gestion des produits{% endblock %}
|
{% block entete %}Gestion des produits : Profil de {{product}}{% endblock %}
|
||||||
{% block navbar %}
|
{% block navbar %}
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#first">Général</a></li>
|
<li><a href="#first">Général</a></li>
|
||||||
|
@ -10,7 +10,8 @@
|
||||||
<header class="major">
|
<header class="major">
|
||||||
<h2>Général</h2>
|
<h2>Général</h2>
|
||||||
</header>
|
</header>
|
||||||
{% if perms.gestion.change_product %}<a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small">Modifier</a><br>{% endif %}
|
<a class="button small" href="{% url 'gestion:productsList' %}">Liste des produits</a><br><br>
|
||||||
|
{% if perms.gestion.change_product %}<a href="{% url 'gestion:switchActivate' product.pk %}" class="button small">{% if product.is_active %}Désa{% else %}A{% endif %}ctiver</a> <a href="{% url 'gestion:editProduct' product.pk %}" class="button small">Modifier</a><br>{% endif %}<br>
|
||||||
<strong>Nom</strong> : {{ product.name }}<br>
|
<strong>Nom</strong> : {{ product.name }}<br>
|
||||||
<strong>Prix de vente</strong> : {{ product.amount }}€<br>
|
<strong>Prix de vente</strong> : {{ product.amount }}€<br>
|
||||||
<strong>Stock en soute</strong> : {{ product.stockHold }}<br>
|
<strong>Stock en soute</strong> : {{ product.stockHold }}<br>
|
||||||
|
|
|
@ -300,9 +300,9 @@ def addProduct(request):
|
||||||
"""
|
"""
|
||||||
form = ProductForm(request.POST or None)
|
form = ProductForm(request.POST or None)
|
||||||
if(form.is_valid()):
|
if(form.is_valid()):
|
||||||
form.save()
|
product = form.save()
|
||||||
messages.success(request, "Le produit a bien été ajouté")
|
messages.success(request, "Le produit a bien été ajouté")
|
||||||
return redirect(reverse('gestion:productsList'))
|
return redirect(reverse('gestion:productProfile', kwargs={'pk':product.pk}))
|
||||||
return render(request, "form.html", {"form": form, "form_title": "Ajout d'un produit", "form_button": "Ajouter"})
|
return render(request, "form.html", {"form": form, "form_title": "Ajout d'un produit", "form_button": "Ajouter"})
|
||||||
|
|
||||||
@active_required
|
@active_required
|
||||||
|
@ -335,7 +335,7 @@ def editProduct(request, pk):
|
||||||
if(form.is_valid()):
|
if(form.is_valid()):
|
||||||
form.save()
|
form.save()
|
||||||
messages.success(request, "Le produit a bien été modifié")
|
messages.success(request, "Le produit a bien été modifié")
|
||||||
return redirect(reverse('gestion:productsList'))
|
return redirect(reverse('gestion:productProfile', kwargs={'pk':product.pk}))
|
||||||
return render(request, "form.html", {"form": form, "form_title": "Modification d'un produit", "form_button": "Modifier"})
|
return render(request, "form.html", {"form": form, "form_title": "Modification d'un produit", "form_button": "Modifier"})
|
||||||
|
|
||||||
@active_required
|
@active_required
|
||||||
|
@ -433,7 +433,7 @@ def switch_activate(request, pk):
|
||||||
product.is_active = 1 - product.is_active
|
product.is_active = 1 - product.is_active
|
||||||
product.save()
|
product.save()
|
||||||
messages.success(request, "La disponibilité du produit a bien été changée")
|
messages.success(request, "La disponibilité du produit a bien été changée")
|
||||||
return redirect(reverse('gestion:productsList'))
|
return redirect(reverse('gestion:productProfile', kwargs={'pk': product.pk}))
|
||||||
|
|
||||||
class ProductsAutocomplete(autocomplete.Select2QuerySetView):
|
class ProductsAutocomplete(autocomplete.Select2QuerySetView):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue