mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Some classes defined twice -- correction
This commit is contained in:
parent
8f88f7cb70
commit
fa97929da8
@ -22,9 +22,9 @@ class StockItemList(CounterAdminTabsMixin, CanCreateMixin, ListView):
|
|||||||
pk_url_kwarg = "stock_id"
|
pk_url_kwarg = "stock_id"
|
||||||
current_tab = "stocks"
|
current_tab = "stocks"
|
||||||
|
|
||||||
#def can_be_viewed_by(self, user):
|
def can_be_viewed_by(self, user):
|
||||||
#return user.is_in_group(settings.SITH_GROUPS['counter-admin'].id)
|
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||||
|
|
||||||
class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
||||||
"""
|
"""
|
||||||
A list view for the admins
|
A list view for the admins
|
||||||
@ -33,6 +33,9 @@ class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
|||||||
template_name = 'stock/stock_list.jinja'
|
template_name = 'stock/stock_list.jinja'
|
||||||
current_tab = "stocks"
|
current_tab = "stocks"
|
||||||
|
|
||||||
|
def can_be_viewed_by(self, user):
|
||||||
|
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||||
|
|
||||||
|
|
||||||
class StockEditForm(forms.ModelForm):
|
class StockEditForm(forms.ModelForm):
|
||||||
"""
|
"""
|
||||||
@ -64,41 +67,10 @@ class StockEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
|||||||
context['stock'] = Stock.objects.filter(id=self.request.GET['stock']).first()
|
context['stock'] = Stock.objects.filter(id=self.request.GET['stock']).first()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
def can_be_viewed_by(self, user):
|
||||||
"""
|
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||||
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
|
|
||||||
"""
|
|
||||||
model = Stock
|
|
||||||
form_class = StockEditForm
|
|
||||||
pk_url_kwarg = "stock_id"
|
|
||||||
template_name = 'core/edit.jinja'
|
|
||||||
current_tab = "stocks"
|
|
||||||
|
|
||||||
|
|
||||||
class StockItemEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
class StockItemEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
||||||
"""
|
"""
|
||||||
An edit view for a stock item
|
An edit view for a stock item
|
||||||
@ -432,4 +404,4 @@ class StockTakeItemsBaseFormView(CounterTabsMixin, CanEditMixin, DetailView, Bas
|
|||||||
stock = Stock.objects.filter(id=self.kwargs['stock_id']).first()
|
stock = Stock.objects.filter(id=self.kwargs['stock_id']).first()
|
||||||
self.kwargs['counter_id'] = stock.counter.id
|
self.kwargs['counter_id'] = stock.counter.id
|
||||||
self.kwargs.pop('stock_id', None)
|
self.kwargs.pop('stock_id', None)
|
||||||
return reverse_lazy('counter:details', args=self.args, kwargs=self.kwargs)
|
return reverse_lazy('counter:details', args=self.args, kwargs=self.kwargs)
|
Loading…
Reference in New Issue
Block a user