Re: Traversing Deep Model Objects in template...

2007-07-31 Thread Amirouche
> authors = book.authors.all().values('first_name','last_name',) I don't think that the use of the values method is that widespread... if you use I would suggest you to think it twice. --~--~-~--~~~---~--~~ You received this message because you

Re: Traversing Deep Model Objects in template...

2007-07-31 Thread Amirouche
On Jul 31, 8:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > def index(request): > books = Book.objects.all().select_related()[:3] what is doing the 3 ? {% for book in books %} {{ book.title }} // I prefer use names instead of ids in urls because it's more human

Re: [OT] pydev

2007-07-31 Thread Nimrod A. Abing
Hello, What OS and JRE/JDK are you using? I'm on Linux with Eclipse Europa running on JDK1.6.0_02. I have never experienced any hangs. I run 32-bit Linux on my laptop and 64-bit Linux on the desktop. On both systems there comes an exception from time to time complaining about null references and

Re: Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-07-31 Thread Amirouche
> Is there anyway that I can have the 'sandp' Field only > show choices that are tied to that collection? This is the purpose of making ForeignKeys I guess. You may try: mycollection = Collection.objects.all()[0] related_choices = Choice.objects.filter(choice=mycollection) I think that

Re: How can I re-use the filtering and sorting from the admin pages in my view?

2007-07-31 Thread vince
I asked about this same issue a while back because this is a feature that I think would be really handy. Not sure how feasible it would be however. I put something together after reviewing of the html source of the admin pages. I did *not* look at the python source (too complicated for me :). It

Re: Object variable name in admin templates?

2007-07-31 Thread James Bennett
On 7/31/07, biancaneve <[EMAIL PROTECTED]> wrote: > Yes! It worked! Thanks so much! For future reference, you can see the variables passed into the intial context for a change page here: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/views/main.py#L397 Note that other

Can a ManyToManyField only shows certain records in an admin using edit_inline?

2007-07-31 Thread Greg
Ok, Here is my model file: class Collection(models.Model): name = models.CharField(maxlength=200) collectionslug = models.SlugField(prepopulate_from=["name"]) description = models.TextField(maxlength=1000) manufacturer = models.ForeignKey(Manufacturer) class

Re: Object variable name in admin templates?

2007-07-31 Thread biancaneve
Yes! It worked! Thanks so much! James Bennett wrote: > On 7/31/07, biancaneve <[EMAIL PROTECTED]> wrote: > > I can do it if I write a whole new view and define my own variables, > > but then I lose a lot of the Admin functionality. I'd prefer to just > > change the title line of the admin

Re: Object variable name in admin templates?

2007-07-31 Thread James Bennett
On 7/31/07, biancaneve <[EMAIL PROTECTED]> wrote: > I can do it if I write a whole new view and define my own variables, > but then I lose a lot of the Admin functionality. I'd prefer to just > change the title line of the admin template. Try 'original'. -- "Bureaucrat Conrad, you are

Object variable name in admin templates?

2007-07-31 Thread biancaneve
Can anyone tell me what variable the admin template (change_form.html) uses to describe the object being edited? I'm trying to alter the change form for a particular model (Employee) to display a field from that model (Surname) as a title, rather than "Change Employee". I can do it if I write a

Making get_or_create (or equivalent) atomic on MySQL

2007-07-31 Thread [EMAIL PROTECTED]
Hi, I'm trying to atomically check if a certain field in the db exists and create it otherwise. I naively started using get_or_create but it seems like that function does not try to do things atomically at all. My database is MySQL and my table type is InnoDB. I installed the select_for_update

Re: UnicodeEncodeError

2007-07-31 Thread Kai Kuehne
Hi Alexandre, On 8/1/07, Alexandre Forget <[EMAIL PROTECTED]> wrote: > > Hi, > > I am stuck with this error, does someone know what it mean? > I am using django svn and sqlite. > > This error happen when I try to delete an object with the admin > interface but it delete fine with the shell. > >

UnicodeEncodeError

2007-07-31 Thread Alexandre Forget
Hi, I am stuck with this error, does someone know what it mean? I am using django svn and sqlite. This error happen when I try to delete an object with the admin interface but it delete fine with the shell. any help greatly appreciated alex Traceback (most recent call last): File

Re: How can I re-use the filtering and sorting from the admin pages in my view?

