2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-05-22 01:06:50 +00:00

Add modal form for creating a new currency

This commit is contained in:
Oliver Walters
2019-09-07 20:06:04 +10:00
parent 67ea0fa887
commit 31562826f4
5 changed files with 73 additions and 2 deletions
+24
View File
@@ -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'
]
+15
View File
@@ -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)),
]
+19 -1
View File
@@ -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'