[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-codeless] branch master updated: changed price field
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-codeless] branch master updated: changed price field to decimal |
Date: |
Mon, 06 Aug 2018 05:59:57 +0200 |
This is an automated email from the git hooks/post-receive script.
shivam-kohli pushed a commit to branch master
in repository codeless.
The following commit(s) were added to refs/heads/master by this push:
new 197a147 changed price field to decimal
197a147 is described below
commit 197a147ebabf0d32b66df1779877504de6051b9a
Author: shivam kohli <address@hidden>
AuthorDate: Mon Aug 6 09:29:40 2018 +0530
changed price field to decimal
---
inventory/migrations/0003_auto_20180806_0342.py | 19 +++++++++++++++++++
inventory/migrations/0004_auto_20180806_0356.py | 19 +++++++++++++++++++
inventory/models.py | 2 +-
inventory/views.py | 4 ++--
templates/inventory/new_product.html | 2 +-
5 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/inventory/migrations/0003_auto_20180806_0342.py
b/inventory/migrations/0003_auto_20180806_0342.py
new file mode 100644
index 0000000..b703c08
--- /dev/null
+++ b/inventory/migrations/0003_auto_20180806_0342.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('inventory', '0002_merchant_website'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='product',
+ name='price',
+ field=models.IntegerField(blank=True, null=True),
+ ),
+ ]
diff --git a/inventory/migrations/0004_auto_20180806_0356.py
b/inventory/migrations/0004_auto_20180806_0356.py
new file mode 100644
index 0000000..9c0a639
--- /dev/null
+++ b/inventory/migrations/0004_auto_20180806_0356.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('inventory', '0003_auto_20180806_0342'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='product',
+ name='price',
+ field=models.DecimalField(null=True, max_digits=50,
decimal_places=5),
+ ),
+ ]
diff --git a/inventory/models.py b/inventory/models.py
index a65142c..c405c3e 100644
--- a/inventory/models.py
+++ b/inventory/models.py
@@ -47,7 +47,7 @@ class Product(models.Model):
product_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=50, blank=True, null=True)
description = models.CharField(max_length=300, blank=True, null=True)
- price = models.CharField(max_length=50, blank=True, null=True)
+ price = models.DecimalField(max_digits=50, decimal_places=5, null=True)
delivery_date = models.DateTimeField(auto_now=True)
starting_inventory = models.IntegerField(blank=True, null=True)
minimum_required = models.IntegerField(blank=True, null=True)
diff --git a/inventory/views.py b/inventory/views.py
index 97b63b6..958913e 100644
--- a/inventory/views.py
+++ b/inventory/views.py
@@ -403,7 +403,7 @@ def add_product(request):
description = request.POST.get('description')
product_instance.description = description
price = request.POST.get('price')
- product_instance.price = price
+ product_instance.price = float(price)
starting_inventory = request.POST.get('starting_inventory')
product_instance.starting_inventory = starting_inventory
product_instance.inventory_on_hand = starting_inventory
@@ -432,7 +432,7 @@ def product(request, uid):
context_dict['url_update_inventory'] = url_update_inventory
base_url = request.build_absolute_uri().rsplit('/', 3)[0]
merchant = request.user.username
- parameters = "name="+item.name+'&price='+item.price+'&merchant='+merchant
+ parameters =
"name="+item.name+'&price='+str(item.price)+'&merchant='+merchant
if item.document:
context_dict['href'] = base_url+"/payment?"+parameters
context_dict['digital'] = 'True'
diff --git a/templates/inventory/new_product.html
b/templates/inventory/new_product.html
index c50aaa1..3bba0c6 100644
--- a/templates/inventory/new_product.html
+++ b/templates/inventory/new_product.html
@@ -40,7 +40,7 @@ with the Taler Codeless Merchant. If not, see
<https://www.gnu.org/licenses/>.
<input type="text" name="description" id="description"
required></input>
<label for="price" class="tooltip">Price<font size="1"><span
class="tooltiptext">Enter the price of the product. Remeber to write price in
English texts. For Example 100 or 99.95</span></font></label>
- <input type="text" name="price" id="price" required>
+ <input type="number" name="price" id="price"min="0" value="0"
step="0.01" title="Currency" pattern="^\d+(?:\.\d{1,2})?$" required>
<label for="starting_inventory" class="tooltip">Starting
Inventory<font size="1"><span class="tooltiptext">Enter the number of Inventory
initially available for the given product</span></font></label>
<input type="number" name="starting_inventory"
id="starting_inventory" required>
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-codeless] branch master updated: changed price field to decimal,
gnunet <=