Made models
This commit is contained in:
0
markt/__init__.py
Normal file
0
markt/__init__.py
Normal file
BIN
markt/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
markt/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
markt/__pycache__/admin.cpython-38.pyc
Normal file
BIN
markt/__pycache__/admin.cpython-38.pyc
Normal file
Binary file not shown.
BIN
markt/__pycache__/models.cpython-38.pyc
Normal file
BIN
markt/__pycache__/models.cpython-38.pyc
Normal file
Binary file not shown.
BIN
markt/__pycache__/urls.cpython-38.pyc
Normal file
BIN
markt/__pycache__/urls.cpython-38.pyc
Normal file
Binary file not shown.
BIN
markt/__pycache__/views.cpython-38.pyc
Normal file
BIN
markt/__pycache__/views.cpython-38.pyc
Normal file
Binary file not shown.
9
markt/admin.py
Normal file
9
markt/admin.py
Normal file
@@ -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)
|
||||
5
markt/apps.py
Normal file
5
markt/apps.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MarktConfig(AppConfig):
|
||||
name = 'markt'
|
||||
74
markt/migrations/0001_initial.py
Normal file
74
markt/migrations/0001_initial.py
Normal file
@@ -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')),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
markt/migrations/__init__.py
Normal file
0
markt/migrations/__init__.py
Normal file
BIN
markt/migrations/__pycache__/0001_initial.cpython-38.pyc
Normal file
BIN
markt/migrations/__pycache__/0001_initial.cpython-38.pyc
Normal file
Binary file not shown.
BIN
markt/migrations/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
markt/migrations/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
102
markt/models.py
Normal file
102
markt/models.py
Normal file
@@ -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
|
||||
3
markt/tests.py
Normal file
3
markt/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
6
markt/urls.py
Normal file
6
markt/urls.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
]
|
||||
3
markt/views.py
Normal file
3
markt/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user