From 265f7611df32ebed7302f3c317146d4a756dde9c Mon Sep 17 00:00:00 2001 From: MassiveAtoms Date: Sun, 24 May 2020 15:06:09 -0300 Subject: [PATCH] factuur works --- db.sqlite3 | Bin 184320 -> 204800 bytes houtmarkt/__pycache__/settings.cpython-38.pyc | Bin 2355 -> 2355 bytes markt/__pycache__/admin.cpython-38.pyc | Bin 457 -> 1676 bytes markt/__pycache__/models.cpython-38.pyc | Bin 3998 -> 6454 bytes markt/__pycache__/urls.cpython-38.pyc | Bin 270 -> 270 bytes markt/admin.py | 45 +++++-- markt/migrations/0002_auto_20200524_1448.py | 118 ++++++++++++++++++ markt/migrations/0003_factuur_orders.py | 18 +++ .../0002_auto_20200524_1251.cpython-38.pyc | Bin 0 -> 1047 bytes .../0002_auto_20200524_1448.cpython-38.pyc | Bin 0 -> 2084 bytes .../0003_auto_20200524_1304.cpython-38.pyc | Bin 0 -> 1010 bytes .../0003_factuur_orders.cpython-38.pyc | Bin 0 -> 629 bytes .../0004_auto_20200524_1307.cpython-38.pyc | Bin 0 -> 684 bytes .../0005_auto_20200524_1354.cpython-38.pyc | Bin 0 -> 1058 bytes .../0006_auto_20200524_1403.cpython-38.pyc | Bin 0 -> 626 bytes .../0007_auto_20200524_1405.cpython-38.pyc | Bin 0 -> 584 bytes .../0008_factuur_orders.cpython-38.pyc | Bin 0 -> 757 bytes .../0009_remove_factuur_orders.cpython-38.pyc | Bin 0 -> 558 bytes .../0010_factuur_orders.cpython-38.pyc | Bin 0 -> 737 bytes .../0011_remove_factuur_orders.cpython-38.pyc | Bin 0 -> 558 bytes .../0012_order_factuur_id.cpython-38.pyc | Bin 0 -> 766 bytes .../0013_auto_20200524_1434.cpython-38.pyc | Bin 0 -> 726 bytes markt/models.py | 80 +++++++++--- 23 files changed, 240 insertions(+), 21 deletions(-) create mode 100644 markt/migrations/0002_auto_20200524_1448.py create mode 100644 markt/migrations/0003_factuur_orders.py create mode 100644 markt/migrations/__pycache__/0002_auto_20200524_1251.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0002_auto_20200524_1448.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0003_auto_20200524_1304.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0003_factuur_orders.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0004_auto_20200524_1307.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0005_auto_20200524_1354.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0006_auto_20200524_1403.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0007_auto_20200524_1405.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0008_factuur_orders.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0009_remove_factuur_orders.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0010_factuur_orders.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0011_remove_factuur_orders.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0012_order_factuur_id.cpython-38.pyc create mode 100644 markt/migrations/__pycache__/0013_auto_20200524_1434.cpython-38.pyc diff --git a/db.sqlite3 b/db.sqlite3 index e5ff86ed3733901f6142946cdb7a9e68509ec5d4..df2e02a08474c1e6fa17585f3f9be9e61b22c957 100644 GIT binary patch delta 6397 zcma)AeQ+Dcb-%p>aX8?BB_&Fr1b%>|C<>wo-X}h&PfDUBN+c*M6u)Gd1PBlSNstmq zkrX{PM9HmFC)25mv^SHciTh8d?$^}OA8N-<;i=K@jB8iRk$JrAyh-*=#(K zos$GfXcg2}N%4xob~V&43VuZu6g41k&VR|%)Dvu1LhWkUACNBB+uwDk@5-6wwrxKsYE=-F9{uH2^Wj1L_%1K&#mPjlNCHzIw8-@??O zf!Wz?HX4o7wkpQWotlo$%vUl@D~eA>XOgp{#MII0*`#x`m1#i`_tfZxL^hM2n@i8m zDEQAP__cEckl)1AaVKUk&6BLNR~%$KoT=UEWa@21IGLTjbb;rAlMFA-C9?Pp%4&-` zwlW@cY&M&TM(1gF86%_oH~G!IdWN%He3EyY;B#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settings.cpython-38.pyc b/houtmarkt/__pycache__/settings.cpython-38.pyc index a221595ca72bacb7fa95a81bf5ec2121f68454b8..a9ba383e23f6e0c9b50fa5a3d86ef044533b6602 100644 GIT binary patch delta 19 Zcmdliv{{HNl$V!_0SFGv+Q_BJ2>>lo1XTb4 delta 19 Zcmdliv{{HNl$V!_0SJN%H*#rm0stxY1HS+O diff --git a/markt/__pycache__/admin.cpython-38.pyc b/markt/__pycache__/admin.cpython-38.pyc index 518e713c07106e1ed05d77fb111440d025ef4f77..0df4f36bd13572d89a22fac21890133e763cf071 100644 GIT binary patch literal 1676 zcmbVN$!^p@5bgGiw^_3RLM#db4s*!|AcPVTu?Qs~q2yp$SWVg*JaLbQvW=8;_z*Zo z;vcy434P_1KR}$QYTJ`JphOc(UDK~$yXtjymFJ+}?=XCR{`mD_wawUX0*jB0U>isN z2aRNsr%dsHb0#g>N-fn2TB;qil^xj12^{4HuJQs;`GL<_%)fPF|2u!lWLw%_nY3d* z>7KSudC)Ul%W#f#k#px<-*9cidD2JDpK}AlIfm=VE^^&DH#D4WxSs4Iho0(qD~59o zH;_Z*aCgnE8qPD^id;nwS88reuDxfY^>aKu8*yz5sgmhAC**4Pg*Yn85^$1%5~9%l ztE?=Pfa7|aXBiaQev^u6p}j*yAcWNRTaYmvk<-P8+-~E@SJ1>P;F1NF6k?lz7II6EpUF`E4jl1aXQh8v@3DpVXrx)VhzlVwWtUKD*UMOrhx zG|7udCiyHCCua<9paNt59zK5(9^^6P;hxCzKliX7-Dr2erggDnzV!_fm^c^=wbw{IF?&zJj>vvGt#SXpvnnmsK%5C&t#ou zc99h#-3LnR#mTDKOdfUA$$!jRS{HLEbW`3C{O@U7hMwm4${Mg@PwBRKcLbx z_0|Y*X@$;zL17^Xb%~OD7CM|>F30d!$=Ss4w-@9PURqAa)Ilu; z$epg1u8RH;x8BFmR0ZLsqxYNMtOPjFM=$Vz4Ect;Wa#qsu-O?^9el|(J;wc{rcp+C zf3zM9gCh9m&R{$EpR?`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^j zQRbfD@H0->y5%vULGN+vg(Qv%O=%nm4XP(Mh=^E*YDA=$E8YS`ak1IsdGNrs@Ys7>NA(=rX)?@mW}v4W5&7K)M;t6 z|2i>kJ)Jh?EUh#B5o2i0%o+j*-9<|CF?){#^9j~ zRwlJ-lYH_=8ePM4((T}A1oo5!WZah!+x5(B;h!`#8EAB`*E%!ZuP~IxeuZ*}sD9V& z@2>b%#uq1KGR=PF0o8s@1#Rg>qCohGum5gSjqSt5*sstk9^>J4$C+_SSfZBP1y*uw z>3ek5F1v1j!(WtZ@dac#Y2(5;h_A16e49HylxaG!X%68`b@I*e#*H=M8pFxD65pj> ZrL73afmh5*t})k`Z(M4eX)H7@{2yO6(!c-! delta 1279 zcmZ`(Jx~)t6wV&`xm+%HA^e3H2nZ+v0f#{v0YxCZ&?!d16SZ! zO9prfkHLPV=|M9N+KEU)@JZWx*5Mnb=?)r3$>oNT%c#5sS9pS;m4J5gBtaX&IRfIV zDA|Hzy4iKRVC93i?c$ni*Jy5~JrqZYQX(`nnN+8Q>N_W@Arx=7>)uE9eR!Vh(bV0vm(RkaLPs3 zvy2YZ*8(iWLg{Xt8NpVHAyDKo@ygW#gXL zc6KoR^j%R`m*7}WCOIWOuih#dC;rqFmePl-GuTRvV8&V`-X~-{Lm3&gVle9!lkW8~ zuc+$1qKbP~g|g6ms~R?lo5-*oszeLh z>5Zz=p5Ca2vm+-K-b;`nAXmA_MhA_Aclw;e-Sy&{f%Um+qhG>Bd2)W)SaJ$hA}=qM z@4Jp`7AgVJ)uakGqyC;1q&lhM6aSd!;Q+4Y@P~1j7;2&$D=LSN*x<>lpK0D^t9Hgd5r0stkS1H1qL delta 19 YcmeBU>SN*x<>lpK0D>DO8@X5*0VRC{umAu6 diff --git a/markt/admin.py b/markt/admin.py index 54d7d64..dba76c4 100644 --- a/markt/admin.py +++ b/markt/admin.py @@ -1,9 +1,40 @@ from django.contrib import admin -from .models import Factuur, Formaat, Houtmarkt, Houtsoort, Klant, Voorraad +from .models import Factuur, Formaat, Houtmarkt, Houtsoort, Klant, Voorraad, Order + +@admin.register(Order) +class OrderAdmin(admin.ModelAdmin): + list_display = ("Order_ID", "Voorraad_ID", "Amount", "Prijs" ) + + +@admin.register(Factuur) +class FactuurAdmin(admin.ModelAdmin): + list_display = ("Factuur_ID", "Klant_ID", "total" ) + + + +@admin.register(Formaat) +class FormaatAdmin(admin.ModelAdmin): + list_display = ("Format_ID", "Formaat") + + +@admin.register(Houtsoort) +class HoutsoortAdmin(admin.ModelAdmin): + list_display = ("Hout_ID", "Houtsoort_naam") + + +@admin.register(Houtmarkt) +class HoutmarktAdmin(admin.ModelAdmin): + list_display = ("Houtmarkt_ID", "Houtmarkt_naam") + + +@admin.register(Klant) +class KlantAdmin(admin.ModelAdmin): + list_display = ("Klant_ID", "Klant_naam") + + +@admin.register(Voorraad) +class VoorraadAdmin(admin.ModelAdmin): + list_display = ("Voorraad_ID", "Houtmarkt_ID","Hout_ID" , "Format_ID", "Prijs", "Voorraad_Amount" ) + + -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/migrations/0002_auto_20200524_1448.py b/markt/migrations/0002_auto_20200524_1448.py new file mode 100644 index 0000000..a6e6e18 --- /dev/null +++ b/markt/migrations/0002_auto_20200524_1448.py @@ -0,0 +1,118 @@ +# Generated by Django 3.0.6 on 2020-05-24 17:48 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('markt', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='factuur', + options={'verbose_name_plural': 'Facturen'}, + ), + migrations.AlterModelOptions( + name='formaat', + options={'verbose_name_plural': 'Formaten'}, + ), + migrations.AlterModelOptions( + name='houtmarkt', + options={'verbose_name_plural': 'Houtmarkten'}, + ), + migrations.AlterModelOptions( + name='houtsoort', + options={'verbose_name_plural': 'Houtsoorten'}, + ), + migrations.AlterModelOptions( + name='klant', + options={'verbose_name_plural': 'Klanten'}, + ), + migrations.AlterModelOptions( + name='voorraad', + options={'verbose_name_plural': 'Voorraad'}, + ), + migrations.RenameField( + model_name='voorraad', + old_name='prijs', + new_name='Prijs', + ), + migrations.RemoveField( + model_name='factuur', + name='AMT_Sold', + ), + migrations.RemoveField( + model_name='factuur', + name='Houtmarkt_ID', + ), + migrations.RemoveField( + model_name='factuur', + name='Voorraad_ID', + ), + migrations.AlterField( + model_name='factuur', + name='Klant_ID', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='markt.Klant'), + ), + migrations.AlterField( + model_name='houtmarkt', + name='Houtmarkt_type', + field=models.CharField(choices=[('RE', 'Reseller'), ('SE', 'Seller')], max_length=2), + ), + migrations.AlterField( + model_name='voorraad', + name='Format_ID', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='markt.Formaat'), + ), + migrations.AlterField( + model_name='voorraad', + name='Hout_ID', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='markt.Houtsoort'), + ), + migrations.AlterField( + model_name='voorraad', + name='Houtmarkt_ID', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='markt.Houtmarkt'), + ), + migrations.AlterModelTable( + name='factuur', + table='Factuur', + ), + migrations.AlterModelTable( + name='formaat', + table='Formaat', + ), + migrations.AlterModelTable( + name='houtmarkt', + table='Houtmarkt', + ), + migrations.AlterModelTable( + name='houtsoort', + table='Houtsoort', + ), + migrations.AlterModelTable( + name='klant', + table='Klant', + ), + migrations.AlterModelTable( + name='voorraad', + table='Voorraad', + ), + migrations.CreateModel( + name='Order', + fields=[ + ('Order_ID', models.AutoField(primary_key=True, serialize=False)), + ('Amount', models.IntegerField()), + ('Prijs', models.FloatField(blank=True, null=True)), + ('Factuur_ID', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='markt.Factuur')), + ('Voorraad_ID', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='markt.Voorraad')), + ], + options={ + 'verbose_name_plural': 'Orders', + 'db_table': 'Order', + }, + ), + ] diff --git a/markt/migrations/0003_factuur_orders.py b/markt/migrations/0003_factuur_orders.py new file mode 100644 index 0000000..02ed1eb --- /dev/null +++ b/markt/migrations/0003_factuur_orders.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.6 on 2020-05-24 17:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('markt', '0002_auto_20200524_1448'), + ] + + operations = [ + migrations.AddField( + model_name='factuur', + name='Orders', + field=models.ManyToManyField(to='markt.Order'), + ), + ] diff --git a/markt/migrations/__pycache__/0002_auto_20200524_1251.cpython-38.pyc b/markt/migrations/__pycache__/0002_auto_20200524_1251.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b4b23b8207b883da7460d6eb62b928306d228023 GIT binary patch literal 1047 zcmbVL&2H2%5YGQ*v%77P5C{Peu$R^Die3;xEiDC9wIFCYL=l#|c0=! zN!_N`v@x;jy=IJajEP288f2M@!_#w6b$1vqu_+%ki%bGb)zNfX>;#m_{oz1`$S^@j zMF;`2x}f0q5qekSLbKBmp>tXhTFo*lxC1AzqRm25zN2|_*CgO?G)t>px=;bhag{RV zkRuhEy~Cwaofj{kA3WYVP!XHc^NaS`;&-6hn4eO~=#mczt>gO{VLU z(R{)6)9JtzkHCbk^V{=1+kx-;umAAAn|{MUbsGsr@@wq}R!A3H1}djJ3c literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0002_auto_20200524_1448.cpython-38.pyc b/markt/migrations/__pycache__/0002_auto_20200524_1448.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e8947a2eb680d92df88426431ae09983b966fc6d GIT binary patch literal 2084 zcmb7FOLOBy5SGT0EXj`TJjwE0-WXWpge)u+MJ1I@U@K&^m1H@%T&U#q#F3+inUMm? z6{$GX!Ut%ehgzg}^oVqbE-?v99pfVnN??4gfkE|w`BkZ70y)r{<^%N6 znnbu!&}V)cBrz9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V24JQ4)b&-h)Q`O&ui7@8Ui_nPhNpw zD7Gkq>(tG~@L|h4;Qt2QHoiNw zLvOY?pgS!N>8%#`>FpM8(P52e{n)2>px|BIovbPy+1ksASg3e6ilQ+lmEw3Djicyj ze2DkQNBgmVLC#fG3B9vqV#+1M1<4sMvr3Rm2T$u$!3yx?)(6_>rRgDD zBvVXGIAz((reHl>t6rNNLSC}#7xe{+yKv2jpYrj8yAD z?BA~ETDH~s<+}f~+t>F0uzxc#Pe+dK(m5$+e2-2|^NfDoj|Sa?v~=*WnZTnuTUj@{ G@B9HmDi;a> literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0003_factuur_orders.cpython-38.pyc b/markt/migrations/__pycache__/0003_factuur_orders.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af612a2e02d91f63f0f65f49de55b09d9c668241 GIT binary patch literal 629 zcmYjOO>WdM6t?3elL=H*q7pYiiiAdC7$k%$)QSpLQx?!o6k&yV?vON&gPkA^TiEsj z+@PE8xCBS=mK9e(Lgm?=iayJq{P{hdJ1IfC{PFYscS^`FM{Zk)9e7DkmvcFSL2}g zJfG+J)A@owUM!y3$!WD3#!=h&jRv93mplH!%(INzU{D#umR*~?tE8}@$LO>cEgWZ4 zn{a>6xlK98xUm&@zRUTiv1(ncV<39bf#_DXFgn1QY;p+j%H`0^(R<6P+q_c_{jE(^ zFSaUO5PctGJp55FpO+^FJ1v)$G4*G0I4Eh#BVo=4)t7Q?hq|r1H5TW+R;aX;NXtfO zAvfhmH4c8la*H=wnGz*>!nbm8<<*$=8}0tueTUgaNLX+cMj;JwrGLXK?>){!JB6m| h)@lYH{CIvS@BH8T^=S{Y*ku1&s26T_3KaP1fH z1^f!)3w+?hslR}P$~a4DB_^8DJkP|>^X#*ootU8g`10+|caM;t4%{{$!9Kcqh(QqH zNus>WQ#7L@yJzyqbMt8591JB*7*2l7!k=Ri!Tas%?y&s8)b9D_6R0Qw00y zW{v?!<_VHf;gw#-z^?;G0F!zud=ZpXOvLnpitvJAJrog=#Wp&=WEro=KiW$dS+s74e(bS#Utg!Z-*kXK)6*jxo`L}>K|8!WvXkYAE-4-l zm!_+ATdlz0Y{f?|p(*=y!VtOXcvC2_{uqOI6-aTCL^kB(I_Ea#9Qy_dnBU?2{ZL5P z>yUsB8Uf9!0;3(5jSplG`lZ`NGq(^Ou8S?UaofRPVZRc6AFE^dWe%U_X9l#%j|*d} z4{*@8%H%J=ocC>)t3mdateO&ud8b>v9HkKEHE2+q{GT@Ys8D`$eL3p6_+QT_yWK{+ zCo(}dGYlc4SAO7o6u;ST|7xtBB)*MAT{LC8E8dRdjU$c4o8xb@2e^w3pKXPD?j|=* Hj~V*|vRJ;A literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0005_auto_20200524_1354.cpython-38.pyc b/markt/migrations/__pycache__/0005_auto_20200524_1354.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2236874300fab0718d4c51a872146854ca60cb1 GIT binary patch literal 1058 zcmZuw&2H2%5Kf%m{cE=r1f03Bm(^0XLP7|&YAIBxKWeueq6jNnPnV=gyx2*l_6pbS z6L5eF5--66@Cd$g;>-mh1dOv?s05ZgnejNE{e3e&XtnAFj*ss@JwLY%;w_@8545hJC}U-!gra+eDD&V)mWW1 zCgg~)CU|da?+o->n5koCZen8OV$^_U(n`E!E}3WZtgZKtY_@-`~)^MplYlMhzi)!0tri}Ypba0G}+wD3mAczM)i%9N5#zN0^(8r z6yFh*$0TW`C^^I5_Kxw%|DCX j=~L^@BsBVq` zq@a=%OwtuCI7Cex8o;EP$_P(<&E({oV=j?XY?S!f(L)Dp7wgKdd;cuY^BqwQy%CFi zf%al4UTp6yeQc}*>*IH}Zrq1(;Z#-a+DGl6RK{`KFrsKH4Hyd;f2u*r<80;=F~)`P zsSsELT&IQbkIs@&uVa%;XXdyQ$5&&@QUSQ;6RzG9|Jx$9o*CNjo2rc z9^top`>H%~U|o4sIai;_VlQr8$C6!#+d)-{dRr5drx0<%*Qkfa}8Ud*UxYPo7-> literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0008_factuur_orders.cpython-38.pyc b/markt/migrations/__pycache__/0008_factuur_orders.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47bb51dd275726341e497925984b0607cf7b1ce2 GIT binary patch literal 757 zcmYjP&2H2%5O#hyn|7rNp&|q?kV_O+tw0q*tqRKlwMEcgq6jP9nJ!6_c(Id8%N4GD z2d*4=5gx%;PJIQ0RL0p|s4b8D+5SB9efHUC6f$bxe*FA!-)8KW0e72AV4sGHDF6ej zVzrf8wVm3Q!FJ`O?rR1PxL+B#XqDa83T$!pYZAH9nLE6`hWi3;Tv5}_v_Mx9TA-5jC`<%rT1C#SCtPjx8fxU&8`laGkqhu`9GFFT|1RCbgrRb1ggD{7U!M0MGUc~+Cy zqAHphmBr^$(DT(b!K_4y^&&KttW55IFX& z>$#RqecQ7CxVQa&IeuS5C|qf0=iTYR;Vu_X&eVTsl*H`AHu+o@Cja- z_yq>aP1=gbm3-uLeSCb62P-Q+!P0}syZ)F08B#&;I*sYj0XOw(W8pqCW|?e~aHnqq3?rS6YBJc4^LS>%3{8+?Pr~#`8#mb!$8emTa3h z4bH94ISQ%_aNp(pzKXJ1R5JkuzQhZy@SCJW8m6E@K7@CwDw~Ai92e0| zh>5p3ig1K~!F$Dnc5s3gF0+czcG%SQT*@f>a;MGNS>V`?NTWPfJ#o_nYWhE;&vxs0 R-L`jUzp_`mnmT;f`3B8Wn-l;5 literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0010_factuur_orders.cpython-38.pyc b/markt/migrations/__pycache__/0010_factuur_orders.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0ba2a45996368faaed8c1812b09b78551bd1d5b GIT binary patch literal 737 zcmZ8f&2H2%5O$p3O}kQ0mH2sqy+q*#2%%Pm_JGBs# zco81KS5CchL_%ep-Gz#YJn}al&&>D5=i_nA$l%-e4?i8oepqndJOX>PbV3doI5lgW z%xQSW9gBJGX5JA47rZYFJaj7mvzz(A-?NE-OLy3Wo46_Gs_07DY7;aPu+}G2dv@O< z0(-RdQ*y{M2Uy0znLC+_UPTqb#h?nQM^uffpo*(4@FBQyA-r)ZYa1f!IWnW;O*883 zH-)NIp9zJHyh1T6rd{7FAr+v~CR}3^oDP9ol7U@s4HuIkG;vJ`I4k<0;q>kP_U?w$Nnl1RG6`G^yjN@={0%0n imy&E~s$I*+R{qCqwR=o46TMg|{L+f1ZQ70#xqkq&w$-Wt literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0011_remove_factuur_orders.cpython-38.pyc b/markt/migrations/__pycache__/0011_remove_factuur_orders.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..475bfee28f66ebfac6eae23b14f29c8638986a29 GIT binary patch literal 558 zcmZ8dyH3L}6t$hClu#ZLf54Unl@%cb0>M;}fG$yl73xb!8ppv-Ds_gH4`JdH*!cvn zO#A`^olRE18(Lu#=?DI$UDMA z(~eyne7gnAdNS7IDqQdPxBC1#9#wU%xzYl(u?urY>E+QA7rxXcPd*I_f)b19?j!=1HfCxK%ZMHUx{+7wr9ptk=r`qyp^ SuiNg<*RSk0uBHj!b3OqkLYoHw literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0012_order_factuur_id.cpython-38.pyc b/markt/migrations/__pycache__/0012_order_factuur_id.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3cc25cc7bf369091f82113b08d13934af979dfd GIT binary patch literal 766 zcmYjP&2H2%5VrHPn+;v5;sE0Bz%iGoDAqw)Obug^~$#(rCHcX$MLY3i5^FyJMt zc)}|uak#}!=_cMA1}=Et8FK!u35)LeJfG>FBqF2z3;NqwlQ;wjR6r&<6?tu@ZD;LHPTzPbE116L;G?T-1 zI?C-=nL2OH!W(;_i zb!BTNvKGVwTQp89XOTw~EiF-J6&kO%{#lMCn9W9^Mnzdy!AH^51foAFgb9V9$gV_M zZwPVGWu=X_2(ZB#u%73r74?RhU=LtsZ&j{^;Y=#b7xg<_nh_LPy^zL%Qxo*1k=kbb z;p6+`*ZapNlnt&r@PnzR6y2LY7yCQu36-bQ!%XY^68BnJ>GS~gc`KW=BC>gz*9$63 zG)htztBPP+AW6AQzsRobMM_t8Exb-i?-zr>w{qtYH%nz-)R?BePbP4k8_)N+L*E1L z{Pk}7{b*z+1ECmBd+r0{N4L&+ct-J>s(NTS*}MO<8&=QAXM&f5%CD?&+8*2Ff%^}+ CLEi!Z literal 0 HcmV?d00001 diff --git a/markt/migrations/__pycache__/0013_auto_20200524_1434.cpython-38.pyc b/markt/migrations/__pycache__/0013_auto_20200524_1434.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac16d78aff5c3ba445782cf012f50069cf1f1a9d GIT binary patch literal 726 zcmYjP&2AGh5cYb1vRN7_hjJ)ykjpAf0|$gqtCk>yS`f6C)e37HPs484>tK74!WFK4 z5N#+w9c%OlU{nelv|eK8m$1jq2(_jf-%LVh^s?g-F1#HCX-oN%uu z!pl5CGwL~?)_xW|C*0@37s3PZs_?U)g`B=6qwp8zkP)?sC>N?QrEIi~gyc}`v$;FF zJ9_9G;?j@M0LeT~GRnP$m-!G>Sdse>RXvESeicV8K=?1|Hec3Q<7YtZxY8UG~4ohe_H1iU)qDa*yN3{Vp zb5)ez0W+zfTr@9XWg}h{%|cqrFKyg)f-2hH>o>2?pB{p`pFuOCq_3`8U zLW9!zX`yxb5sr)$IzIt@ZR9c+ZEecBY!=uUTPlgKBLup61q#F}e=l3pNs({tR#cs% zmIth8jbxMYWITR2nX>)q!8Bd2l>00074;BJ?9OuPP?$77yEw!9{bN5 literal 0 HcmV?d00001 diff --git a/markt/models.py b/markt/models.py index 2dfbdec..4f23799 100644 --- a/markt/models.py +++ b/markt/models.py @@ -16,6 +16,9 @@ class Houtsoort(models.Model): def __str__(self): """String for representing the Model object.""" return self.Houtsoort_naam + class Meta: + db_table = "Houtsoort" + verbose_name_plural = "Houtsoorten" class Formaat(models.Model): @@ -29,7 +32,10 @@ class Formaat(models.Model): def __str__(self): """String for representing the Model object.""" - return self.Formaat + return self.Formaat + " " + str(self.Lengte) + "m" + class Meta: + db_table = "Formaat" + verbose_name_plural = "Formaten" class Houtmarkt(models.Model): @@ -38,7 +44,14 @@ class Houtmarkt(models.Model): max_length=255, help_text='Houtmarkt naam') Houtmarkt_tel = models.IntegerField() Houtmarkt_addr = models.CharField(max_length=255) - Houtmarkt_type = models.BooleanField() + TYPES = ( + ("RE", "Reseller"), + ("SE", "Seller") + ) + Houtmarkt_type = models.CharField( + max_length=2, + choices=TYPES + ) def get_absolute_url(self): """Returns the url to access a particular instance of the model.""" @@ -47,14 +60,17 @@ class Houtmarkt(models.Model): def __str__(self): """String for representing the Model object.""" return self.Houtmarkt_naam + class Meta: + db_table = "Houtmarkt" + verbose_name_plural = "Houtmarkten" 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() + Houtmarkt_ID = models.ForeignKey("Houtmarkt", on_delete=models.PROTECT) + Hout_ID = models.ForeignKey("Houtsoort", on_delete=models.PROTECT) + Format_ID = models.ForeignKey("Formaat", on_delete=models.PROTECT) + Prijs = models.FloatField() Voorraad_Amount = models.IntegerField() def get_absolute_url(self): @@ -63,7 +79,10 @@ class Voorraad(models.Model): def __str__(self): """String for representing the Model object.""" - return self.Voorraad_ID + return str(self.Format_ID) + " " + self.Hout_ID.Houtsoort_naam + class Meta: + db_table = "Voorraad" + verbose_name_plural = "Voorraad" class Klant(models.Model): @@ -81,17 +100,42 @@ class Klant(models.Model): def __str__(self): """String for representing the Model object.""" return self.Klant_naam + class Meta: + db_table = "Klant" + verbose_name_plural = "Klanten" + +class Order(models.Model): + Order_ID = models.AutoField(primary_key=True) + Voorraad_ID = models.ForeignKey("Voorraad", on_delete=models.PROTECT) + Factuur_ID = models.ForeignKey("Factuur", on_delete=models.PROTECT) + Amount = models.IntegerField() + + Prijs = 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.Order_ID)]) + + def __str__(self): + """String for representing the Model object.""" + return "{} {}".format(self.Amount, self.Voorraad_ID) + class Meta: + db_table = "Order" + verbose_name_plural = "Orders" + + def save(self, *args, **kwargs): + self.Prijs = self.Voorraad_ID.Prijs * self.Amount + self.Voorraad_ID.Voorraad_Amount -= self.Amount + self.Voorraad_ID.save() + return super(Order, self).save(*args, **kwargs) 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) + Klant_ID = models.ForeignKey("Klant", on_delete=models.PROTECT) + Orders = models.ManyToManyField("Order") Korting_percent = models.FloatField() - AMT_Sold = models.IntegerField() - Subtotal = models.FloatField() - total = models.FloatField() + 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.""" @@ -99,4 +143,12 @@ class Factuur(models.Model): def __str__(self): """String for representing the Model object.""" - return self.Factuur_ID + return str(self.Factuur_ID) + def save(self, *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"