Re: Custom Model Manager

2017-05-25 Thread 'David Turner' via Django users
Apologies I was being really a bit too clever. I just need to put the deault manager first in my model and then use my custom manager in my view queryset and everything is fine. On 25 May 2017 at 18:01, David Turner wrote: > That would be fine if I was using 1.10 but this is a legacy system usin

Re: Custom Model Manager

2017-05-25 Thread 'David Turner' via Django users
That would be fine if I was using 1.10 but this is a legacy system using 1.9. This will be upgraded in the foreseeable future to 1.11 Thanks On 25 May 2017 at 17:01, Melvyn Sopacua wrote: > On Thursday 25 May 2017 08:37:32 'dtdave' via Django users wrote: > > > > > My application model has fiel

Re: Custom Model Manager

2017-05-25 Thread Melvyn Sopacua
On Thursday 25 May 2017 08:37:32 'dtdave' via Django users wrote: > My application model has fields for candidate and jobs. > My problem is that once the job expires it is being dropped from both > the candidates and the applications as obviously the expired items > manager is the default. > Any h

Custom Model Manager

2017-05-25 Thread 'dtdave' via Django users
I apologise if this is a simple question but I am still somewhat new to Dajngo. I have the following models: Jobs Model Candidates Model Applications Model The jobs model has a manager on it as follows: class ExpiredManager(models.Manager): def get_queryset(self): return super(Expire

Using annotate() in a custom model manager

2011-08-19 Thread LaundroMat
Hi - I have these models; with one custom manager. class OrderByHighestScoreManager(models.Manager): def get_query_set(self, *args, **kwargs): qs = super(OrderByHighestValidationsManager, self).get_query_set(*args, **kwargs) return qs.annotate(score=Count('votes__id'),).order_

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-31 Thread RajeshD
> > For instance, taking the example table below I would need to show > that UserID 1 has 280 "REG" points and 150 ZZZ points. > > User ID-- Points Points_Type > 1 200 Reg > 1 80 Reg > 1 100 zzz > 150

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-31 Thread MerMer
Many thanks, Rajesh. I'll take a look. MerMer --~--~-~--~~~---~--~~ 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

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread RajeshD
Hi Merric, Your working solution (the one without a custom manager) is simpler and straightforward. Just wondering if you see a particular advantage in trying to use a custom manager to accomplish this. -Rajesh --~--~-~--~~~---~--~~ You received this message be

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread MerMer
Or, list here some of the calculations you are trying to work > out so you can get more feedback on this. > I have a table which shows Points owned by particular users. These have an attribute of "type". I need to display back to the user how many of each type of points they own. For instance,

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread RajeshD
> 1. I need to enhance the underlying solution. I need to do some more > in depth table wide caculations, working out averages etc, but based on > a user-id. The documentation suggests that the table wide code would > best be placed in a model manager. Here's a thought: class UserPoint(model

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread MerMer
Rajesh, I wanted to see if I could do it for two reasons. 1. I need to enhance the underlying solution. I need to do some more in depth table wide caculations, working out averages etc, but based on a user-id. The documentation suggests that the table wide code would best be placed in a mode

How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread Merric Mercer
).get_query_set().filter(user=username) @register.inclusion_tag('points.html') def show_points(username): qs=PointTransaction.objects.filter(user=username) # This works fine without using Custom Model Manager #qs=PointTransaction.userpoint.all()# This doe

model_set.all filtering and custom model manager

2006-10-25 Thread Robert
Hi, My ModelX is: user = models.ForeignKey(User) place = models.ForeignKey(Place) date = models.DateTimeField() taken = models.BooleanField() Now I need to fetch all the ModelX records via Place object.modelx_set.all but I only want to fetch records with date now/in the future. This would be: