Re: Django Custom Models

2016-07-14 Thread AT
Thanks for this. Now everything makes perfect sense. On 13/07/2016 09:18, Bruno A. wrote: > |defget_queryset(self,request):qs > =self.model.with_expired_objects.get_queryset() > ordering =self.get_ordering(request)ifordering:qs > =qs.order_by(*ordering)

Re: Django Custom Models

2016-07-13 Thread Bruno A.
Hi, If you find yourself doing that a lot in your project, yes a custom manager is the way to go. Keep in mind that you can more then one manager attached to your model, but the order matters . For the admin purposes,

Django Custom Models

2016-07-12 Thread AT
Being new to Django I wonder if someone could point me in the right direction and I apologise in advance if this is an obvious question. I have a model with a field that sets an expiry date. In my ListView I have the following: queryset = Article.objects.filter(expiry_date__gt=datetime.now()).o