Re: template problema in deployment system

2007-02-09 Thread Karen Tracey
This: o /home/ivan/django-projects/immobilhouse/templates/home/index.html > (File exists) would appear to indicate the template loader was able to find the file but not read it. Are the permissions set on your template files/folder so that the apache process can read the templates? Karen

Running django with stackless

2007-02-09 Thread krypton
Guys I m using threads to use concurrecy in my webapps and I find it to be needlessly slow, because most of the stuff thatI try to do with the thread are like, send messages, update a long running thread, update rss feeds etcc., ie they do not need context and Hence i do not need threads Upon

Re: how to make a list of allowable arguments for filter()

2007-02-09 Thread abe
> > I really tried hard to understand your problem, but then my brain > started to leak out of my ears and I had to stop. :-( > > Could you post an example of how all these models are related? You seem > to have Relmodl2, model2 and model1 and I'm not sure what all the > linkages are. > > I think

Re: Trouble with relations

2007-02-09 Thread Russell Keith-Magee
On 2/8/07, Henrik Lied <[EMAIL PROTECTED]> wrote: > > Hi there! > > I guess I'll have to call Entry.objects.filter(ARGS HERE), but exactly > what args I should use I don't know. The easiest way is to use the ``latest`` operator: FrontPageEntry.objects.latest('added') This will return the entry

Re: Inserting dummy content

2007-02-09 Thread Russell Keith-Magee
On 2/9/07, Henrik Lied <[EMAIL PROTECTED]> wrote: > > Hi there! > > I was wondering if there's an easy way to insert a lot of dummy > content into a couple of models. Have anyone written something that > does this? Yes - it's not quite in Django yet, but it will be soon (before v1.0). Its the

Problem with a Class

2007-02-09 Thread xgdlm
Hello, I found this very interesting post : http://groups.google.com/group/django-users/browse_frm/thread/bb7f406bffd697f5 Then I tried to apply this modele to mine, but I have trouble ! Here is the class : # class

Creating HTML emails

2007-02-09 Thread Tipan
I've been able to create Plain text emails to send to users with an authentication link which work well, however I'd like to improve the look of these by outputting in HTML with a logo. If I use the send_mail function it simply incorporates the HTML in the plain text. Can anyone point me in the

Installed apps settings, necessary?

2007-02-09 Thread voltron
Hi all, going bto install apps, one must add them to ty the book, the INSTALLED_APPS tuple setting, I noticed however that one that one can wire up views and in app directories and they work fine even if not added to the tuple in the settings file. My question: what are the advantages of adding

Trouble with models

2007-02-09 Thread DuncanM
Hi, I know this isn't necessarily a Django specific problem but I am using django to develop my system so here goes. Basically I am making a system for a football team (soccer for you americans) and can't seem to get my head around a way of possibly doing it. I've left out some of the other

are the Installed apps settings necessary?

2007-02-09 Thread voltron
I posted this yesterday, but It did not show up, strange. According to the manual, one has to add apps to the INSTALLED_APPS setting tuple to make the usable in a project. I have created several test apps with views wired to urls in the projects url conf file, I was able to call up all urls

[howto] Django profiling with hotshot and kcachegrind

2007-02-09 Thread [EMAIL PROTECTED]
The link: http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and- kcachegrind/ The cool screenshot: http://www.rkblog.rk.edu.pl/site_media/resources/ python.rk.edu.pl/images/djangoprof2.png Kcachegrind can visualize profilers logs in many nice readable "formats". Hotshot is a python

how to postpone HttpResponse but still get new requests

2007-02-09 Thread Dill0r
Hi, i got a producer-consumer class which await new items from the clients, does sth with them and provides them to all clients. the url "getNewItems" is for getting the new Items and vice versa. my problem is: when i wait for new items, i cant get new, cause this stuff is all in one thread.

Inserting dummy content

2007-02-09 Thread Henrik Lied
Hi there! I was wondering if there's an easy way to insert a lot of dummy content into a couple of models. Have anyone written something that does this? The reason I'm asking is that I'm writing this social networking app, and in a while I'm going to present it to a company. It would be nice to

oldforms, file upload, rename & save

2007-02-09 Thread sandro.dentella
Hi all, I spent the last 2 hours fighting with a model.FileField that I wanted to save the file with a custom name (job number of a hylafax server). I found a related thread here: http://groups.google.com/group/django- users/browse_frm/thread/f337faf5ef5d8f9a/3c183363b21b496d?

Django Server Tools

2007-02-09 Thread Gacha
Hi, I made a small script that helps me to deal with many Django app on the same server. Maybe somebody has similar script's or techniques to do this job, please share with it. I just want to know, should I develop it further or there are better ways to solve this. link:

Creating HTML emails

2007-02-09 Thread Tipan
I've been able to create Plain text emails to send to users with an authentication link which work well, however I'd like to improve the look of these by outputting in HTML with a logo. If I use the send_mail function it simply incorporates the HTML in the plain text. Can anyone point me in the

new forms - problem populating with data from a table

2007-02-09 Thread Tipan
I'm new to Django and a relatively inexperienced programmer. I've started working with the new forms and have been able to take user input, validate it and write it to the table. Really slick and with minimal code. Great. I now want to take an existing user record and create an edit account

I checked out psycopg2 out of svn and installed it and got these errors

2007-02-09 Thread mobil
Hello guys I checked out psycopg2 out of svn and installed it and got these errors any ideas on how to fix them Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 60, in ? from _psycopg import BINARY, NUMBER,

python manage.py broken

2007-02-09 Thread Arnaud Delobelle
Hi all Today I have moved a project that I have been working on to subversion. Prior to doing this I made a copy of the source tree and remove all the *.pyc and the "dot something" files. I then imported the whole tree to a subversion repository and checked it out again. I worked on it all day,

template problema in deployment system

2007-02-09 Thread enrik
In development system the templates is ok, but in deployment it is not ok. I use apache 2 and mod_python 3 in according with ufficials docs. Follows the error page when I request the resource by url: TemplateDoesNotExist at / home/index.html Request Method: GET Request URL: http://ih.local/

Trouble with relations

2007-02-09 Thread Henrik Lied
Hi there! I'm currently working on a project which mixes user generated content with journalistic content. The system lets users vote on an article, and articles with many positive votes will come up in the admin-panel, so that the moderators can label the entry for front page status. class

Sorting a query set

2007-02-09 Thread MerMer
Is it possible to sort a query set based on an integer in one of the fields. MerMer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Best Practices for faster template rendering

2007-02-09 Thread Derek Lee-Wo
> I took a look and traced the bottleneck to lines 125 and 127 in > viewPlan.html. The problem was as Malcolm hinted -- you're > doing a foreign key lookup ({{ workout.workoutType.name }}) > for each iteration of the for loop. > > I changed line 55 of views.py to use select_related() instead > of

Re: Best Practices for faster template rendering

2007-02-09 Thread Chris Nelson
Derek Lee-Wo wrote: > The app I have is pretty simply as I'm just beginning so I didn't > bother to try and make it any smaller. I've ZIPped the entire > project directory and it can be downloaded here: > > http://www.roadtoboston.com/media/RoadToBoston.zip > > I took a look and traced the

Re: Use of post_save on newly created objects

2007-02-09 Thread Malcolm Tredinnick
On Fri, 2007-02-09 at 22:09 -0500, Benjamin Slavin wrote: > Howdy all, > > I was investigating post_save to perform some associated setup for an > object after it's created. My only concern is that I can't seem to > find any way to check if the object was created on this call to > save()... I

Use of post_save on newly created objects

2007-02-09 Thread Benjamin Slavin
Howdy all, I was investigating post_save to perform some associated setup for an object after it's created. My only concern is that I can't seem to find any way to check if the object was created on this call to save()... I only want to perform the setup the first time the object is saved.

Re: how to make a list of allowable arguments for filter()

2007-02-09 Thread Malcolm Tredinnick
On Sat, 2007-02-10 at 00:41 +, abe wrote: > sorry for the previous post. accidentally pressed send too early. > > I can find the models which have a certain model as a ForeignKey like > this > > modl=models.get_model('myapp','model1') > > relfieldargs = ['%s__%s' %

Re: Problems with low level caching and locmem backend

2007-02-09 Thread Lawrence Oluyede
> In the future, please don't cross post. If you're unsure, ask on the > users list first. The developers all read the users list too, so they > will see your question. The discussion will get moved to the > developers list if and when your problem raises an internal design Ok thanks for the

Re: changing maxlength html attribute

2007-02-09 Thread Waylan Limberg
On 2/9/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Btw, why is it called maxlength and in newforms > max_length (or the other way around, not sure)? > Shouldn't they be identcal? > maxlength is the old way and on the way out. My understanding is that it will be replaced with max_length

Re: changing maxlength html attribute

2007-02-09 Thread Kai Kuehne
Btw, why is it called maxlength and in newforms max_length (or the other way around, not sure)? Shouldn't they be identcal? Greetings Kai --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: changing maxlength html attribute

2007-02-09 Thread Milan Andric
In the database it is 75, same here. But the html widget was getting rendered with maxlength=30. I just realized I created a forms.py for it to define the html form. It was in there, sorry for the dumb post. Should move to newforms! On Feb 9, 3:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>

Re: use forloop.counter0 as index?

2007-02-09 Thread Brandon Warren
Thanks for the response Aidas! It was a big help to know that it was not possible. It got around the problem by writing a custom tag "ifin". So I can do: {{ ifin item list_of_items }} html to output if item is contained in the list {{ endifin }} This tag neatly solves my original problem. In

Re: how to make a list of allowable arguments for filter()

2007-02-09 Thread abe
sorry for the previous post. accidentally pressed send too early. I can find the models which have a certain model as a ForeignKey like this modl=models.get_model('myapp','model1') relfieldargs = ['%s__%s' % (m.model._meta.module_name,f.name) for m in

how to make a list of allowable arguments for filter()

2007-02-09 Thread abe
I can find the models which have a certain model as a ForeignKey like this relfieldargs = ['%s__%s' % (m.model._meta.module_name,f.name) for m in models.get_model('zb','compound')._meta.get_all_related_objects() for f in m.model._meta.fields]

Re: Problems with low level caching and locmem backend

2007-02-09 Thread Russell Keith-Magee
On 2/9/07, Lawrence Oluyede <[EMAIL PROTECTED]> wrote: > I'm not sure if it's right to post this also to the developer list > because I'm not sure it's a Django problem. In the future, please don't cross post. If you're unsure, ask on the users list first. The developers all read the users list

Re: changing maxlength html attribute

2007-02-09 Thread [EMAIL PROTECTED]
If you're having user registration, I think you're quickly going to want more than the builtin auth/user will give you. I'd take a look at extending the user model: http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model Also, I'm not sure why it's giving you a maxlength of 30.

changing maxlength html attribute

2007-02-09 Thread Milan Andric
Hello, I'm using contrib/auth User for my registration process like alot of folks but the maxlength attr on the html form for the email is 30 and that's too short. I tried modifying contrib/auth/models.py and adding maxlength to User.email but that doesn't seem to affect the form. So I need to

How do you pass a variable to a template tag?

2007-02-09 Thread [EMAIL PROTECTED]
I need to pass a user id to a template tag. After reading this: http://groups.google.com/group/django-users/ browse_thread/thread/96fe34b4561415dc/b7aba25f22bdd261? lnk=gst=template+tags+variable=1#b7aba25f22bdd261 I came up with: class SongListNode(template.Node): def __init__(self,

Re: Should newforms security fixes be posted to django-announce?

2007-02-09 Thread [EMAIL PROTECTED]
I agree it should be reported. For several reasons such as active users of SVN code (particularly since it is recommended). Also, it's better IMO to start now so ti is developed as the proper habit for when it is "release" code that would "normally" be reported to the list.

Re: Best Practices for faster template rendering

2007-02-09 Thread Derek Lee-Wo
The app I have is pretty simply as I'm just beginning so I didn't bother to try and make it any smaller. I've ZIPped the entire project directory and it can be downloaded here: http://www.roadtoboston.com/media/RoadToBoston.zip I have a batch file called runserver.cmd that would run the local

Re: Best Practices for faster template rendering

2007-02-09 Thread Malcolm Tredinnick
On Fri, 2007-02-09 at 16:06 -0600, Derek Lee-Wo wrote: > > It may take a couple more days to work this out. It's only been 48 hours > > since you posted the original problem and less than 24 hours since you > > posted a portion of your code that causes the problem. It is very > > unusual

Re: Best Practices for faster template rendering

2007-02-09 Thread Jeremy Dunck
On 2/9/07, Derek Lee-Wo <[EMAIL PROTECTED]> wrote: ... > My original post was to really geared to finding any resources that > might give some best-practice guidelines Barring that, I was really > only hoping for any quick or easy suggestions others may have. In general, Django templating is

Re: Best Practices for faster template rendering

2007-02-09 Thread Derek Lee-Wo
> It may take a couple more days to work this out. It's only been 48 hours > since you posted the original problem and less than 24 hours since you > posted a portion of your code that causes the problem. It is very > unusual behaviour for Django; the templating code is normally very fast, > but

Re: Best Practices for faster template rendering

2007-02-09 Thread Derek Lee-Wo
I'll put together a zip file of my entire project directory along with a MySQL dump of the test data I have. That way, it should be easy for anyone to play around with it. I'll try do that later this evening On 2/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Thu, 2007-02-08 at

Re: Best Practices for faster template rendering

2007-02-09 Thread Malcolm Tredinnick
On Thu, 2007-02-08 at 20:21 -0600, Derek Lee-Wo wrote: > > One more idea: It looks like you're doing foreign-key lookups in the > > rendering. > > > > {% for workoutWeek in workoutWeeks %} > > ... > > {% for workoutDay in workoutWeek.workouts %} > > workoutWeek isn't a table, but I'm pretty

Re: Best Practices for faster template rendering

2007-02-09 Thread Malcolm Tredinnick
On Fri, 2007-02-09 at 13:41 -0600, Derek Lee-Wo wrote: > I incorporated ReportLib to generate a PDF of the same data that I'm > trying to display on the web and the PDF gets created in about 2 > seconds as compared to the template via Django which is taking 16-18 > seconds. > > Both routines

Re: Best Practices for faster template rendering

2007-02-09 Thread Karen Tracey
At 02:41 PM 2/9/2007, you wrote: >This is turning out to be very distressing. I'm starting to look at >other template options. I may give Cheetah a try this weekend. I'm not surprised you are considering alternatives, 16-18 seconds is an unacceptable amount of time for template rendering.

Re: Best Practices for faster template rendering

2007-02-09 Thread Derek Lee-Wo
I incorporated ReportLib to generate a PDF of the same data that I'm trying to display on the web and the PDF gets created in about 2 seconds as compared to the template via Django which is taking 16-18 seconds. Both routines share a common method that does all the data retrieval and

Re: Easy way to determine runtime environment?

2007-02-09 Thread Mike
Hello, > Is there an easy way to adjust the media location based on the > server environment? Perhaps the following link will help. Check out the code from Mikko Ohtamaa in the Comments section. http://www.djangoproject.com/documentation/modpython/

Easy way to determine runtime environment?

2007-02-09 Thread Tim Chase
I'm trying to find an easy way to check what the current runtime environment is. I deploy to mod_python, but do development against runserver. I'd like my settings.py file to tweak the media settings based on whether I'm using mod_python (in which case, it should use the ones I have working

Re: Best Practices for faster template rendering

2007-02-09 Thread Karen Tracey
This is a total shot in the dark but are you running with the fix for ticket #3441? If your template does anything to cause VariableDoesNotExist to be raised during rendering, #3441 might apply. Without the fix the entire contents of your context is repr'd to build the exception message that is

Re: Shuffled Model selection

2007-02-09 Thread Kai Kuehne
Hi On 2/9/07, Brett Parker <[EMAIL PROTECTED]> wrote: > Err, why not use a random sort as... > > Obj.objects.order_by('?') > > ref: http://www.djangoproject.com/documentation/db_api/#order-by-fields Becasue I didn't know it (a good reason, I think). > Cheers, Thanks Brett! Kai

Re: Shuffled Model selection

2007-02-09 Thread Brett Parker
On Fri, Feb 09, 2007 at 03:11:57PM +0100, Kai Kuehne wrote: > > Hey! > I wanted to select all models, but in random order: > > random.shuffle(Obj.objects.all()) > > This doesn't work, error message: > > TypeError: object does not support item assignment Err, why not use a random sort

Problems with low level caching and locmem backend

2007-02-09 Thread Lawrence Oluyede
I'm trying to put in the cache a simple Python list made of unicode strings. The strange thing is locmem crashes badly during the first retrieval of a cache hit. The same code with the simple backend is like a breeze. I looked into locmem.py and simple.py backends and as the traceback states the

Re: Shuffled Model selection

2007-02-09 Thread Kai Kuehne
Sorry, I got it: all = Obj.objects.all() newlist = [x for x in all] random.shuffle(newlist) Not that beautiful, but it works. :) Greetings Kai --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Shuffled Model selection

2007-02-09 Thread Kai Kuehne
Hey! I wanted to select all models, but in random order: random.shuffle(Obj.objects.all()) This doesn't work, error message: TypeError: object does not support item assignment Anyony an idea in how to make it? (It's for a blogroll, if you wonder where it could be used.) Greetings :)

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Manoj Govindan
> the session information from the database, and you query the wrapper > for individual session data. > > Does this help explain the process? > It certainly does. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Russell Keith-Magee
On 2/9/07, Manoj Govindan <[EMAIL PROTECTED]> wrote: > > Apologies for the flurry of messages. > I just wanted to note that this worked: > > session = > SessionWrapper( self.client.cookie.get( 'sessionid' ).value ) > > The above fragment returned me the session from the db that I was > looking

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Russell Keith-Magee
On 2/9/07, Manoj Govindan <[EMAIL PROTECTED]> wrote: > > Hi Russ, > Thanks for your prompt reply. > > I tested the solution you suggested and came up with some questions. > Here they are. > > > session = > > SessionWrapper(self.cookies.get(settings.SESSION_COOKIE_NAME, None)) > >

