Help!  I have a function that is  provided below.   When I try the 
individual lines of the function  through the interpretor (Ipython) 
everything works as expected.  For example:-

 >> qset=PointTransaction.objects.filter etc....   this works fine!! 

However, when I try to run the function as a whole: Example:-

 >> admin_sync_agg(user_id=1,points_type=1)  >>

This runs but it seems that is is not iterating through the query set, 
so only the first record of qset is getting added to the balance.

Can anybody advise..  it's completely baffling me.  Thanks

MerMer


def admin_sync_agg (user_id,points_type):
    
qset=PointTransaction.objects.filter(user=user_id).filter(points_type=points_type)
    credit=0
    debit=0
    for i in qs:
        credit = credit + i.credit
        debit = credit + i.debit
    balance= credit-debit
    
pa=UserPointTypeAggregate.objects.get(user=user_id,points_type=points_type)
    pa.total_points=balance
    pa.save()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to