From 175c4d9631d5fefa22036f1c206cdf9740a44c20 Mon Sep 17 00:00:00 2001 From: MassiveAtoms Date: Mon, 25 May 2020 02:15:12 -0300 Subject: [PATCH] nice features --- db.sqlite3 | Bin 208896 -> 208896 bytes houtmarkt/__pycache__/settings.cpython-38.pyc | Bin 2355 -> 2378 bytes houtmarkt/__pycache__/urls.cpython-38.pyc | Bin 1308 -> 1356 bytes houtmarkt/settings.py | 2 +- houtmarkt/urls.py | 5 +- markt/__pycache__/admin.cpython-38.pyc | Bin 1676 -> 1676 bytes markt/__pycache__/models.cpython-38.pyc | Bin 6547 -> 6671 bytes markt/__pycache__/urls.cpython-38.pyc | Bin 270 -> 360 bytes markt/__pycache__/views.cpython-38.pyc | Bin 224 -> 886 bytes markt/admin.py | 2 +- markt/migrations/0012_auto_20200525_0113.py | 23 ++++++++ .../0012_auto_20200525_0113.cpython-38.pyc | Bin 0 -> 670 bytes markt/models.py | 38 ++++++------- markt/static/css/styles.css | 13 +++++ markt/templates/base_generic.html | 21 +++++++ markt/templates/markt/factuur_detail.html | 53 ++++++++++++++++++ markt/urls.py | 1 + markt/views.py | 16 +++++- 18 files changed, 149 insertions(+), 25 deletions(-) create mode 100644 markt/migrations/0012_auto_20200525_0113.py create mode 100644 markt/migrations/__pycache__/0012_auto_20200525_0113.cpython-38.pyc create mode 100644 markt/static/css/styles.css create mode 100644 markt/templates/base_generic.html create mode 100644 markt/templates/markt/factuur_detail.html diff --git a/db.sqlite3 b/db.sqlite3 index 4d3f068a356a41aa4b258a46dba330a8460c7a36..5b1ca5a471e574a07254c5cb7684fcbaf6928cda 100644 GIT binary patch delta 879 zcmb7CO-vI(6rP#w?(EXq*F~iy1yh>TWaV$$Qu;$A^q>brBt|_LW6DY!NyMMj_FxFu z;DM{A>IN=y@Mr?2$Qmyqi5}<;V@OF*1QNneLewDsMVxKpg_|>ZGkM>e_q}i4Om@kZ zU9#PC$r?f^z|7B#Fq^*L5Ww2A?kB+2iZeOth!AlmA9G~I<88G(a<;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9Bk5lYAi}YIF;+fmR?eWmrnQWpcrbTN!R+zzL(Ly$Nf`Wx{Ocn~tcS%}0 z5&j)xZiU`6T@!3a0o19mN#GY8z&F^$Tfc%}o2C(+8H`j(wT)xuLM7BNR81wip>k{I zs)fW-o~aHyhnl6>hb>r#8cLP{q7)}OrtyFfV}>DXPgt;%!zzK_@B_Bt3&w8j`ml5y zc@7-agqf=g?BW0_>(&Dw!Y)ed*#7{s-eg_a*dTC>FTV{Nu!oJ0U~Yiockn&<3ZD_Y b2cOWmbpuirycL+&j&3RpG4SB@BWwKwCd90) diff --git a/houtmarkt/__pycache__/settings.cpython-38.pyc b/houtmarkt/__pycache__/settings.cpython-38.pyc index a9ba383e23f6e0c9b50fa5a3d86ef044533b6602..69cec55b89145311db18d49a218a4a77bae5819f 100644 GIT binary patch delta 230 zcmdlibV`Ufl$V!_0SN2^Psd%H$SccuW1@CqeJW!X(*oX9wiMBYOzDg%EGc3s;wcg- zk||Q@ESZcc(sNkS8Kd}8WTN;}WK-nes^u3lr6|l{%4CcZNKs5t0;*I@Q3jJLU{W=c zF`Xq!Fhwm&C`CO=IE5uj1c*g}SS&>&N<4)rm_buBQIB!s|JBUQw>V2SFJcK}WaQZV zlXWkn5=&NoX5KB%5Le#-AIA{a;9COW!S0^%jsXEap3aUTp8kH5Z?I>vDF8iFq%hfo MV<{uwlv{{HZl$V!_0SFGvIu*BeBCjmtnTgto_2~>LEGeQXVkzP&5-F1DESZccQgc|+ z8KZbpq@(y!WKv{P8MBxc@Tan+$Sq__k)Okq$rvS&qL88pRH=}n1SXZiq)H}ZI!lyb zifWWlidvL#3QLp-5Q_q_Sc-a-cnVW6gQiBJ9wP$-mrGV+UV6Slaq4Dq#`(;f53=|% zGO}+LVB5>6#2Mo18{p#@;u?HQAUxRJGu|;Ez{k_sF~rl~?-ol|erDd}_v~40@<5*y Q$xn{wSjxyWnU&KO05bGDcmMzZ diff --git a/houtmarkt/__pycache__/urls.cpython-38.pyc b/houtmarkt/__pycache__/urls.cpython-38.pyc index ac84431913bbbe4f40b54b58e24fba1a4d17bb00..087a23a54ddf3c921ea388e88f8d9166b5130ead 100644 GIT binary patch delta 408 zcmY*V%SyvQ6wOQ~lSh+jEriI`dbT;e;uvA%*% zOC9TESe=@CEa1g(EJdy(RTR3qF?Wsz{cdeX5eQLKw|E-oqvBv#v0&e#?aZ Rflc;KsE;t}eo_k<`~|v}W!V4# delta 416 zcmYL_yGjE=6ozMJXD``nOe2U`h)opIT8khEVjvfbEnL>jB<`BsmDx!wEK;OS5f&Tq zA@nuGLfd^1OZ99FI&g-c@BIIn;k=norrUQM6Tvx|zFvONrMrzEmj`<@B~g79BTkvh zRi@4HoPgFjiM3dtlM(R^hM6(0C8lqJ&wy@?o3X`IW-@C*z=IFb%4Lu3#PJ=BAmNPN z#PhvX!sAX{huUE7f~>q=7d7jlAn4`up15krk|=HBlHP{$x_D6bi+5%B27r-sDWi0h zgVu5x%4h(}VcB4k@KgpO%j9{pQR+beEC_s;#bG+iT7xW=BD#VX5Gt)ToQQEQ6d;0D znC6k>C9P;Nqk9)>1@$lwrV+pU3&EtJs6or${GUB+RjJnRk3_ZC((Lw*dZ))hzjIbv hYu#zLd&M)I?redBdN#I+t-$?7H5(J$_}0{l{Qx7EaXSD2 diff --git a/houtmarkt/settings.py b/houtmarkt/settings.py index 3787836..0316fd8 100644 --- a/houtmarkt/settings.py +++ b/houtmarkt/settings.py @@ -55,7 +55,7 @@ ROOT_URLCONF = 'houtmarkt.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates'),], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/houtmarkt/urls.py b/houtmarkt/urls.py index bc3a78a..87e9e7c 100644 --- a/houtmarkt/urls.py +++ b/houtmarkt/urls.py @@ -13,15 +13,16 @@ 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.conf import settings from django.contrib import admin from django.urls import path - +from django.conf.urls.static import static from django.urls import include urlpatterns = [ path('markt/', include('markt.urls')), path('admin/', admin.site.urls), -] +] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) from django.views.generic import RedirectView diff --git a/markt/__pycache__/admin.cpython-38.pyc b/markt/__pycache__/admin.cpython-38.pyc index 81fa09983a8ebd3a9a7fc5c205ff2ef494f47c30..e2cd229c269176ae3736ee99e7d65c9bcaf3c592 100644 GIT binary patch delta 27 hcmeC-?cwDP<>lpK00JME(;K<(Ffo>Fe!;Ya830yS2W0>N delta 27 hcmeC-?cwDP<>lpK00Pz{r#5omVPXu~{DNr-GXPjA2Ymnl diff --git a/markt/__pycache__/models.cpython-38.pyc b/markt/__pycache__/models.cpython-38.pyc index a8f3c5d5253ca7e1491755e135e69329c6900304..9aacba3e69279cce1b209f5e52067284d10c273e 100644 GIT binary patch delta 2694 zcma)8-A^1<6rVf$!R+kL?y&5_0!6J|gvEliK%up!QiM{MuNGR(KClkVumZC?cxTq6 z#AFje->T6YAAB%@r-mmreUun|Fh)&`K05z_?~TU3)N}4EA4L}2&78R(zkBaFzx%uA z4(t24U%8_wvH-syUjJo2`?c~7A&=QlUX{d41$=%k zoG?lS$2fLi3mXkCR1lk!yd{j%6m7+^$HdRw?10Xr;VZ|5PoKwW+R>atgR8jmm}zN_ z$3Z8y0tYYGBmp?s8;La85ik;okSLKv$uIe7`k_|WM>=_&k#Vc+6g9ef0!_Qp^!X;3 zBtzWj0lcJX#TxVshL$Q_Fd!G+ho8#O2)cSiAZl%fx&iJn)B`0qa+0w5TLY*o`U04YpDW7SQ&cqNGCod`Ei50=E4_d@MNV%5+UI_*FT@0LJ05F-BCL z%Ky@y{(3pv-z$&OoKPuiYNZq8_eV6_S(TscK~Iq0L~MR(2$s#&ap2I@=g1JmoMI2u4}!=Jy}&Nk->QZ`O?89T7Sn_JH%N*-sc&n+ zZLD$PF2(1sT!n5o$Y--p(a-w;Jrp(jHU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TAE9ltP%(!TG z-jU3Nsqaaq{#Y&~d9gdKlQ7{L8L{>aDk@h*4yd!nrdzAEmjMp?h%4#4S41Yreo1+m zrfOM8u;XK1Pmil~T)ZVckl+IUCY`RYN@f5rX%#mvFX$_%BHN2ar&a-m-r0~R?`*?u zYljwri9>K@TU4Mv}uUBk$^sz;eQYZ=UNH2d9A4 zYcjmE3;~o=lF9lImnk>!1@ga{IE{}f01Mdm5(_rCTh&q#<+o{JHOiAm3kJN<8ll<8 z?jtlQc~?U;Vd6Qr#z!)D%JbNdXE<>WXO@buXtJhK(bc|Gh|M{c?Bk@rGGGOA9DumkXri{XOe$jvODb~~%L3Mg3@NNB zY`x6sj8SYU?7moivHP8*Fb&Q8=|y zZ@fpJg*Wh(Q(u7-^2VQFG0pd)m50E;YM zp_^bHOwbDdz~6&a!0{6_57+;w59N7^zzYum;gV?N(n%}+fdd6e7nQcNayp1zZ0e=Z zI)kv=@o5)TX~kDdIkU_?I%zjj*i(qox@=sZ+sZNt$|ED>#3hR>rl-cG>x1{$ZBbfC zW(=kG==a&t>-^LRZSs#0nq7*wwo)cP7G`0qWv*&zXA-p3Owy&UrkW`QZax=UsO$Wq zs;y#rVe=L*p+IK1yw+V%+=FQn02J)uXZYKT|7tn>H>E-9GD=IP1f{M+sj7G_z1^ks z3utIpbPSv>hD9Npn_O?5Qz4|JRQF-Mg*|UQ_TX#SJdcQmN)O delta 156 zcmeyy_JFZIl$V!_0SL|(oQiV-(vLwLWWWUEH~?|60FX#wNMX!j$YqRTWMoKT3TDt` zehCz1&}6*DR+O5Tl3L`a$rL4!l9ia3p08J&kzZ7jTv}3G1TteKLlHBO0u#T&oULL) ei&Kk=Cx2k{6TZb^lbfGXnv-hB2vqSIh#3HS8Y1if diff --git a/markt/admin.py b/markt/admin.py index 8a3cf08..ba45202 100644 --- a/markt/admin.py +++ b/markt/admin.py @@ -9,7 +9,7 @@ class OrderAdmin(admin.ModelAdmin): @admin.register(Factuur) class FactuurAdmin(admin.ModelAdmin): - list_display = ("Factuur_ID", "Klant_ID", "Total" ) + list_display = ("Factuur_ID", "Klant_ID", "total" ) diff --git a/markt/migrations/0012_auto_20200525_0113.py b/markt/migrations/0012_auto_20200525_0113.py new file mode 100644 index 0000000..62927da --- /dev/null +++ b/markt/migrations/0012_auto_20200525_0113.py @@ -0,0 +1,23 @@ +# Generated by Django 3.0.6 on 2020-05-25 04:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('markt', '0011_auto_20200524_1559'), + ] + + operations = [ + migrations.AddField( + model_name='factuur', + name='Subtotal', + field=models.FloatField(blank=True, null=True), + ), + migrations.AddField( + model_name='factuur', + name='Total', + field=models.FloatField(blank=True, null=True), + ), + ] diff --git a/markt/migrations/__pycache__/0012_auto_20200525_0113.cpython-38.pyc b/markt/migrations/__pycache__/0012_auto_20200525_0113.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fcabad8fda9378a2af1a67481e545f669f9a3bd8 GIT binary patch literal 670 zcmZ8f&2H2%5O(ZjHygDQ7eL|xkoHn#7xn-`s4HMOwU@S+D8llt-H@yur?!LCGhF*1 zJPU8&D_nSmN(jbjS1gR>PxI@U`I3vn!wiA^c=zqY5+n3I82b`~aSYc!1>lHB5~-+& z6fSUt-Xo4V`GPnRQA0kHg7EkZO_QIHi>BCTs;&%kwQj8+Db0nnn-JQU6pUlIb_F0% z5ph&t9#v66MBF5yffzMo9>Ym)FdyCQ{Nw-q6)sYq!T=LLIoWlFF%reh))kNQd^V%3 zcbd-gd7dxk&*^Njc;UyFY~%Xg`1Gt_JMEY}4^?Z)+O3bZwvw8; z!QnIAiF*RSBJ&W!1Kip-FUt!nj4e-?we=^lbXwW+t*~3CyHfSi)v|6Y=u11J;Ug#o zX4wcM)OGn$_io^%yvH3`wgism|8TURz}mB;?%IT3VFcGc0Z0k{9Vc;w;T-(h({6{n o(`oD{ykTvnkNA4nbJ%VO{$1owdj#+K^wk|>uLB7-5c7ci0iy=AHvj+t literal 0 HcmV?d00001 diff --git a/markt/models.py b/markt/models.py index 1b8fe75..653db66 100644 --- a/markt/models.py +++ b/markt/models.py @@ -135,7 +135,8 @@ class Order(models.Model): self.Prijs = self.Voorraad_ID.Prijs * self.Amount new_amount = self.Voorraad_ID.Voorraad_Amount - self.Amount if new_amount < 0: - raise ValueError("Er zijn maar {} in voorraad".format(self.Voorraad_ID.Voorraad_Amount)) + raise ValueError("Er zijn maar {} in voorraad".format( + self.Voorraad_ID.Voorraad_Amount)) self.Voorraad_ID.Voorraad_Amount -= self.Amount self.Voorraad_ID.save() return super(Order, self).save(*args, **kwargs) @@ -146,38 +147,35 @@ class Factuur(models.Model): Klant_ID = models.ForeignKey("Klant", on_delete=models.PROTECT) Orders = models.ManyToManyField("Order", null=True, blank=True) Korting_percent = models.FloatField() - # Subtotal = models.FloatField(null=True, blank=True) - # total = models.FloatField(null=True, blank=True) + Subtotal = models.FloatField(null=True, blank=True) + Total = models.FloatField(null=True, blank=True) 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)]) + return reverse('factuur-detail', args=[str(self.Factuur_ID)]) def __str__(self): """String for representing the Model object.""" return str(self.Factuur_ID) @property - def Subtotal(self): - if self.pk: - return self.Orders.all().aggregate(Sum('Prijs'))['Prijs__sum'] - else: - return 0 - + def subtotal(self): + if not self.Subtotal: + # TODO: Korting moet mischien hier verwerkt worden + self.Subtotal = self.Orders.all().aggregate(Sum('Prijs'))['Prijs__sum'] + self.save() + return self.Subtotal + @property - def Total(self): + def total(self): if self.pk: - return (100 - self.Korting_percent) * self.Subtotal / 100 + if not self.Total: + # TODO: Taxes moet eigenlijk hier verwerkt worden, niet korting + self.Total = (100 - self.Korting_percent) * self.subtotal / 100 + self.save() + return self.Total else: return 0 - - # def save(self, *args, **kwargs): - # super(Factuur, self).save(*args, **kwargs) - # self.Subtotal = sum([i.Prijs for i in self.Orders.all()]) - # self.total = self.Subtotal * (1 - self.Korting_percent/100) - - # return super(Factuur, self).save(*args, **kwargs) - class Meta: db_table = "Factuur" verbose_name_plural = "Facturen" diff --git a/markt/static/css/styles.css b/markt/static/css/styles.css new file mode 100644 index 0000000..6db71f6 --- /dev/null +++ b/markt/static/css/styles.css @@ -0,0 +1,13 @@ +table, +th, +td { + border: 1px solid black; + border-collapse: collapse; + padding: 0.5em; + +} + +td:nth-child(3), +td:nth-child(2) { + text-align: right; +} \ No newline at end of file diff --git a/markt/templates/base_generic.html b/markt/templates/base_generic.html new file mode 100644 index 0000000..ca9b2af --- /dev/null +++ b/markt/templates/base_generic.html @@ -0,0 +1,21 @@ + + + + {% block title %}Houtmarkt{% endblock %} + + + + + {% load static %} + + + +
+
+
+
+
{% block content %}{% endblock %}
+
+
+ + \ No newline at end of file diff --git a/markt/templates/markt/factuur_detail.html b/markt/templates/markt/factuur_detail.html new file mode 100644 index 0000000..b8fc37f --- /dev/null +++ b/markt/templates/markt/factuur_detail.html @@ -0,0 +1,53 @@ +{% extends "base_generic.html" %} + + +{% block content %} +{% load static %} +

FACTUUR HOUTMARKTNAAM

+ + + + + + + + + +
Klant{{factuur.Klant_ID}}
DatumTBD
+ +
+
+

Order

+ + + + + + + {% for order in factuur.Orders.all %} + + + + + + {% endfor %} + + + + + + + + + + + + + + + +
ProductAantalPrijs
{{order.Voorraad_ID}}{{order.Amount}}SRD {{order.Prijs}}
Subotaal + SRD {{factuur.Subtotal}}
Korting{{factuur.Korting_percent}} %SRD {{korting}}
TotaalSRD {{factuur.Total}}
+ + +{% endblock %} \ No newline at end of file diff --git a/markt/urls.py b/markt/urls.py index 2d5ee3c..5e24bfd 100644 --- a/markt/urls.py +++ b/markt/urls.py @@ -2,5 +2,6 @@ from django.urls import path from . import views urlpatterns = [ + path('factuur/', views.FactuurDetailView.as_view(), name='factuur-detail'), ] \ No newline at end of file diff --git a/markt/views.py b/markt/views.py index 91ea44a..ee64dec 100644 --- a/markt/views.py +++ b/markt/views.py @@ -1,3 +1,17 @@ from django.shortcuts import render - +from django.views import generic +from django.shortcuts import get_object_or_404 # Create your views here. + +from markt.models import Factuur, Order, Klant + + + + +class FactuurDetailView(generic.DetailView): + model = Factuur + def get_context_data(self, **kwargs): + # Call the base implementation first to get the context + context = super(FactuurDetailView, self).get_context_data(**kwargs) + context['korting'] = context["factuur"].Korting_percent * context["factuur"].Subtotal / 100 + return context \ No newline at end of file