Non-conventional use of django templates.

2010-04-16 Thread Paweł Roman
I'm writing an application which is kind of event handling app, and the important functionality is sending emails. User can create his own email template, and when an event occurs the email is built using this template and sent. An event is nothing but a python dictionary with some values. As you m

bug in defaulttags.py ?

2010-04-21 Thread Paweł Roman
Hi I think I've found a bug in django.template.defaulttags.py get_nodes_by_type() is not implemented for IfEqualNode class. It seems like it should be implemented the same way as in IfNode. Check out this simple test: def test_get_nodes_by_type(self): template_string1 = "{%ifequal x

Re: bug in defaulttags.py ?

2010-04-21 Thread Paweł Roman
> 1.2 does not exist yet so I'm not sure what you mean when you say you > checked there. Current SVN is certainly different from 1.0 and 1.1 in this > area, see changeset 12654: > > http://code.djangoproject.com/changeset/12654 > > Does that change fix the problem you are referring to here? Yup.

Iterating tree-like data structures with django

2010-10-06 Thread Paweł Roman
I have a model which has a tree-like structure (not exactly a FK on self but we can assume that's the case). I want to visualise this tree using all records from the db. It seems impossible to do with QuerySet, if I have say 100 records (100 nodes in the tree) and I try building the tree recursive

Re: Iterating tree-like data structures with django

2010-10-06 Thread Paweł Roman
OK, I've got it. It's in_bulk() :) Nevermind the question. On Oct 6, 5:27 pm, Paweł Roman wrote: > I have a model which has a tree-like structure (not exactly a FK on > self but we can assume that's the case). > > I want to visualise this tree using all records from th

Re: Iterating tree-like data structures with django

2010-10-06 Thread Paweł Roman
Correct me if I'm wrong but this is hundred times more useful than current in_bulk() implementation. On Oct 6, 5:31 pm, Paweł Roman wrote: > OK, I've got it. It's in_bulk() :) Nevermind the question. > > On Oct 6, 5:27 pm, Paweł Roman wrote: > > > I have a model whi

I have an idea for a new tag

2010-11-19 Thread Paweł Roman
When rendering dictionary, there is absolutely no way to display values sorted by keys. The only workaround is to copy all the dict items to a sortable structure e.g. list and pass the list to the template, instead of the dictionary. Why not introduce a new tag to solve this problem: I say, it sh

Formatting datetimes - simple question

2010-04-06 Thread Paweł Roman
Hi all, Django has this DATETIME_FORMAT setting, which allows to format all datetime values, whenever they are displayed. But the problem is this is a _global_ setting, so whoever uses the application would see all the datetimes formatted exactly the same way. I'd like to allow individual users to

Why is django returning only naive datetimes?

2010-04-09 Thread Paweł Roman
I've noticed that django always fetches 'naive' datetimes from the database. Tzinfo property on a datetime object is always set to null, even if the database stores a value WITH a timezone. This is a bit tedious because such datetime cannot be later converted to any timezone. Each time I want to d

Re: Why is django returning only naive datetimes?

2010-04-09 Thread Paweł Roman
> This reminds me that we need to open-source our time zone code.  We > track entertainment events across several time zones, and Django's > standard time handling can't cleanly deal with that.  Database > backends that store time zones as a UTC offset (e.g., PostgreSQL) > actually cause *more* tro

Running django on IIS

2010-04-14 Thread Paweł Roman
I'm trying to run django on IIS and SQL Server 2005. I've found this nice page with all instructions: http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer I followed all the instructions, installed PyISAPIe, created virtual directory, mapped the .py extension to the PyISAPIe.dll.

Re: Running django on IIS

2010-04-14 Thread Paweł Roman
> I suspect it is trying to import Http but can't. > > Fire up python (Start -> Python Interactive Shell, or Start -> Run -> > cmd -> type python), and type: > > import Http > If that doesn't work, you haven't installed it properly. See the > following quote from the Django wiki: > > "•Go to c:\pyi

Can django admin log be trusted?

2011-05-10 Thread Paweł Roman
This is serious. A customer I've been working for, claims that he had been adding data via django admin panel (100+ or so records, and one record is really big, using many 'inlines' each with its own formset etc. so adding 100 such records is quite an effort) and at some point of time, large part

Re: Can django admin log be trusted?

2011-05-10 Thread Paweł Roman
You're right, I've just checked it and there's a gap for 100+ ids, so he must be right. But does that mean that the django admin log is broken and cant be trusted? How come there isnt any trace of adding those items? On May 10, 11:28 pm, Shawn Milochik wrote: > For what it's worth: > >      Rega

Memcached backend - caching data with infinite timeout

2011-05-17 Thread Paweł Roman
Python-memcached docstring for set() says this: """ @param time: Tells memcached the time which this value should expire, either as a delta number of seconds, or an absolute unix time-since-the-epoch value. See the memcached protocol docs section "Storage Commands" for more info on . We default to