Re: RequestContext and user.is_authenticated confusion

2010-02-14 Thread Achim Domma
Hi Kev, thanks for the hint. Trying different solutions I introduced indeed a typo. Now I can see the username and is_authenticated works as expected. But still curious: Is there a good reason, why I have to pass RequestContext each time? Whenever I'm using Django and having the feeling to violate

RequestContext and user.is_authenticated confusion

2010-02-14 Thread Achim Domma
Hi, depending on if a user is logged in or not, I want to display a "login" form or a "logout" button. I tried to use this code snippet: http://docs.djangoproject.com/en/1.1/topics/auth/#id6 If I render my view using render_to_response("myTemplate.html") the user variable is empty. If I use rend

Model design question: Inheritance? GenericRelation? ...?

2010-02-10 Thread Achim Domma
Hi, I have different models A,B,C which all will have exactly on Address. If I query instances of A,B,C I usually will also need the related address. I also want to query all instances of A,B,C which have a certain zip code for example. What's the best and most efficient way to model that in djang

"Pro Django" book still up to date

2010-01-27 Thread Achim Domma
Hi, I'm interested in buying the "Pro Django" book. I could not find any hint about what version it's written for. As it covers mostly internals and the ideas behind Django, it should not be outdated as quickly as other books. Has anybody read that book and can give some feedback about how useful

getting the value of "_id" from a dictionary

2010-01-25 Thread Achim Domma
Hi, I have a dictionary having '_id' as a key. If I try to access that value inside a template, I get an error telling me, that I cannot access attributes beginning with an _. I would not like to modify the dict before passing it to the template, so is there a workaround for that? I think about

problems understanding "reverse"

2010-01-25 Thread Achim Domma
Hi, one of my url mappings is defined like this: url(r'^del/(?P.{1,100})', 'xyz.delete', name='deleteitem') In my template I try this: {{ item.field1 }} Here is the signature of the delete method: def delete(request, id): ... If I call the template, I get the following error: Reverse for ''

Implement a background thread

2008-06-06 Thread Achim Domma
Hi, I want to implement a background thread which updates data in regular intervals. Is that possible in django or via wsgi middleware? I'm quite new to this topic, so links to documentation would be fine. regards, Achim --~--~-~--~~~---~--~~ You received this mes

Re: Non-model driven ordering

2005-09-24 Thread Achim Domma
Adrian Holovaty wrote: You're right -- it's a common problem, and there's a solution for it. See the "order_with_respect_to" model parameter. http://www.djangoproject.com/documentation/model_api/ We ought to have a model example page for that...I'll try to get that together. I'm very intere

Sorted list of objects

2005-09-08 Thread Achim Domma
Hi, I'm just started to play with Django and it looks very promissing to me. For a small test app I would like to store sorted lists of items. In pure (Pseudo-)SQL I would do it like this: create table itemlists ( int unique_id, int name, ... ) create table items ( int unique_id