2007-07-31 Thread Ben Ford
Johan, I used some of the admin functionality in my views and to be honest I wish I hadn't... It's pretty difficult to extend and I'm kinda stuck now! I'm not sure what the newforms admin brings to the table (or even if it's merged into trunk yet) so maybe you'd want to look at that? Ben On

ModelMultipleChoiceField doesn't do initial selection

2007-07-31 Thread Kai Kuehne
Hi list, sorry for bugging you again but I cannot solve this problem. In my applications I have a model DVD and a model Genre related via a ManyToMany field. The problem is that the edit form doesn't show the selected genres already assigned to a DVD instance. The form looks like: class

remember me feature

2007-07-31 Thread james_027
hi, is implementing remember me feature for login is as simple as changing the cookies settings in the settings.py? is manipulating of setting.py allowed in views? THanks james --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: a question about site framework

2007-07-31 Thread Kai Kuehne
ManyToManyField maybe is way better. Sorry, its late. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this

Re: a question about site framework

2007-07-31 Thread Kai Kuehne
Hi, On 8/1/07, Hai Dong <[EMAIL PROTECTED]> wrote: > > Hello: > > I got a question. What if I have two sites, and each site has several > categories (where articles belong to). For such kind of case what is the > best way of utilizing the site framework. What about a ForeignKey field in the

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Kai Kuehne
Hi Russel, On 8/1/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > Yes. The problem is cause by the way that Postgres (and Oracle, AFAIK) > allocates primary keys. > > [postgres sequence explanation] > > > (Wondering why there is db-dump.py when dumpdata works.. > > but wayne.) > > It was a

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Russell Keith-Magee
On 8/1/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Is this the 'normal' behavior of postgres? I've never used it > before but this seems very odd to me. I'm deleting the whole > database and creating it new every time. After deleting I'm doing this: > > >>> manage.py syncdb > >>> db-dump.py

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Kai Kuehne
Hi Russell On 8/1/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 8/1/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > > I'm using django SVN and the windows version of psycopg2. > > Postgres is running on linux (version 8.1.8). It doesn't work on > > webfaction either, so this

Re: Match from list in URLconf

2007-07-31 Thread Matt
Hi all, Thanks for all the feedback! I was expecting either a "do it like this" or a "sorry, it can't be done" type response - this is much better. Tim - my initial solution was to use a differentiator view as you suggested. I thought this was a little messy because it dragged URL logic into my

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Kai Kuehne
On 8/1/07, Kevin Menard <[EMAIL PROTECTED]> wrote: > I would have to agree with lenducha's synopsis. If the sequence is > not updated, you will run into duplicate ID problems. The easiest > thing to do right now is update all of your sequence curvals to be > something large, where large is

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Russell Keith-Magee
On 8/1/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > I'm using django SVN and the windows version of psycopg2. > Postgres is running on linux (version 8.1.8). It doesn't work on > webfaction either, so this information shouldn't be that helpful. Without seeing the exact error, I can think of two

a question about site framework

2007-07-31 Thread Hai Dong
Hello: I got a question. What if I have two sites, and each site has several categories (where articles belong to). For such kind of case what is the best way of utilizing the site framework. Thanks, Harry --~--~-~--~~~---~--~~ You received this message because

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Kevin Menard
On 7/31/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Hi list, > I have a question regarding data imports with django > and postgres. > I used the database for my current application and used > the db-dump script from here: > http://www.djangosnippets.org/snippets/14/ > > When I load data into

Re: Flickr / Django

2007-07-31 Thread James Bennett
On 7/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Your model and sync script looks exactly like what I was starting to > write!! Heck yeah! There's also an open-source app which aims to genericize the function of periodically pulling in some form of external content to your database,

Re: User model (unique email)

2007-07-31 Thread Patrick Anderson
On Tue, 31 Jul 2007 22:40:50 +, Pensee wrote: > Hi, > > On Jul 31, 11:46 pm, Patrick Anderson <[EMAIL PROTECTED]> wrote: >> I'd prefer not to hack the contrib.auth application and change User >> model, > > Adding just unique=true is not so hard and tracking with changes is easy > :). > >

Re: Flickr / Django

2007-07-31 Thread [EMAIL PROTECTED]
Bret, Your model and sync script looks exactly like what I was starting to write!! Heck yeah! Anyway, I have everything set up but I keep getting this error and I'm not 100% sure why Traceback (most recent call last): File "flickr/flickrupdate.py", line 7, in from models import

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-31 Thread Greg
bump On Jul 31, 2:53 pm, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Ha...sorry I'm such a idiot. > > I think I got in now (If not...you might need to help me find it). > > My Zip file that I downloaded is labeled sqlite-3_3_15. Is that what > you need? > > Sorry about this confusion Russ > >

Re: Dojo LayoutContainer and ContentPane as application frame?

2007-07-31 Thread [EMAIL PROTECTED]
ok the solution was dojo.io.bind({ url: "/projects/", load: function(type, data, evt){ docPane.setContent(data); }, mimetype: "text/html" }); sorry ... On 31 Jul., 22:37, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello Group, > > I tried to setup a kind of frame architecture with the

Re: Optimistic Locking Patch?

2007-07-31 Thread Kevin Menard
On 7/31/07, Victor Ng <[EMAIL PROTECTED]> wrote: > > Has anyone looked into implementing optimistic locking for the Django ORM? > > I didn't see anything logged into code.djangoproject.com or in the > django-users list. > > Has anyone taken a stab at implementing this yet? I haven't looked into

Re: User model (unique email)

2007-07-31 Thread Pensee
Hi, On Jul 31, 11:46 pm, Patrick Anderson <[EMAIL PROTECTED]> wrote: > I'd prefer not to hack the contrib.auth application and change User > model, Adding just unique=true is not so hard and tracking with changes is easy :). You may have a look at the "Django tips: extending the User model" on

Accents in translation strings

2007-07-31 Thread Jonas
Hi everybody First a few words of congratulation to those who work on developping Django, it feels efficient from my inexperienced user's point of view. Now the problem... I have just begun working on my website using Django, and I want to use internationalize my website. Base language is

How can I re-use the filtering and sorting from the admin pages in my view?

2007-07-31 Thread johan de taeye
Folks, Any thoughts on how I can implement the following elegantly in Django? A first table contains let's say "product" records, which have a bunch of attributes on which the admin pages provide filtering and sorting. A second table contains "sales" records, which have a field referring to

request.urlconf multiple urlconf single site

2007-07-31 Thread Trey
I know that there was some good code checked in a while back to allow overriding of ROOT_URLCONF with request.urlconf. This however doesn't seem to work for everything, at least all the {% url %} tags in my templates don't work. Is this a known problem and is there anything I can do to help fix

Unique check errors when using postgres and explicit ids

2007-07-31 Thread Kai Kuehne
Hi list, I have a question regarding data imports with django and postgres. I used the database for my current application and used the db-dump script from here: http://www.djangosnippets.org/snippets/14/ When I load data into the database, I cannot insert new data afterwards. (Some weird unique

User model (unique email)

2007-07-31 Thread Patrick Anderson
I'd like to create a couple of views that would allow users to retrieve their forgotten username or password by email. It seems to me that the only reliable way to do this would be for my application to require unique email addresses for User objects. However email field in

AttributeError: 'module' object has no attribute

2007-07-31 Thread [EMAIL PROTECTED]
Hello, I keep getting this error and I can't seem to track where it is coming from. I am working with django-0.91. I had a calendar app that was installed but I commented calendar out in my installed apps and commented it out in the urlpatterns. So there should be no reason why this is trying

Optimistic Locking Patch?

2007-07-31 Thread Victor Ng
Has anyone looked into implementing optimistic locking for the Django ORM? I didn't see anything logged into code.djangoproject.com or in the django-users list. Has anyone taken a stab at implementing this yet? vic -- "Never attribute to malice that which can be adequately explained by

Re: ANN: django-lifestream

2007-07-31 Thread Horst Gutmann
Kai Kuehne wrote: > Hi, > > On 7/31/07, Horst Gutmann <[EMAIL PROTECTED]> wrote: >> The code is available on >> >> I hope at least some of you might find it useful :-) For some more >> informations please also check out the announcement on >>

