commit ce1080d7f2b45a41321c13a29d4bdd07c72b6058 Author: MassiveAtoms Date: Sun May 24 12:00:10 2020 -0300 Made models diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..e5ff86e Binary files /dev/null and b/db.sqlite3 differ diff --git a/houtmarkt/__init__.py b/houtmarkt/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/houtmarkt/__pycache__/__init__.cpython-38.pyc b/houtmarkt/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..33d2345 Binary files /dev/null and b/houtmarkt/__pycache__/__init__.cpython-38.pyc differ diff --git a/houtmarkt/__pycache__/settings.cpython-38.pyc b/houtmarkt/__pycache__/settings.cpython-38.pyc new file mode 100644 index 0000000..a221595 Binary files /dev/null and b/houtmarkt/__pycache__/settings.cpython-38.pyc differ diff --git a/houtmarkt/__pycache__/urls.cpython-38.pyc b/houtmarkt/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..ac84431 Binary files /dev/null and b/houtmarkt/__pycache__/urls.cpython-38.pyc differ diff --git a/houtmarkt/__pycache__/wsgi.cpython-38.pyc b/houtmarkt/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000..2ec5941 Binary files /dev/null and b/houtmarkt/__pycache__/wsgi.cpython-38.pyc differ diff --git a/houtmarkt/asgi.py b/houtmarkt/asgi.py new file mode 100644 index 0000000..4913cb3 --- /dev/null +++ b/houtmarkt/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for houtmarkt project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'houtmarkt.settings') + +application = get_asgi_application() diff --git a/houtmarkt/settings.py b/houtmarkt/settings.py new file mode 100644 index 0000000..3787836 --- /dev/null +++ b/houtmarkt/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for houtmarkt project. + +Generated by 'django-admin startproject' using Django 3.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'n2h_6t5qnp8zvke(%a%ph)xj4h8w+kgg46pld0r2^ndcme3el6' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + "markt" +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'houtmarkt.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'houtmarkt.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'America/Paramaribo' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/houtmarkt/urls.py b/houtmarkt/urls.py new file mode 100644 index 0000000..bc3a78a --- /dev/null +++ b/houtmarkt/urls.py @@ -0,0 +1,36 @@ +"""houtmarkt URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +from django.urls import include + +urlpatterns = [ + path('markt/', include('markt.urls')), + path('admin/', admin.site.urls), +] + + +from django.views.generic import RedirectView +urlpatterns += [ + path('', RedirectView.as_view(url='markt/', permanent=True)), +] + +# Use static() to add url mapping to serve static files during development (only) +from django.conf import settings +from django.conf.urls.static import static + +urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/houtmarkt/wsgi.py b/houtmarkt/wsgi.py new file mode 100644 index 0000000..fe5c17d --- /dev/null +++ b/houtmarkt/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for houtmarkt project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'houtmarkt.settings') + +application = get_wsgi_application() diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..e555379 --- /dev/null +++ b/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'houtmarkt.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/markt/__init__.py b/markt/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/markt/__pycache__/__init__.cpython-38.pyc b/markt/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..32f752f Binary files /dev/null and b/markt/__pycache__/__init__.cpython-38.pyc differ diff --git a/markt/__pycache__/admin.cpython-38.pyc b/markt/__pycache__/admin.cpython-38.pyc new file mode 100644 index 0000000..518e713 Binary files /dev/null and b/markt/__pycache__/admin.cpython-38.pyc differ diff --git a/markt/__pycache__/models.cpython-38.pyc b/markt/__pycache__/models.cpython-38.pyc new file mode 100644 index 0000000..bd6c83b Binary files /dev/null and b/markt/__pycache__/models.cpython-38.pyc differ diff --git a/markt/__pycache__/urls.cpython-38.pyc b/markt/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..b9738b8 Binary files /dev/null and b/markt/__pycache__/urls.cpython-38.pyc differ diff --git a/markt/__pycache__/views.cpython-38.pyc b/markt/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..9391dd2 Binary files /dev/null and b/markt/__pycache__/views.cpython-38.pyc differ diff --git a/markt/admin.py b/markt/admin.py new file mode 100644 index 0000000..54d7d64 --- /dev/null +++ b/markt/admin.py @@ -0,0 +1,9 @@ +from django.contrib import admin +from .models import Factuur, Formaat, Houtmarkt, Houtsoort, Klant, Voorraad + +admin.site.register(Factuur) +admin.site.register(Formaat) +admin.site.register(Houtsoort) +admin.site.register(Houtmarkt) +admin.site.register(Klant) +admin.site.register(Voorraad) diff --git a/markt/apps.py b/markt/apps.py new file mode 100644 index 0000000..1fd4ef3 --- /dev/null +++ b/markt/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class MarktConfig(AppConfig): + name = 'markt' diff --git a/markt/migrations/0001_initial.py b/markt/migrations/0001_initial.py new file mode 100644 index 0000000..4b18286 --- /dev/null +++ b/markt/migrations/0001_initial.py @@ -0,0 +1,74 @@ +# Generated by Django 3.0.6 on 2020-05-24 14:55 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Formaat', + fields=[ + ('Format_ID', models.AutoField(primary_key=True, serialize=False)), + ('Formaat', models.CharField(help_text='Formaat (vb 2x4)', max_length=255)), + ('Lengte', models.FloatField()), + ], + ), + migrations.CreateModel( + name='Houtmarkt', + fields=[ + ('Houtmarkt_ID', models.AutoField(primary_key=True, serialize=False)), + ('Houtmarkt_naam', models.CharField(help_text='Houtmarkt naam', max_length=255)), + ('Houtmarkt_tel', models.IntegerField()), + ('Houtmarkt_addr', models.CharField(max_length=255)), + ('Houtmarkt_type', models.BooleanField()), + ], + ), + migrations.CreateModel( + name='Houtsoort', + fields=[ + ('Hout_ID', models.AutoField(primary_key=True, serialize=False)), + ('Houtsoort_naam', models.CharField(help_text='Houtsoort', max_length=255)), + ], + ), + migrations.CreateModel( + name='Klant', + fields=[ + ('Klant_ID', models.AutoField(primary_key=True, serialize=False)), + ('Klant_naam', models.CharField(help_text='Klant naam', max_length=255)), + ('Klant_tel', models.CharField(help_text='Klant telefoon nummer', max_length=255)), + ('Klant_Addr', models.CharField(help_text='Klant Adres', max_length=255)), + ('Is_Houtmarkt', models.BooleanField()), + ], + ), + migrations.CreateModel( + name='Voorraad', + fields=[ + ('Voorraad_ID', models.AutoField(primary_key=True, serialize=False)), + ('prijs', models.FloatField()), + ('Voorraad_Amount', models.IntegerField()), + ('Format_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='markt.Formaat')), + ('Hout_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='markt.Houtsoort')), + ('Houtmarkt_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='markt.Houtmarkt')), + ], + ), + migrations.CreateModel( + name='Factuur', + fields=[ + ('Factuur_ID', models.AutoField(primary_key=True, serialize=False)), + ('Korting_percent', models.FloatField()), + ('AMT_Sold', models.IntegerField()), + ('Subtotal', models.FloatField()), + ('total', models.FloatField()), + ('Houtmarkt_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='markt.Houtmarkt')), + ('Klant_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='markt.Klant')), + ('Voorraad_ID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='markt.Voorraad')), + ], + ), + ] diff --git a/markt/migrations/__init__.py b/markt/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/markt/migrations/__pycache__/0001_initial.cpython-38.pyc b/markt/migrations/__pycache__/0001_initial.cpython-38.pyc new file mode 100644 index 0000000..7a34f3d Binary files /dev/null and b/markt/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/markt/migrations/__pycache__/__init__.cpython-38.pyc b/markt/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..6db1909 Binary files /dev/null and b/markt/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/markt/models.py b/markt/models.py new file mode 100644 index 0000000..2dfbdec --- /dev/null +++ b/markt/models.py @@ -0,0 +1,102 @@ +from django.db import models +# Used to generate URLs by reversing the URL patterns +from django.urls import reverse + +# Create your models here. + + +class Houtsoort(models.Model): + Hout_ID = models.AutoField(primary_key=True) + Houtsoort_naam = models.CharField(max_length=255, help_text='Houtsoort') + + def get_absolute_url(self): + """Returns the url to access a particular instance of the model.""" + return reverse('model-detail-view', args=[str(self.Hout_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return self.Houtsoort_naam + + +class Formaat(models.Model): + Format_ID = models.AutoField(primary_key=True) + Formaat = models.CharField(max_length=255, help_text='Formaat (vb 2x4)') + Lengte = models.FloatField() + + def get_absolute_url(self): + """Returns the url to access a particular instance of the model.""" + return reverse('model-detail-view', args=[str(self.Format_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return self.Formaat + + +class Houtmarkt(models.Model): + Houtmarkt_ID = models.AutoField(primary_key=True) + Houtmarkt_naam = models.CharField( + max_length=255, help_text='Houtmarkt naam') + Houtmarkt_tel = models.IntegerField() + Houtmarkt_addr = models.CharField(max_length=255) + Houtmarkt_type = models.BooleanField() + + def get_absolute_url(self): + """Returns the url to access a particular instance of the model.""" + return reverse('model-detail-view', args=[str(self.Houtmarkt_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return self.Houtmarkt_naam + + +class Voorraad(models.Model): + Voorraad_ID = models.AutoField(primary_key=True) + Houtmarkt_ID = models.ForeignKey("Houtmarkt", on_delete=models.CASCADE) + Hout_ID = models.ForeignKey("Houtsoort", on_delete=models.CASCADE) + Format_ID = models.ForeignKey("Formaat", on_delete=models.CASCADE) + prijs = models.FloatField() + Voorraad_Amount = models.IntegerField() + + def get_absolute_url(self): + """Returns the url to access a particular instance of the model.""" + return reverse('model-detail-view', args=[str(self.Voorraad_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return self.Voorraad_ID + + +class Klant(models.Model): + Klant_ID = models.AutoField(primary_key=True) + Klant_naam = models.CharField(max_length=255, help_text='Klant naam') + Klant_tel = models.CharField( + max_length=255, help_text='Klant telefoon nummer') + Klant_Addr = models.CharField(max_length=255, help_text='Klant Adres') + Is_Houtmarkt = models.BooleanField() + + def get_absolute_url(self): + """Returns the url to access a particular instance of the model.""" + return reverse('model-detail-view', args=[str(self.Klant_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return self.Klant_naam + + +class Factuur(models.Model): + Factuur_ID = models.AutoField(primary_key=True) + Voorraad_ID = models.ForeignKey("Voorraad", on_delete=models.CASCADE) + Klant_ID = models.ForeignKey("Klant", on_delete=models.CASCADE) + Houtmarkt_ID = models.ForeignKey("Houtmarkt", on_delete=models.CASCADE) + Korting_percent = models.FloatField() + AMT_Sold = models.IntegerField() + Subtotal = models.FloatField() + total = models.FloatField() + + def get_absolute_url(self): + """Returns the url to access a particular instance of the model.""" + return reverse('model-detail-view', args=[str(self.Factuur_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return self.Factuur_ID diff --git a/markt/tests.py b/markt/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/markt/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/markt/urls.py b/markt/urls.py new file mode 100644 index 0000000..2d5ee3c --- /dev/null +++ b/markt/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + +] \ No newline at end of file diff --git a/markt/views.py b/markt/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/markt/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.