From 70a0536de19f47a184c578881687254743b206f1 Mon Sep 17 00:00:00 2001 From: seba Date: Thu, 2 Dec 2010 10:35:02 +0100 Subject: [PATCH] its working now but i dont like the relationship order shouldn't have to know about his purchases purchases should know their order! purchases would be accessible by calling order.purchase_set() --- k4ever/buyable/models.py | 3 ++- k4ever/k4ever.db | Bin 65536 -> 65536 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/k4ever/buyable/models.py b/k4ever/buyable/models.py index 02938c8..9253d84 100644 --- a/k4ever/buyable/models.py +++ b/k4ever/buyable/models.py @@ -48,6 +48,7 @@ class Order(models.Model): def addItems(self, items): for item in items: self.purchase.add(item) + self.price += item.price def __unicode__(self): return "Price %s, User %s" % (self.price, self.user) @@ -58,7 +59,7 @@ class Purchase(models.Model): buyable = models.ForeignKey(Buyable) def __unicode__(self): - return "%s%s, %s by %s" % (self.buyable.name, self.isDeposit and " (deposit)" or "", self.price, self.user) + return "%s%s, %s" % (self.buyable.name, self.isDeposit and " (deposit)" or "", self.price) # def save(self, *args, **kwargs): # profile = self.user.get_profile() diff --git a/k4ever/k4ever.db b/k4ever/k4ever.db index ac5ad46ab160f60b36442025939bd16359fd1ea0..59f1e3bc808c9b9df86c273cc6e69ffce5737d82 100644 GIT binary patch delta 1088 zcmaiy&ubGw6vyZ7n@Mz5c#;He&Tc5*1BHO^zcv+R7{_q|LUM>i2KNNmh2E!TSTF`*Jr~}T)pg{I8AQXC=ew4HFI+n+RJOT+b%M{Zj&8U#K@40a_!(DQp`2b}m|~Owq*#jTlM+ITYA5SZ>mUb`lkcA&{k+D! z6k}-$%0+qnBRz{331Ep}X*W~@1uUOQF#_pP82R2v*1T<6=8$C%nRcHUghGUlRW?ma z1h(>i9OY?0+}CjkX?(U*yV9K!{ITlfi=@C7c!dD_79-Heemz{s1HJArQ6da*9_ zQZKNbFxrTC>-LdiUyjTXe24RR8IKt+jhjY4e1(T_1IlEZJSB6gk;>`e+(9x5(Ct9B z?L%ZJW!Vw7w4G?FalDl63|dy;N#J(0+&EgwbY!LPOQ~3)*{;s4>kCT&mzw3BS?T&# z0NhE~_)%l>Tpl;o5H$&IV6zqKCoiMPFc~4O$pjo$n~;pwR5CjIX4whPbe5i*Jy}gP zF>3_Zc0*Nrjc$?$%9r%&3axQ%&sJ9~>2wEw;bzjW?zE_Lbxol98MPYm&JUi!94!Oc8@C>cbbKwMM; z9qizwLtQ$Fh%Q2Y={w(lIQ(JA!;o(eQFUjyOx2U+4SzrcLaMQZ zke(~z2Y;l{OUN>0wR)W47h2SqFGsnBM9~UE1rifx~=T$w+iTV}hSZBDyDR!~0F0NqH`> zDtgkEB@@3ZZs53<6t?f#ruLU2N|qyhcS@S{n_>jcR3JUecYM!xK3*gw42gQKfjHUB z74j)MV7SCSmSAY-+L|^-4LVT57HQL|$llAvXM3}=Uu|?4I;xEX8K&dAj4n1lF@1K# z(Ns2G&_Yw4yN3P|q3G$z=pl3?#Ny6lUpk*ct*hf6x41$bH5EKYRC^8n-@ke9_i2E3