mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-23 00:01:16 +00:00
Addition of the StockItem class
addition of Stock app, model, templates, urls Addition of the stock parameter to the counter admin list Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Stock application creation Addition of the StockItem class addition of Stock app, model, templates, urls Addition of the stock parameter to the counter admin list Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Initial StockItem create form value addition general modifications Stock admin gestion, items list views, create and edit items remove stock_main.jinja Stock application creation Addition of the StockItem class addition of Stock app, model, templates, urls Addition of the stock parameter to the counter admin list Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Addition of the StockItem class addition of Stock app, model, templates, urls Addition of the stock parameter to the counter admin list Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Initial StockItem create form value addition general modifications Stock admin gestion, items list views, create and edit items Shopping list structure view addition correct missing endif a correct missing endif Stock application creation addition of Stock app, model, templates, urls Addition of the stock parameter to the counter admin list Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Stock application creation addition of Stock app, model, templates, urls Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Initial StockItem create form value addition general modifications Stock admin gestion, items list views, create and edit items remove stock_main.jinja Stock application creation addition of Stock app, model, templates, urls Addition of the stock parameter to the counter admin list Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Fix translation files Creation of the Stock list, edit, create views and creation StockItem create view Initial StockItem create form value addition general modifications Shopping list structure view addition correct missing endif
This commit is contained in:
parent
c6310c5315
commit
75af525945
@ -46,6 +46,45 @@ class StockEditForm(forms.ModelForm):
|
||||
return super(StockEditForm, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
class StockEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
||||
"""
|
||||
An edit view for the stock
|
||||
"""
|
||||
model = Stock
|
||||
form_class = StockEditForm
|
||||
pk_url_kwarg = "stock_id"
|
||||
current_tab = "stocks"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(StockItemList, self).get_context_data(**kwargs)
|
||||
if 'stock' in self.request.GET.keys():
|
||||
context['stock'] = Stock.objects.filter(id=self.request.GET['stock']).first()
|
||||
return context
|
||||
|
||||
class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
||||
"""
|
||||
A list view for the admins
|
||||
"""
|
||||
model = Stock
|
||||
template_name = 'stock/stock_list.jinja'
|
||||
current_tab = "stocks"
|
||||
|
||||
|
||||
class StockEditForm(forms.ModelForm):
|
||||
"""
|
||||
A form to change stock's characteristics
|
||||
"""
|
||||
class Meta:
|
||||
model = Stock
|
||||
fields = ['name', 'counter']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(StockEditForm, self).__init__(*args, **kwargs)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(StockEditForm, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
class StockEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
||||
"""
|
||||
An edit view for the stock
|
||||
@ -119,3 +158,8 @@ class StockShoppingListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
||||
if 'stock_id' in self.kwargs.keys():
|
||||
ret['stock'] = Stock.objects.filter(id=self.kwargs['stock_id']).first();
|
||||
return ret
|
||||
|
||||
class StockItemOutEditView(CounterAdminTabsMixin, CanViewMixin, UpdateView):
|
||||
"""
|
||||
docstring for StockItemOutList
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user