Dojo LayoutContainer and ContentPane as application frame?

2007-07-31 Thread [EMAIL PROTECTED]
Hello Group, I tried to setup a kind of frame architecture with the dojo layout container widget. The idea is to load the menu (fisheye widget menu) only once and let the django page itself load asynchronously into a ContentPane. A dojo menu widget loads an url in the content pane like this:

Re: pydev

2007-07-31 Thread Kevin Menard
On 7/31/07, eXt <[EMAIL PROTECTED]> wrote: > > I currently use Eclipse Europa with PyDev and it works fine. Earlier I > worked with Eclipse 3.2 and IIRC I had some problems with lock ups but > then I changed Eclipse start parameters and it solved my problem. So > my advice is to upgrade your

Generic confirm view

2007-07-31 Thread suniala
Dear team, I've been trying to come up with a generic way of confirming an action (e.g. deleting an item) in a Django application. A decorator would be neat, I think. But I was a bit surprised that I didn't find anything on the issue in the documentation or forums (except for

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-31 Thread Greg
Russ, Ha...sorry I'm such a idiot. I think I got in now (If not...you might need to help me find it). My Zip file that I downloaded is labeled sqlite-3_3_15. Is that what you need? Sorry about this confusion Russ Thanks On Jul 31, 9:10 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: >

Re: pydev

2007-07-31 Thread eXt
I currently use Eclipse Europa with PyDev and it works fine. Earlier I worked with Eclipse 3.2 and IIRC I had some problems with lock ups but then I changed Eclipse start parameters and it solved my problem. So my advice is to upgrade your Eclipse or to read somewhere about parameters in

Free tutorials and interview questions

2007-07-31 Thread techhairball
Check out http://www.techhairball.com for all your technology needs. Launched just few weeks back and is already getting hundreds of hits per day. We also need Tech Web content writers wanted for http://www.techhairball.com. We will share 80% revenue with you. We need people in the following

Re: ANN: django-lifestream

2007-07-31 Thread Kai Kuehne
Hi, On 7/31/07, Horst Gutmann <[EMAIL PROTECTED]> wrote: > The code is available on > > I hope at least some of you might find it useful :-) For some more > informations please also check out the announcement on >

