Add product management views

This commit is contained in:
Skia
2016-07-27 17:23:02 +02:00
parent 4408890ab2
commit f230fbc135
12 changed files with 98 additions and 10 deletions

View File

@ -351,6 +351,33 @@ class CounterDeleteView(CanEditMixin, DeleteView):
template_name = 'core/delete_confirm.jinja'
success_url = reverse_lazy('counter:admin_list')
# Product management
class ProductListView(ListView):
"""
A list view for the admins
"""
model = Product
template_name = 'counter/product_list.jinja'
class ProductCreateView(CreateView):
"""
A create view for the admins
"""
model = Product
template_name = 'core/edit.jinja'
class ProductEditView(UpdateView):
"""
An edit view for the admins
"""
model = Product
form_class = modelform_factory(Product, fields=['name', 'description', 'product_type', 'code', 'purchase_price',
'selling_price', 'special_selling_price', 'icon', 'club'])
pk_url_kwarg = "product_id"
template_name = 'core/edit.jinja'
# TODO: add management of the 'counters' ForeignKey
# User accounting infos
class UserAccountView(DetailView):