mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 03:25:42 +00:00
Add modal form for creating a new currency
This commit is contained in:
24
InvenTree/common/forms.py
Normal file
24
InvenTree/common/forms.py
Normal 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
InvenTree/common/urls.py
Normal file
15
InvenTree/common/urls.py
Normal 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)),
|
||||
]
|
@ -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'
|
||||
|
Reference in New Issue
Block a user