mirror of
https://github.com/nanoy42/coope
synced 2024-12-23 15:33:45 +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" %}
|
||||
{% block entete %}Gestion des produits{% endblock %}
|
||||
{% block entete %}Gestion des produits : Profil de {{product}}{% endblock %}
|
||||
{% block navbar %}
|
||||
<ul>
|
||||
<li><a href="#first">Général</a></li>
|
||||
|
@ -10,7 +10,8 @@
|
|||
<header class="major">
|
||||
<h2>Général</h2>
|
||||
</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>Prix de vente</strong> : {{ product.amount }}€<br>
|
||||
<strong>Stock en soute</strong> : {{ product.stockHold }}<br>
|
||||
|
|
|
@ -300,9 +300,9 @@ def addProduct(request):
|
|||
"""
|
||||
form = ProductForm(request.POST or None)
|
||||
if(form.is_valid()):
|
||||
form.save()
|
||||
product = form.save()
|
||||
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"})
|
||||
|
||||
@active_required
|
||||
|
@ -335,7 +335,7 @@ def editProduct(request, pk):
|
|||
if(form.is_valid()):
|
||||
form.save()
|
||||
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"})
|
||||
|
||||
@active_required
|
||||
|
@ -433,7 +433,7 @@ def switch_activate(request, pk):
|
|||
product.is_active = 1 - product.is_active
|
||||
product.save()
|
||||
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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue