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,8 +22,8 @@ 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):
|
||||
"""
|
||||
@ -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,39 +67,8 @@ 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)
|
||||
|
||||
|
||||
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"
|
||||
def can_be_viewed_by(self, user):
|
||||
return user.is_in_group(settings.SITH_GROUP_COUNTER_ADMIN_ID)
|
||||
|
||||
|
||||
class StockItemEditView(CounterAdminTabsMixin, CanEditPropMixin, UpdateView):
|
||||
|
Loading…
Reference in New Issue
Block a user