mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +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"
|
||||
current_tab = "stocks"
|
||||
|
||||
#def can_be_viewed_by(self, user):
|
||||
#return user.is_in_group(settings.SITH_GROUPS['counter-admin'].id)
|
||||
|
||||
def can_be_viewed_by(self, user):
|
||||
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||
|
||||
class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
||||
"""
|
||||
A list view for the admins
|
||||
@ -33,6 +33,9 @@ class StockListView(CounterAdminTabsMixin, CanViewMixin, ListView):
|
||||
template_name = 'stock/stock_list.jinja'
|
||||
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):
|
||||
"""
|
||||
@ -64,41 +67,10 @@ class StockEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
||||
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)
|
||||
def can_be_viewed_by(self, user):
|
||||
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||
|
||||
|
||||
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):
|
||||
"""
|
||||
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()
|
||||
self.kwargs['counter_id'] = stock.counter.id
|
||||
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