Re: More of a lighttpd question (I think)

2007-07-31 Thread Mario Gonzalez
On 31 jul, 12:49, JHeasly <[EMAIL PROTECTED]> wrote: > I keep getting this loop in my lighttpd error log: > > 09:41:07: (mod_fastcgi.c.3457) all handlers for /mysite.fcgi/ > classifieds/topjobs/5/ on /mysite.fcgi are down. I believe the process that handle fast-cgi is down. I send you some

Re: [OT] pydev

2007-07-31 Thread Kevin Menard
On 7/31/07, Derek Anderson <[EMAIL PROTECTED]> wrote: > > hey all, > > i'm having a heck of a time using pydev (the eclipse python plugin). it > keeps randomly locking up eclipse (unresponsive UI + 100% CPU), usually > when i switch tabs. anyone else experiencing this? If you are using Eclipse

[OT] pydev

2007-07-31 Thread Derek Anderson
hey all, i'm having a heck of a time using pydev (the eclipse python plugin). it keeps randomly locking up eclipse (unresponsive UI + 100% CPU), usually when i switch tabs. anyone else experiencing this? thanks, derek --~--~-~--~~~---~--~~ You received this

ANN: django-lifestream

2007-07-31 Thread Horst Gutmann
Hi everyone :) I'm proud to announce django-lifestream, a generic app for Django and the first of hopefully quite a few components of my sites that I plan to give back to the community. The purpose of this app is to provide a lifestream similar to by merging

Re: schema evolution

2007-07-31 Thread Derek Anderson
Russell Keith-Magee wrote: > Documentation should be about how to use a feature, not how the > internals of a feature work. fixed in the branch. plus it now includes installation instructions, a future work section, etc. also available here:

Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread Joseph Heck
The middleware is loaded by whatever is serving your requests, and when it loads it'll process through that file - invoking "foofunc()" in the path and executing it. I'm not sure I understand your second question though. -joe On 7/31/07, james_027 <[EMAIL PROTECTED]> wrote: > > Hi Thomas > > >

Re: duplicate SQL statements