Re: Should newforms security fixes be posted to django-announce?

2007-02-09 Thread Fred
+1. I switched halfway my first project to using newforms in new views/ forms I'm creating. The old manipulator functiosn for custom forms are 'cumbersome' to say it nicely compared to the enlightened newforms way of django life. :-) Fred --~--~-~--~~~---~--~~

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Manoj Govindan
Apologies for the flurry of messages. I just wanted to note that this worked: session = SessionWrapper( self.client.cookie.get( 'sessionid' ).value ) The above fragment returned me the session from the db that I was looking for. I am still confused. Russell, can I persuade you to explain what

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Manoj Govindan
Addendum: I tried the following and it did return a session. session = SessionWrapper( self.client.cookie.get( 'id' ) ) However this session does not have _any_ keys. I am presently checking my code ... > > Say something like this. > > session = SessionWrapper( self.client.cookie ) >

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Manoj Govindan
Hi Russ, Thanks for your prompt reply. I tested the solution you suggested and came up with some questions. Here they are. > session = > SessionWrapper(self.cookies.get(settings.SESSION_COOKIE_NAME, None)) > self.assertTrue(session['key'], value) > First of all, I could not

Re: tying custom queries back into the queryset / object model / paginator... ?

2007-02-09 Thread James Bennett
On 2/8/07, Sergey Kirillov <[EMAIL PROTECTED]> wrote: > obj_list = klass._default_manager.in_bulk(oid_list) > > return [obj_list[oid] for oid in oid_list] Just a quick note for those playing along with custom ORDER BY stuff (e.g., ordering by a non-column value generated by another part

Re: Django Admin not updating to reflect changes in database

2007-02-09 Thread James Bennett
On 2/8/07, Roboto <[EMAIL PROTECTED]> wrote: > I've done everything (but the right thing) to try to get the admin > interface to pick up the new charField that I've added to the class, > but it's just not reflecting it. Are you using a 'fields' list in your Admin class to specify which fields it

Filtering foreign items in admin

2007-02-09 Thread Rob Slotboom
For a several models I use a FK to photos. The drop down in admin to choose from lists all photos. Can this list be filtered so I can restrict the available photos for some models? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Should newforms security fixes be posted to django-announce?

2007-02-09 Thread [EMAIL PROTECTED]
On Feb 9, 12:57 pm, Jon Colverson <[EMAIL PROTECTED]> wrote: > Should newforms security fixes be posted to django-announce? Yes +1 for this. Since basically everybody using Django on production servers is using some svn code i believe and i'm about to do the same. Thanks, Lorenzo

Should newforms security fixes be posted to django-announce?

2007-02-09 Thread Jon Colverson
Hello. I sent a e-mail to the django security list last Friday about a XSS vulnerability in newforms. The bug was fixed on Monday in SVN revision 4460. Adrian and Jacob didn't think that it was worth posting to django-announce about it, since it only affects newforms. The justification given

Re: Automated testing using Client - how to test/assert the value of session objects

2007-02-09 Thread Russell Keith-Magee
On 2/9/07, Manoj Govindan <[EMAIL PROTECTED]> wrote: > > Hi, > I have written a small test making use of test.Client to simulate a > 'POST' request to a view. The target view is expected to set a certain > variable in the session on successful handling of the request. Can > anyone suggest a

Custom SQL - MySQL Dictcursor

2007-02-09 Thread Dirk Eschler
Hello, is there a way to get a dictcursor from Django when using custom MySQL? from django.db import connection cursor = connection.cursor() cursor.execute("SELECT [...]") cursor.fetchall() The above fetchall returns a tuple, while i need a dict, like it is built with

Re: possible bug when editing an object: foreign key "_id" part gone (SOLVED)

2007-02-09 Thread Benedict Verheyen
Benedict Verheyen schreef: > Benedict Verheyen schreef: >> Hi, >> >> i think i might have encountered a possible bug but i'm not sure though. >> Editing an object and leaving a mandatory field empty results in the >> form "forgetting" the foreign keys. It doesn't actually forget but it ommits >>

custom validator or other way to avoid double bed bookings

2007-02-09 Thread Benedict Verheyen
Hi, my app is used to manage patients of a ward in a hospital. This ward has a number of beds available. A patient has a room id referring to the room/bed where he's laying. Now i would want to avoid being able to select a bed that is already in use. I thought of using my own validator. So