|
|
@ -7,7 +7,8 @@ from django.utils.translation import ugettext_lazy as _
|
|
|
|
from django.urls import reverse_lazy
|
|
|
|
from django.urls import reverse_lazy
|
|
|
|
|
|
|
|
|
|
|
|
from common.mixins import AdminUserRequiredMixin
|
|
|
|
from common.mixins import AdminUserRequiredMixin
|
|
|
|
from common.const import create_success_msg
|
|
|
|
from common.const import create_success_msg, update_success_msg
|
|
|
|
|
|
|
|
from ..models import Label
|
|
|
|
from ..forms import LabelForm
|
|
|
|
from ..forms import LabelForm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -30,6 +31,7 @@ class LabelListView(AdminUserRequiredMixin, TemplateView):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LabelCreateView(AdminUserRequiredMixin, CreateView):
|
|
|
|
class LabelCreateView(AdminUserRequiredMixin, CreateView):
|
|
|
|
|
|
|
|
model = Label
|
|
|
|
template_name = 'assets/label_create_update.html'
|
|
|
|
template_name = 'assets/label_create_update.html'
|
|
|
|
form_class = LabelForm
|
|
|
|
form_class = LabelForm
|
|
|
|
success_url = reverse_lazy('assets:label-list')
|
|
|
|
success_url = reverse_lazy('assets:label-list')
|
|
|
@ -45,7 +47,19 @@ class LabelCreateView(AdminUserRequiredMixin, CreateView):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LabelUpdateView(AdminUserRequiredMixin, UpdateView):
|
|
|
|
class LabelUpdateView(AdminUserRequiredMixin, UpdateView):
|
|
|
|
pass
|
|
|
|
model = Label
|
|
|
|
|
|
|
|
template_name = 'assets/label_create_update.html'
|
|
|
|
|
|
|
|
form_class = LabelForm
|
|
|
|
|
|
|
|
success_url = reverse_lazy('assets:label-list')
|
|
|
|
|
|
|
|
success_message = update_success_msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
|
|
|
|
context = {
|
|
|
|
|
|
|
|
'app': _('Assets'),
|
|
|
|
|
|
|
|
'action': _('Update label'),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
kwargs.update(context)
|
|
|
|
|
|
|
|
return super().get_context_data(**kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LabelDetailView(AdminUserRequiredMixin, DetailView):
|
|
|
|
class LabelDetailView(AdminUserRequiredMixin, DetailView):
|
|
|
|