2007-07-31 Thread Kevin Menard
On 7/31/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Hi, > > with SQLLogMiddleware (http://www.djangosnippets.org/snippets/344/) I see, > that there are many statements executed twice in a single request. > > This links explains it: >

Re: I get an error when my query returns nothing

2007-07-31 Thread Mario Gonzalez
On 31 jul, 12:45, Greg <[EMAIL PROTECTED]> wrote: > > Does anybody know what i need to do so that I don't receive this error > when the query returns nothing? > There's a difference with get() and filter(). get() always returns an object and it must be use when you're sure you've got records.

More of a lighttpd question (I think)

2007-07-31 Thread JHeasly
I keep getting this loop in my lighttpd error log: 09:41:07: (mod_fastcgi.c.3457) all handlers for /mysite.fcgi/ classifieds/topjobs/5/ on /mysite.fcgi are down. 09:41:12: (mod_fastcgi.c.2669) fcgi-server re-enabled: unix:/usr1/ local/oper/class.sock 09:41:18: (mod_fastcgi.c.1739) connect

Re: Template: unicode problem

2007-07-31 Thread Malcolm Tredinnick
On Tue, 2007-07-31 at 15:40 +, Mario Gonzalez wrote: > Hello, I'm getting some problems with unicode in templates: 'ascii' > codec can't encode character u'\xf1' in position 1: ordinal not in > range(128) However, templates, database are in UTF8. I changed > __str__ by __unicode__ in my

Re: Template: unicode problem

2007-07-31 Thread Mario Gonzalez
On 31 jul, 12:28, Mario Gonzalez <[EMAIL PROTECTED]> wrote: > > I understand it and please forgive my pour words :-) I'll do what > you said and I'll try to fix it by my self today. If not, I'll write > to this list for any comments. > The problem: I had a non-ascii character (ñ) in my

I get an error when my query returns nothing

2007-07-31 Thread Greg
Hello, I have the following if statement in one of my views: if (Style.objects.get(id=a.id).sandp.get(price=request['price'])==True): // Sometimes, the query will not find any results. However, when this line gets accessed I get the following error: Choice matching query does not

Re: Template: unicode problem

2007-07-31 Thread Malcolm Tredinnick
Mario, On Tue, 2007-07-31 at 15:40 +, Mario Gonzalez wrote: [...] > Django (I think) is trying to encode an ascii string. I modified > django/template/__init__.py line 704 and just for testing purposes I > deleted raise and I changed it by print e > > Index: __init__.py >

Re: Template: unicode problem

2007-07-31 Thread Mario Gonzalez
On 31 jul, 12:18, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > There may well be a problem, but from the current information there is a > 0% chance of anybody being able to guess the solution. There are just > too many things it could be from bad strings in your code to bad > handling on some

Re: Ordering in Admin change page

2007-07-31 Thread oggie rob
> However, if I add a new transaction, I want to see the Users listed in > the User ChoiceField by username, rather than userid which it > currently is. I have over 1000 users and so finding the correct user > is a nightmare. You need to use raw_id_admin instead of that edit_inline stuff. You

Template: unicode problem

2007-07-31 Thread Mario Gonzalez
Hello, I'm getting some problems with unicode in templates: 'ascii' codec can't encode character u'\xf1' in position 1: ordinal not in range(128) However, templates, database are in UTF8. I changed __str__ by __unicode__ in my models files. Django (I think) is trying to encode an ascii

Re: schema evolution

2007-07-31 Thread Russell Keith-Magee
On 7/31/07, Derek Anderson <[EMAIL PROTECTED]> wrote: > testing and documentation (plus two minor bug fixes) are checked into > the schema-evolution branch: > > tests/modeltests/schema_evolution/models.py > docs/schema-evolution.txt Documentation should be about how to use a

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-31 Thread Russell Keith-Magee
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > pysqlite2.3.3 That's just the binding. What version of SQLite itself? Russ %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: "News" application?

