Re: Question on passing user to model objects

2010-12-13 Thread Scoox
Hi Daniel, > However, calling foo.bar_set multiple times does *not* get the same > queryset each time. Okay, that was new to me :-)... Do you know what the reason for that is? > I discuss this a little in a blog > entry > here:http://blog.roseman.org.uk/2010/01/11/django-patterns-part-2-efficie

Re: Question on passing user to model objects

2010-12-13 Thread Scoox
> >     isEditable=0 > >     login=0 > > Assuming these two previous lines are at the top-level of you class > statement, both attributes will be class-attributes (that is "shared > by all instances"). I don't think this is what you want. Yes but that's what I intended. They should (and do) not all

Re: Question on passing user to model objects

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 11:20:21 AM UTC, Scoox wrote:Hi Daniel, thanks for your answer. Sorry, cmp should be c. I tried to only give the import parts to make it more readable, but I made a mistake there. The model code is pretty standard, except for one function: isEditable=0 login=0 def edit

Re: Question on passing user to model objects

2010-12-13 Thread bruno desthuilliers
On 13 déc, 12:20, Scoox wrote: > Hi Daniel, > thanks for your answer. Sorry, cmp should be c. I tried to only give > the import parts to make it more readable, but I made a mistake there. > The model code is pretty standard, except for one function: > >     isEditable=0 >     login=0 Assuming the

Re: Question on passing user to model objects

2010-12-13 Thread Scoox
Hi Daniel, thanks for your answer. Sorry, cmp should be c. I tried to only give the import parts to make it more readable, but I made a mistake there. The model code is pretty standard, except for one function: isEditable=0 login=0 def editable(self): if self.login==0: return F

Re: Question on passing user to model objects

2010-12-13 Thread Daniel Roseman
On Monday, December 13, 2010 10:22:32 AM UTC, Scoox wrote:Hi guys, I have a (probably easy) question. I need to pass the logged in user to my objects. I have the objects company and offer. I tried the following on the project's index / start view: c = Company.objects.all() cmp.login=request.use

Question on passing user to model objects

2010-12-13 Thread Scoox
Hi guys, I have a (probably easy) question. I need to pass the logged in user to my objects. I have the objects company and offer. I tried the following on the project's index / start view: c = Company.objects.all() cmp.login=request.user for j in cmp.offer_set.all(): j.comp