diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index bb400af615..d811c0165e 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -14,6 +14,7 @@ from company.urls import company_urls from company.urls import supplier_part_urls from company.urls import price_break_urls +from common.urls import common_urls from part.urls import part_urls from stock.urls import stock_urls from build.urls import build_urls @@ -70,6 +71,8 @@ urlpatterns = [ url(r'^supplier-part/', include(supplier_part_urls)), url(r'^price-break/', include(price_break_urls)), + url(r'^common/', include(common_urls)), + url(r'^stock/', include(stock_urls)), url(r'^company/', include(company_urls)), diff --git a/InvenTree/common/forms.py b/InvenTree/common/forms.py new file mode 100644 index 0000000000..00e6c15c7f --- /dev/null +++ b/InvenTree/common/forms.py @@ -0,0 +1,24 @@ +""" +Django forms for interacting with common objects +""" + +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from InvenTree.forms import HelperForm + +from .models import Currency + + +class CurrencyEditForm(HelperForm): + """ Form for creating / editing a currency object """ + + class Meta: + model = Currency + fields = [ + 'symbol', + 'suffix', + 'description', + 'value', + 'base' + ] diff --git a/InvenTree/common/urls.py b/InvenTree/common/urls.py new file mode 100644 index 0000000000..648e65b919 --- /dev/null +++ b/InvenTree/common/urls.py @@ -0,0 +1,15 @@ +""" +URL lookup for common views +""" + +from django.conf.urls import url, include + +from . import views + +currency_urls = [ + url(r'^new/', views.CurrencyCreate.as_view(), name='currency-create'), +] + +common_urls = [ + url(r'currency/', include(currency_urls)), +] diff --git a/InvenTree/common/views.py b/InvenTree/common/views.py index 60f00ef0ef..ee1164006e 100644 --- a/InvenTree/common/views.py +++ b/InvenTree/common/views.py @@ -1 +1,19 @@ -# Create your views here. +""" +Django views for interacting with common models +""" + +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from InvenTree.views import AjaxCreateView + +from .models import Currency +from .forms import CurrencyEditForm + + +class CurrencyCreate(AjaxCreateView): + """ View for creating a new Currency object """ + + model = Currency + form_class = CurrencyEditForm + ajax_form_title = 'Create new Currency' diff --git a/InvenTree/templates/InvenTree/settings/currency.html b/InvenTree/templates/InvenTree/settings/currency.html index 0fde7c5c26..e91d8456ad 100644 --- a/InvenTree/templates/InvenTree/settings/currency.html +++ b/InvenTree/templates/InvenTree/settings/currency.html @@ -8,7 +8,11 @@