2007-07-31 Thread Jarek Zgoda
Jarek Zgoda napisał(a): > I have an application named "news". Running python manage.py sqlall news > I just discovered that django would create a table I did not define in > my models.py - "news_news" (no, there's no M2M fields there). What's > that? Why? I even don't have a model for this data.

Ordering in Admin change page

2007-07-31 Thread Tipan
I'm sure this is easily answered, but so far the solution has evaded me. I have a table in my model definition eg: class Transaction(models.Model): user=models.ForeignKey(UserProfile,edit_inline=models.TABULAR,num_extra_on_change=0)

Re: Postgresql and transactions, revisited

2007-07-31 Thread Russell Keith-Magee
On 7/31/07, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > I had the problem that any db error in any of my tests (including > setups) would cause all following tests to fail (because the transaction > was not rolled back). This was made even worse by the fact that I used > the db in tearDown, which

Re: "News" application?

2007-07-31 Thread Jarek Zgoda
Jonathan Buchanan napisał(a): >> I have an application named "news". Running python manage.py sqlall news >> I just discovered that django would create a table I did not define in >> my models.py - "news_news" (no, there's no M2M fields there). What's >> that? Why? I even don't have a model for

Re: checkbox (newforms)

2007-07-31 Thread Chris Hoeppner
Enquest escribió: > In my form I got {{ form.boxes }} > Form.boxes contain 10 checkboxes that are displayed in a ul li list. > However I want them in three columns so I thougt I should be able to > acces each in by {{ form.boxes.1 }} or {% for item in boxes %} > Alas this does not work. The IRC

Re: how to overcome {% if %} limitation

2007-07-31 Thread Chris Hoeppner
james_027 escribió: > Thanks everyone! > > > > > There's actually a reason for templates and views being two separate entities. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: "News" application?

2007-07-31 Thread Jonathan Buchanan
> I have an application named "news". Running python manage.py sqlall news > I just discovered that django would create a table I did not define in > my models.py - "news_news" (no, there's no M2M fields there). What's > that? Why? I even don't have a model for this data. Do you have a Model

Something like a mini Crystal Reports with Django

2007-07-31 Thread Mir Nazim
Hello I was wondering has anybody done application that was something like a mini crystal reports. Generating a report based of model items selected in a WYSIWYG(ok this is not important) fashion. And generating a HTML tables based report with defined calculations etc. I understand that Django

duplicate SQL statements

2007-07-31 Thread Thomas Guettler
Hi, with SQLLogMiddleware (http://www.djangosnippets.org/snippets/344/) I see, that there are many statements executed twice in a single request. This links explains it: http://www.djangoproject.com/documentation/db-api/#caching-and-querysets How can I cache the result of

"News" application?

2007-07-31 Thread Jarek Zgoda
I have an application named "news". Running python manage.py sqlall news I just discovered that django would create a table I did not define in my models.py - "news_news" (no, there's no M2M fields there). What's that? Why? I even don't have a model for this data. CREATE TABLE "news_news" (

Re: how to overcome {% if %} limitation

2007-07-31 Thread james_027
Thanks everyone! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL

Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread james_027
Hi Thomas > The methods of each middleware are called one for every request. If your > changes need information from the request, that's the right place. > > If you want to add a method which should be added once the server (mod_python, > scgi, ...) starts you can use this place too. But it is

RE: how to overcome {% if %} limitation

2007-07-31 Thread Michael Elsdoerfer
> 2) create custom tag. Some people have already done this of course, for example: http://www.djangosnippets.org/snippets/130/ Michael > -Original Message- > From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] > On Behalf Of [EMAIL PROTECTED] > Sent: Tuesday, July 31, 2007

Re: db mock for unit testing

2007-07-31 Thread Andrey Khavryuchenko
Russ, RK> On 7/29/07, Andrey Khavryuchenko <[EMAIL PROTECTED]> wrote: >> >> I'm not using django's testing framework for several reasons: >> - I'm using django from 0.91 days and wasn't following django-users all >> this way >> - I use nose and twill for testing and they have no

Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread Thomas Guettler
Am Dienstag, 31. Juli 2007 11:26 schrieb james_027: > Hi, > > I want to make sure that my understanding is right. is middleware the > place where I can add more attribute to the HttpRequest Object and > manipulate the added attribte? > > Is this advisable? if Not where is the right place to do

checkbox (newforms)

2007-07-31 Thread Enquest
In my form I got {{ form.boxes }} Form.boxes contain 10 checkboxes that are displayed in a ul li list. However I want them in three columns so I thougt I should be able to acces each in by {{ form.boxes.1 }} or {% for item in boxes %} Alas this does not work. The IRC channel didn't help ... So

Re: mod_python apache2 path problem

2007-07-31 Thread Graham Dumpleton
On Jul 31, 5:24 pm, Giorgio Salluzzo <[EMAIL PROTECTED]> wrote: > I know very well this problem because in my company we had the same > some months ago. > > I investigated a lot also on modpython list and it is a known "bug| > strange behavior", you can find threads really old about it. Huh.

learning django's HttpRequest Object and Middleware

2007-07-31 Thread james_027
Hi, I want to make sure that my understanding is right. is middleware the place where I can add more attribute to the HttpRequest Object and manipulate the added attribte? Is this advisable? if Not where is the right place to do it? Thanks james

Re: What should I do to make admin display more fields in User model?

2007-07-31 Thread Daniel Kvasnicka jr.
I've decided to use ForeignKey instead of subclassing. The reasons are problem described in http://groups.google.com/group/django-users/browse_thread/thread/c73585d5cccb4475 and also the article at http://www.b-list.org/weblog/2007/02/20/about-model-subclassing, which has a few very strong

Re: db mock for unit testing

2007-07-31 Thread Andrey Khavryuchenko
Russ, RK> On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: >> >> So what advantages are there to the mocking approach over just replacing >> the setting? RK> Genuine mocking (as opposed to this proposal) has one really big RK> advantage - it's lightning fast. All the db-calls

dynamically setting model manager objects' method parameters

2007-07-31 Thread omat
Hi, I am trying to get a node in a hierarchy by looking at its parents' slugs. For example, in a case where 'a' is the parent of 'b' and 'b' is the parent of 'c', I would like to grab the node 'c' as follows: Category.objects.get(slug = 'c', parent__slug = 'b', parent__parent__slug = 'a') Is

Re: Name of inclusion-tag template built in run-time

2007-07-31 Thread Peter Melvyn
On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I'm not sure how you've got your code set up, I'm looking for a way how to compose web page from the relativelly independent 'tiles'. Tags, especially inclusion tags seem to be a suitable tool for it. Its a pitty they cannot be used

Re: Adding ForeignKey on self to User with add_to_class causes endless loop in the server

2007-07-31 Thread Daniel Kvasnicka jr.
On Jul 31, 9:30 am, "Ben Ford" <[EMAIL PROTECTED]> wrote: > I'm not sure about the mechanics of add_to_class, but usually a self > referential ForeignKey should look like: > models.ForeignKey('self', ..) > Have you tried it like this? Yes I have, and unfortunately it does the same.

Re: Adding ForeignKey on self to User with add_to_class causes endless loop in the server

2007-07-31 Thread Ben Ford
I'm not sure about the mechanics of add_to_class, but usually a self referential ForeignKey should look like: models.ForeignKey('self', ..) Have you tried it like this? Ben On 31/07/07, Daniel Kvasnicka jr. <[EMAIL PROTECTED]> wrote: > > > Hi, > in my models.py I'm tring to add some

Re: mod_python apache2 path problem

2007-07-31 Thread Giorgio Salluzzo
I know very well this problem because in my company we had the same some months ago. I investigated a lot also on modpython list and it is a known "bug| strange behavior", you can find threads really old about it. Because of it we changed to the fastest and "problems free" modwsgi.

Re: Traversing Deep Model Objects in template...

2007-07-31 Thread [EMAIL PROTECTED]
Is this the *best* way to accomplish this? It seems like the author DB query per book isn't very efficient (where it might sense to do a JOIN) Also, if I was doing any more "levels" things would get very complicated and bloated. view.py: ... def index(request): data =

Adding ForeignKey on self to User with add_to_class causes endless loop in the server

2007-07-31 Thread Daniel Kvasnicka jr.
Hi, in my models.py I'm tring to add some fields to User with add_to_class (so I can access them in admin). Everything works fine, only when I try to add a ForeignKey on User itself, Django dev server gets in a loop and has to be killed or it consumes every byte of memory and all processor time.

Re: retaining the data on validation error using newforms

2007-07-31 Thread Doug B
Everything can be changed. Look under auto_id in the newforms docs on djangoproject.com. The default does it exactly the way you seem to be, prepending 'id_' to the field name. If you want to set a class, you need to change the attrs dict on the field's widget. All a newforms field really

Traversing Deep Model Objects in template...

2007-07-31 Thread [EMAIL PROTECTED]
I'm using the Books, Publishers, Authors example from the documentation (Django Book) and I'm trying to figure out how to get related data in a list. For example, I want to print a list of books and a list of authors for each book in my template. What do I have to do to make the code below