Re: How do I call a query set from views.py

2013-01-13 Thread frocco
Thank you... On Sunday, January 13, 2013 1:29:15 PM UTC-5, frocco wrote: > > > in models.py > > def get_categories(self): > return self.objects.filter('category_class <> "sales' > > in views.py > > data = Category.get_categories() > context = Context({'title': 'Search', 'form': form, 'dat

Re: How do I call a query set from views.py

2013-01-13 Thread Amirouche Boubekki
Héllo frocco, 2013/1/13 frocco > > in models.py > > def get_categories(self): > return self.objects.filter('category_class <> "sales' > Use classmethod decoratorto achieve that, like this: @classmethod def get_categories(cls

How do I call a query set from views.py

2013-01-13 Thread frocco
in models.py def get_categories(self): return self.objects.filter('category_class <> "sales' in views.py data = Category.get_categories() context = Context({'title': 'Search', 'form': form, 'data': data}) return render_to_response('index.html', context) this is not working. -- Yo