[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-codeless] branch master updated: added licence heade
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-codeless] branch master updated: added licence header and digital inventory |
Date: |
Thu, 05 Jul 2018 01:13:39 +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 1cfc3be added licence header and digital inventory
1cfc3be is described below
commit 1cfc3be3bc7d089f2e01f6e4546476efd455f601
Author: shivam kohli <address@hidden>
AuthorDate: Thu Jul 5 04:43:22 2018 +0530
added licence header and digital inventory
---
.gitignore | 1 +
codeless/settings.py | 7 +++
codeless/urls.py | 6 +++
inventory/forms.py | 27 ++++++++++-
inventory/migrations/0001_initial.py | 62 ++++++++++++++-----------
inventory/migrations/0002_auto_20180607_1714.py | 29 ------------
inventory/models.py | 20 ++++++++
inventory/views.py | 45 +++++++++++++++++-
templates/inventory/fulfillment.html | 19 ++++++++
templates/inventory/home.html | 19 ++++++++
templates/inventory/index.html | 19 ++++++++
templates/inventory/login.html | 19 ++++++++
templates/inventory/new_product.html | 31 +++++++++++++
templates/inventory/product.html | 19 ++++++++
templates/inventory/signup.html | 19 ++++++++
15 files changed, 282 insertions(+), 60 deletions(-)
diff --git a/.gitignore b/.gitignore
index abee8ed..08b6f47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ config.status
configure
install-sh
missing
+media/
diff --git a/codeless/settings.py b/codeless/settings.py
index 9be921d..cc60008 100644
--- a/codeless/settings.py
+++ b/codeless/settings.py
@@ -108,3 +108,10 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
+
+MEDIA_URL = '/media/'
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+
+FILE_UPLOAD_HANDLERS = [
+ 'django.core.files.uploadhandler.TemporaryFileUploadHandler',
+]
diff --git a/codeless/urls.py b/codeless/urls.py
index e0bf49c..27cfc20 100644
--- a/codeless/urls.py
+++ b/codeless/urls.py
@@ -1,6 +1,8 @@
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
+from django.conf import settings
+from django.conf.urls.static import static
urlpatterns = [
# Examples:
@@ -38,3 +40,7 @@ urlpatterns = [
{'template_name': 'inventory/reset/password_reset_complete.html'},
name='password_reset_complete'),
]
+
+
+if settings.DEBUG:
+ urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
diff --git a/inventory/forms.py b/inventory/forms.py
index 2d32f5a..dd77769 100644
--- a/inventory/forms.py
+++ b/inventory/forms.py
@@ -1,10 +1,29 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
+# This file is part of the Taler Codeless Merchant.
+# (C) 2018 GNUnet e.V.
+#
+# The Taler Codeless Merchant is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License as
published
+# by the Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# The Taler Codeless Merchant is distributed in the hope that it will be
useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
License
+# for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
along
+# with the Taler Codeless Merchant. If not, see
<https://www.gnu.org/licenses/>.
+#
+# @author Shivam Kohli
+
+
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
-from inventory.models import Merchant
+from inventory.models import Merchant, Product
class SignUpForm(UserCreationForm):
@@ -37,3 +56,9 @@ class LoginForm(forms.ModelForm):
"username",
"password"
)
+
+
+class DocumentForm(forms.ModelForm):
+ class Meta:
+ model = Product
+ fields = ('name', 'price', 'description', 'document', )
diff --git a/inventory/migrations/0001_initial.py
b/inventory/migrations/0001_initial.py
index 88a7471..c09fa98 100644
--- a/inventory/migrations/0001_initial.py
+++ b/inventory/migrations/0001_initial.py
@@ -15,64 +15,70 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Merchant',
fields=[
- ('id', models.AutoField(verbose_name='ID', serialize=False,
auto_created=True, primary_key=True)),
+ ('id', models.AutoField(verbose_name='ID', primary_key=True,
serialize=False, auto_created=True)),
('address', models.TextField()),
- ('pay_url', models.URLField(default=b'NULL', max_length=250)),
+ ('pay_url', models.URLField(max_length=250, default='NULL')),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Order',
fields=[
- ('order_id', models.AutoField(serialize=False,
primary_key=True)),
- ('description', models.CharField(max_length=300, null=True,
blank=True)),
+ ('order_id', models.AutoField(primary_key=True,
serialize=False)),
+ ('description', models.CharField(max_length=300, blank=True,
null=True)),
('order_date', models.DateTimeField(auto_now=True)),
- ('address', models.CharField(max_length=250, null=True,
blank=True)),
- ('fulfillment_url', models.URLField(default=b'NULL')),
+ ('address', models.CharField(max_length=250, blank=True,
null=True)),
+ ('fulfillment_url', models.URLField(default='NULL')),
],
),
migrations.CreateModel(
name='PaymentButton',
fields=[
- ('id', models.AutoField(verbose_name='ID', serialize=False,
auto_created=True, primary_key=True)),
- ('text', models.CharField(max_length=100, null=True,
blank=True)),
- ('font_size', models.CharField(max_length=50, null=True,
blank=True)),
- ('color', models.CharField(max_length=50, null=True,
blank=True)),
- ('background_color', models.CharField(max_length=50,
null=True, blank=True)),
- ('border_radius', models.CharField(max_length=50, null=True,
blank=True)),
+ ('id', models.AutoField(verbose_name='ID', primary_key=True,
serialize=False, auto_created=True)),
+ ('text', models.CharField(max_length=100, blank=True,
null=True)),
+ ('font_size', models.CharField(max_length=50, blank=True,
null=True)),
+ ('color', models.CharField(max_length=50, blank=True,
null=True)),
+ ('background_color', models.CharField(max_length=50,
blank=True, null=True)),
+ ('border_radius', models.CharField(max_length=50, blank=True,
null=True)),
],
),
migrations.CreateModel(
name='Product',
fields=[
- ('product_id', models.AutoField(serialize=False,
primary_key=True)),
- ('name', models.CharField(max_length=50, null=True,
blank=True)),
- ('description', models.CharField(max_length=300, null=True,
blank=True)),
- ('price', models.CharField(max_length=50, null=True,
blank=True)),
+ ('product_id', models.AutoField(primary_key=True,
serialize=False)),
+ ('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)),
('delivery_date', models.DateTimeField(auto_now=True)),
- ('starting_inventory', models.IntegerField(null=True,
blank=True)),
- ('minimum_required', models.IntegerField(null=True,
blank=True)),
- ('inventory_on_hand', models.IntegerField(null=True,
blank=True)),
- ('inventory_recieved', models.IntegerField(null=True,
blank=True)),
- ('inventory_shipped', models.IntegerField(null=True,
blank=True)),
- ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL,
null=True)),
+ ('starting_inventory', models.IntegerField(blank=True,
null=True)),
+ ('minimum_required', models.IntegerField(blank=True,
null=True)),
+ ('inventory_on_hand', models.IntegerField(blank=True,
null=True)),
+ ('inventory_recieved', models.IntegerField(blank=True,
null=True)),
+ ('inventory_shipped', models.IntegerField(blank=True,
null=True)),
+ ('document', models.FileField(upload_to='document/')),
+ ('user', models.ForeignKey(null=True,
to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Purchase',
fields=[
- ('purchase_id', models.AutoField(serialize=False,
primary_key=True)),
- ('description', models.CharField(max_length=300, null=True,
blank=True)),
+ ('purchase_id', models.AutoField(primary_key=True,
serialize=False)),
+ ('description', models.CharField(max_length=300, blank=True,
null=True)),
('purchase_date', models.DateTimeField(auto_now=True)),
- ('product_recieved', models.IntegerField(null=True,
blank=True)),
- ('supplier', models.CharField(max_length=50, null=True,
blank=True)),
- ('product_id', models.ManyToManyField(to='inventory.Product',
null=True)),
+ ('product_recieved', models.IntegerField(blank=True,
null=True)),
+ ('supplier', models.CharField(max_length=50, blank=True,
null=True)),
+ ('product_id', models.ManyToManyField(null=True,
to='inventory.Product')),
],
),
migrations.AddField(
+ model_name='paymentbutton',
+ name='product',
+ field=models.ForeignKey(null=True, to='inventory.Product'),
+ ),
+ migrations.AddField(
model_name='order',
name='product_id',
- field=models.ManyToManyField(to='inventory.Product', null=True),
+ field=models.ManyToManyField(null=True, to='inventory.Product'),
),
migrations.AddField(
model_name='order',
diff --git a/inventory/migrations/0002_auto_20180607_1714.py
b/inventory/migrations/0002_auto_20180607_1714.py
deleted file mode 100644
index 600d07c..0000000
--- a/inventory/migrations/0002_auto_20180607_1714.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('inventory', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='paymentbutton',
- name='product',
- field=models.ForeignKey(null=True, to='inventory.Product'),
- ),
- migrations.AlterField(
- model_name='merchant',
- name='pay_url',
- field=models.URLField(max_length=250, default='NULL'),
- ),
- migrations.AlterField(
- model_name='order',
- name='fulfillment_url',
- field=models.URLField(default='NULL'),
- ),
- ]
diff --git a/inventory/models.py b/inventory/models.py
index aa8b848..6319f10 100644
--- a/inventory/models.py
+++ b/inventory/models.py
@@ -1,6 +1,25 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
+# This file is part of the Taler Codeless Merchant.
+# (C) 2018 GNUnet e.V.
+#
+# The Taler Codeless Merchant is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License as
published
+# by the Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# The Taler Codeless Merchant is distributed in the hope that it will be
useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
License
+# for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
along
+# with the Taler Codeless Merchant. If not, see
<https://www.gnu.org/licenses/>.
+#
+# @author Shivam Kohli
+
+
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
@@ -35,6 +54,7 @@ class Product(models.Model):
inventory_recieved = models.IntegerField(blank=True, null=True)
inventory_shipped = models.IntegerField(blank=True, null=True)
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
+ document = models.FileField(upload_to='document/')
def __str__(self):
return self.name
diff --git a/inventory/views.py b/inventory/views.py
index a5919fc..93e7cd8 100644
--- a/inventory/views.py
+++ b/inventory/views.py
@@ -1,7 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-from inventory.forms import SignUpForm, MerchantDetailForm, LoginForm
+
+# This file is part of the Taler Codeless Merchant.
+# (C) 2018 GNUnet e.V.
+#
+# The Taler Codeless Merchant is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License as
published
+# by the Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# The Taler Codeless Merchant is distributed in the hope that it will be
useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
License
+# for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
along
+# with the Taler Codeless Merchant. If not, see
<https://www.gnu.org/licenses/>.
+#
+# @author Shivam Kohli
+
+
+from inventory.forms import SignUpForm, MerchantDetailForm, LoginForm,
DocumentForm
from inventory.models import Merchant, Product
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
@@ -210,7 +230,28 @@ def customize_payment_button(request):
@login_required
def new_product(request):
- return render(request, 'inventory/new_product.html')
+ if request.method == 'POST':
+ form = DocumentForm(request.POST, request.FILES)
+ if form.is_valid():
+ user_instance = User.objects.get(username=request.user.username)
+ Product.objects.create(
+ name=form.cleaned_data['name'],
+ description=form.cleaned_data['description'],
+ price=form.cleaned_data['price'],
+ starting_inventory=0,
+ minimum_required=0,
+ inventory_on_hand=0,
+ inventory_recieved=0,
+ inventory_shipped=0,
+ user=user_instance,
+ document=form.cleaned_data['document']
+ )
+ return redirect('home')
+ else:
+ form = DocumentForm()
+ return render(request, 'inventory/new_product.html', {
+ 'form': form
+ })
def signup(request):
diff --git a/templates/inventory/fulfillment.html
b/templates/inventory/fulfillment.html
index 76ed449..4e5c608 100644
--- a/templates/inventory/fulfillment.html
+++ b/templates/inventory/fulfillment.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title></title>
diff --git a/templates/inventory/home.html b/templates/inventory/home.html
index ea5ddf8..a4e89ac 100644
--- a/templates/inventory/home.html
+++ b/templates/inventory/home.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title>Home</title>
diff --git a/templates/inventory/index.html b/templates/inventory/index.html
index 03764a1..f24f4d1 100644
--- a/templates/inventory/index.html
+++ b/templates/inventory/index.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title>Login</title>
diff --git a/templates/inventory/login.html b/templates/inventory/login.html
index 5c13efe..2f2b9e8 100644
--- a/templates/inventory/login.html
+++ b/templates/inventory/login.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title>Login</title>
diff --git a/templates/inventory/new_product.html
b/templates/inventory/new_product.html
index a8d4868..55126f8 100644
--- a/templates/inventory/new_product.html
+++ b/templates/inventory/new_product.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title>Home</title>
@@ -139,6 +158,18 @@
</div>
</section>
+ <section id="contact">
+ <div class="container">
+ <form method="post" enctype="multipart/form-data">
+ <form method="post" enctype="multipart/form-data">
+ <h1>FOR DIGITAL INVENTORY</h1>
+ {% csrf_token %}
+ {{ form.as_p }}
+ <button name="add_product" type="submit" class="submit">Add
Product</button>
+ </form>
+ </div>
+ </section>
+
</div>
</body>
diff --git a/templates/inventory/product.html b/templates/inventory/product.html
index 778f490..9ac159b 100644
--- a/templates/inventory/product.html
+++ b/templates/inventory/product.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title>Home</title>
diff --git a/templates/inventory/signup.html b/templates/inventory/signup.html
index 3bec372..7a7dd71 100644
--- a/templates/inventory/signup.html
+++ b/templates/inventory/signup.html
@@ -1,4 +1,23 @@
<!DOCTYPE html>
+<!--
+This file is part of the Taler Codeless Merchant.
+(C) 2018 GNUnet e.V.
+
+The Taler Codeless Merchant is free software: you can redistribute it and/or
+modify it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+The Taler Codeless Merchant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+for more details.
+
+You should have received a copy of the GNU Affero General Public License along
+with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>.
+
address@hidden Shivam Kohli
+ -->
<html>
<head>
<title>Sign Up</title>
--
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: added licence header and digital inventory,
gnunet <=