Source code for shoop.admin.modules.suppliers.views.edit
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from shoop.admin.utils.views import (
check_and_raise_if_only_one_allowed, CreateOrUpdateView
)
from shoop.core.models import Supplier
[docs]class SupplierEditView(CreateOrUpdateView):
model = Supplier
form_class = SupplierForm
template_name = "shoop/admin/suppliers/edit.jinja"
context_object_name = "supplier"
[docs] def get_object(self, queryset=None):
obj = super(SupplierEditView, self).get_object(queryset)
check_and_raise_if_only_one_allowed("SHOOP_ENABLE_MULTIPLE_SUPPLIERS", obj)
return obj