This is my django snippet to calculate custome stmts but it displays the error from optionsAlpha.models import MarketUpdate from datetime import datetime from django.db.models import Q
def stock_up(ticker, test_start_date): #stock_value=0 mu1 = MarketUpdate.objects.filter(Q(stock_symbol=ticker) & Q(update_timestamp__gt=(test_start_date))).order_by('stock_value') #print mu1[0].stock_value max_stock=mu1[0].stock_value count=0 for i in mu1: if i.stock_value >= max_stock: max_stock = i.stock_value count+=1 return count Output when calling this method from django shell: >>> dat datetime.datetime(2011, 3, 19, 8, 58, 28, 999615) >>> ticker 'GOOG' >>> stock_up(ticker,dat) Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/hirelex/optionsalpha/optionsAlpha/trade_count.py", line 6, in stock_up mu1 = MarketUpdate.objects.filter(Q(stock_symbol=ticker) & Q(update_timestamp__gt=(test_start_date))).order_by('stock_value') TypeError: an integer is required I had tried it to solve it is working fine in django shell but couldn't able to call it as a method Could you please point this? -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.