Re: custom method in view/models

2010-02-24 Thread soFh
Sure Tim its this function in my Ast Model: def minz(self): y = self.billsec/60.0 for i in Rates.objects.all(): l = len(i.prefix) if i.prefix == self.dst[:l]: rated = i.rate

Re: custom method in view/models

2010-02-23 Thread Timothy Kinney
Can you show me how you got it to work? I'd like to learn from this as well. Cheers. -Tim On Tue, Feb 23, 2010 at 8:39 PM, soFh wrote: > Well its done finaly. > i was doing mistake , i was going for a loop on ASt model , while i > must goto Rates and its working perfect now . > > > On Feb 24,

Re: custom method in view/models

2010-02-23 Thread soFh
Well its done finaly. i was doing mistake , i was going for a loop on ASt model , while i must goto Rates and its working perfect now . On Feb 24, 5:19 am, soFh wrote: > no this function is working fine.here i am just converting seconds > into minutes and rounding it to , thts we call 60/60 bill

Re: custom method in view/models

2010-02-23 Thread soFh
no this function is working fine.here i am just converting seconds into minutes and rounding it to , thts we call 60/60 billing, say if user has called for 4 minutes and 1 sec then it would round up it like 5:00 rather then showing 4:01 and its exactly showing the same. I got my mistake and now jus

Re: custom method in view/models

2010-02-23 Thread Timothy Kinney
Ok, I think I understand what is going wrong. Look at your minutes function (from dpaste above in the thread): def minutes(self): if self.billsec > 0 and self.disposition=='ANSWERED': x = self.billsec/60.0 if type(x) == float

Re: custom method in view/models

2010-02-23 Thread soFh
Hi Tim Sure id caller id dialed Number Call Duration Call Cost Call Date Dest Channel Application {% for call in calls %} {{ call.id }} {{ call.src }} {{ call.dst }}

Re: custom method in view/models

2010-02-23 Thread Timothy Kinney
It would help if I could see the template you were using so I could see how the fields were being filled. Can you paste it? -Tim On Tue, Feb 23, 2010 at 5:04 PM, soFh wrote: > For More , > Please visit this snap shot of my template view : > > http://173.45.115.106/template.jpg > > This will pr

Re: custom method in view/models

2010-02-23 Thread soFh
For More , Please visit this snap shot of my template view : http://173.45.115.106/template.jpg This will probably clear me , that what i want in my column "call Cost" in my datatable. thanks On Feb 24, 2:47 am, Timothy Kinney wrote: > It sounds like you should have a look > at:http://docs.d

Re: custom method in view/models

2010-02-23 Thread soFh
Thanks tim for being with me. MY template is working absolutely fine. but its showing me data of my cdr_table thats is simple first model. thats fine , but i need one more "custom" column in my html table showing cost of call cause in my model AST there is only duration of call . to get cost i made

Re: custom method in view/models

2010-02-23 Thread Timothy Kinney
It sounds like you should have a look at: http://docs.djangoproject.com/en/dev/ref/templates/ Instead of rendering straight to html you can structure the html as a template and then feed your dictionary context in. Then your view points to the template. If your template was called test.html then i

Re: custom method in view/models

2010-02-23 Thread soFh
my prefix could be changed and hence its length too , so let me show you what i did to get the price from Rates table against prefix used in Ast.dst from cdr.cdrs.models import Ast,Rates price=0 for i in Ast.objects.all(): for x in Rates.objects.all(): l = len(x.prefix)

Re: custom method in view/models

2010-02-23 Thread Timothy Kinney
I agree, your models are correct. You just need to create a view (possibly using a template) to serve this information to the web. -Tim On Tue, Feb 23, 2010 at 4:16 PM, Daniel Roseman wrote: > On Feb 23, 9:10 pm, soFh wrote: > > Well i was already thinking that i am not so clear in my questio

Re: custom method in view/models

2010-02-23 Thread Daniel Roseman
On Feb 23, 9:10 pm, soFh wrote: > Well i was already  thinking that i am not so clear in my question. > so better let me post my model and what i want here . > > http://dpaste.com/163776/ > > sorry I missed by mistake "C" of class Rates while pasting it on > dpaste. > > Anyways there are two model

Re: custom method in view/models

2010-02-23 Thread soFh
Well i was already thinking that i am not so clear in my question. so better let me post my model and what i want here . http://dpaste.com/163776/ sorry I missed by mistake "C" of class Rates while pasting it on dpaste. Anyways there are two models. there is one field billsec in model named "As

Re: custom method in view/models

2010-02-23 Thread Timothy Kinney
Sorry, I'm having trouble understanding exactly what you want. Could you be more specific about your models and your calculations? Let me take a stab at a guess, though. Let's say you have a model City with a population field and a model WaterUse with a total_water_use field. Then let's say you wa

custom method in view/models

2010-02-23 Thread soFh
Dear All, i am just trying to learn django in various ways . And i need your help as i am bit confused here . I have two "class"es in my models , there is no relation among these both tables in database. in my view i want that when user retrieve data from one table in my html table one column sho