I suspect the problem is that you're receiving a user object, so the line - user = User.objects.get(username__exact=user)
isn't doing exactly what you expect. Try commenting it out and see if that works for you. -Chris On Wed, Aug 26, 2009 at 8:46 PM, neridaj <[email protected]> wrote: > > I'm new to python/django and was just trying to get that example to > work so I understand what's going on. I'm getting this error but the > user IS in the db, any idea why: > > Exception Value: > > User matching query does not exist. > > Here is my code: > > from django.contrib.auth.models import User > > def can_user_buy(product, contact=None): > """ > Given a product and a user, return True if that person can buy it > and > False if they can not. > This doesn't work as it stands now. You'll need to customize the > is_member function > """ > def is_member(user): > if user is not None: > user = u"%s" % user > user = User.objects.get(username__exact=user) > if user.is_active: > return True > else: > return False > else: > return False > > if is_member(contact): > return True > else: > return False > > On Aug 26, 8:19 am, Chris Moffitt <[email protected]> wrote: > > Take a look at this example in the docs - > http://www.satchmoproject.com/docs/svn/signals.html#example-usage > > > > It uses signals to get this done. > > > > -Chris > > > > On Tue, Aug 25, 2009 at 2:20 PM, neridaj <[email protected]> wrote: > > > > > Hello, > > > > > Is it possible to limit what products are available for purchase/ > > > download based on who is logged in? I would like to only show products > > > tagged with a specific username when that user is logged in. > > > > > Thanks, > > > > > Jason > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
