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 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: Rendering a field value in a custom way

2010-12-13 Thread Scoox
. Kind Regards Scoox -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For mo

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

Re: Rendering a field value in a custom way

2010-12-11 Thread Scoox
Okay, I *think* I figured out a way to fix this. I can add methods such as get_stars to the relevant model. Then in that method I can do whatever I like with the string (e.g. convert it to star symbols). Would that be the recommended way to do this? Kind Regards Stephan -- You received this

Re: Rendering a field value in a custom way

2010-12-11 Thread Scoox
Note: Why do I not to use filters? 1. It's nicer if the designer doesn't always have to put |(...) behind the field name. 2. I do not know how to access the object passed in the filter. E.g. if I use {{rating.stars|muBeautify}} the muBeautify filter would only get a unicode "5", but how would it k

Rendering a field value in a custom way

2010-12-11 Thread Scoox
Hi guys, I want to be able to render a custom field. It's supposed to extend a normal char field. I want to place certain content in front of the field, depending upon the fields value. As an example take a simple field that allows entering a number. Instead of displaying the number, I would like

Beginner question on admin interface

2010-12-06 Thread Scoox
Hi guys, I hope this has not been asked yet, it's a total beginner question. After finally getting Django and PyDev set up on my windows machine, I am now going through the tutorial. I am planning a kind of black board, where users can post entries including things such as images. Now my questio