Re: newbie on django 0.96

2007-03-26 Thread [EMAIL PROTECTED]
> < match the new templates and context variables. Change the template > call from polls/detail.html to polls/poll_detail.html, and pass object > in the context instead of poll.>> This change refers to the template file - [original stuff] {{ poll.question }} {% for choice in

Re: foreign key filtering

2007-03-26 Thread Greg Donald
On 3/26/07, RajeshD <[EMAIL PROTECTED]> wrote: > Try this: > msgs = Messages.active.filter(project__active=True) Yup. Thanks. -- Greg Donald http://destiney.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: username > 30 characters?

2007-03-26 Thread Vasily Sulatskov
> It does work. However the "email" field of User should be set to > "blank=False" and "unique=True" if we really want to use email as the > unique userid. How can we override the default field definition of > User.email? You can add unique constraint on email column on database level, Django

django admin ordering by last modified

2007-03-26 Thread damacy
hi, there. i have a problem with the django admin site. i have a table called 'players' which consists of the following fields; 'lastname', 'firstname' and 'lastmodified'. and i have defined the ordering of the table by ordering = ['lastname', 'firstname']. (i.e. 'lastname' and then 'firstname'

Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > You will get dozens or hundreds of queries with very little way to tell > which thread or process is doing the logging. Since all the requests > will be interleaved, this will be even harder to track. Serialisation is > also a problem:

Re: Problem with order_with_respect_to and self

2007-03-26 Thread [EMAIL PROTECTED]
Malcom, Sorry, you are correct. I completely flubbed on that one. -Doug On Mar 26, 8:24 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-03-26 at 22:51 +, [EMAIL PROTECTED] wrote: > >http://www.djangoproject.com/documentation/model-api/#many-to-one-rel... > > > class

ANN: Barnum

2007-03-26 Thread Chris Moffitt
While this is not explicitly a Django tool, I hope you'll allow me to post a quick announcement about a project I'm releasing into the wild called Barnum. Here are some snippets from the readme to explain it a little bit more- What is Barnum? === Barnum is a python-based

Re: Problem with order_with_respect_to and self

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 22:41 -0300, Anderson Santos Silva wrote: > I am working with the trunk, and I never tried the order_with_respect_to > before, so I don't know how it works but it's on the official Django's > documentation. > Since my model is called Section, it's probably something about

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 20:22 -0500, Jeremy Dunck wrote: > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > I > > did an experiment early last year to put in calls to the python logging > > module throughout various paths in Django. It had a noticeable impact. > > I had this on my

Re: Problem with order_with_respect_to and self

2007-03-26 Thread Anderson Santos Silva
I am working with the trunk, and I never tried the order_with_respect_to before, so I don't know how it works but it's on the official Django's documentation. Since my model is called Section, it's probably something about Python tricks to get a property dinamically. That sounds exciting, my

Re: sql log

2007-03-26 Thread Jeremy Dunck
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I > did an experiment early last year to put in calls to the python logging > module throughout various paths in Django. It had a noticeable impact. I had this on my list of things to do at some point. I'm not arguing to add logging

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Tue, 2007-03-27 at 11:09 +1000, Malcolm Tredinnick wrote: > On Mon, 2007-03-26 at 19:57 -0500, Greg Donald wrote: > > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > If you want to capture every query automatically like this, you can edit > > > django/db/backends/util.py and

Re: newbie on django 0.96

2007-03-26 Thread Russell Keith-Magee
Hi John, On 3/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I did a search on this and was pointed at environment issues but > without a clear pointer as to what to do. If you are having problems with importing django.core.management, it means that the django-admin script can't import

Re: sql log

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 19:57 -0500, Greg Donald wrote: > On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > If you want to capture every query automatically like this, you can edit > > django/db/backends/util.py and put the logging to file in place inside > > the

Re: Problem with get_current_user via middleware

2007-03-26 Thread Malcolm Tredinnick
On Tue, 2007-03-27 at 02:52 +0200, Honza Král wrote: > On 3/27/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Mon, 2007-03-26 at 21:56 +0200, Gilhad wrote: > > > I am trying to get current user, but I have some problem with it. I got > > > different '_local' object each time ... > >

Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > If you want to capture every query automatically like this, you can edit > django/db/backends/util.py and put the logging to file in place inside > the CursorDebugWrapper.execute() method -- where it is currently > appending to

Re: Problem with get_current_user via middleware

2007-03-26 Thread Honza Král
On 3/27/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Mon, 2007-03-26 at 21:56 +0200, Gilhad wrote: > > I am trying to get current user, but I have some problem with it. I got > > different '_local' object each time ... > > > > I followed the example at > >

Re: Multiple types of users

2007-03-26 Thread Russell Keith-Magee
On 3/26/07, Anton Stonor <[EMAIL PROTECTED]> wrote: > > It would be nice if I could model these use types as different user > models, but a hack could of cause be to have one large profile and hide > different fields according to the user type. > > Ideas are welcome. Hi Anton, James Bennett has

Re: username > 30 characters?

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 16:25 +, John Lee wrote: > It does work. However the "email" field of User should be set to > "blank=False" and "unique=True" if we really want to use email as the > unique userid. How can we override the default field definition of > User.email? You cannot override

Re: Problem with order_with_respect_to and self

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 19:23 -0300, Anderson Santos Silva wrote: > Hello, I am having problem when I use the order_with_respect_to and > a self related foreign key model: > > When I validate this, it raises "'str' object has no attribute > 'get_section_order'" and when I use self or

Re: Problem with order_with_respect_to and self

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 22:51 +, [EMAIL PROTECTED] wrote: > http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships > > class Section(models.Model): > parent = models.ForeignKey('self', < BAD > parent = models.ForeignKey('Section', < GOOD I'm sorry, but

Re: Problem with get_current_user via middleware

2007-03-26 Thread Malcolm Tredinnick
On Mon, 2007-03-26 at 21:56 +0200, Gilhad wrote: > I am trying to get current user, but I have some problem with it. I got > different '_local' object each time ... > > I followed the example at > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > and make my model such way: >

Re: template ifequals always evaluates to true

2007-03-26 Thread Mikey
Awesome! I knew it had to be something small - many thanks! :) On Mar 26, 4:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > remove the ',' > > {% ifequal nav.slugName current %} > > -Doug > > On Mar 26, 7:06 pm, "Mikey" <[EMAIL PROTECTED]> wrote: > > > Can someone tell me why

Re: Database migration

2007-03-26 Thread Honza Král
On 3/27/07, Jonas Maurus <[EMAIL PROTECTED]> wrote: > > On Mar 26, 11:10 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > I apologize for the vague newbie question, but I'm gonna ask it > > anyway... > > > > I'd like to switch DBs from mysql to postgres... how does one do so? I > > assume

Re: template ifequals always evaluates to true

2007-03-26 Thread [EMAIL PROTECTED]
remove the ',' {% ifequal nav.slugName current %} -Doug On Mar 26, 7:06 pm, "Mikey" <[EMAIL PROTECTED]> wrote: > Can someone tell me why the following template code always evaluates > to true when comparing two strings: > > > {% for nav in nav_items %} > {% ifequal nav.slugName, current

template ifequals always evaluates to true

2007-03-26 Thread Mikey
Can someone tell me why the following template code always evaluates to true when comparing two strings: {% for nav in nav_items %} {% ifequal nav.slugName, current %} {{ nav.displayName }} {% else %} {{ nav.displayName }} {% endifequal %} {% endfor %} if

Re: Database migration

2007-03-26 Thread Jonas Maurus
On Mar 26, 11:10 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I apologize for the vague newbie question, but I'm gonna ask it > anyway... > > I'd like to switch DBs from mysql to postgres... how does one do so? I > assume one must export from mysql, import to postgres, then make the >

Re: Problem with order_with_respect_to and self

2007-03-26 Thread [EMAIL PROTECTED]
http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships class Section(models.Model): parent = models.ForeignKey('self', < BAD parent = models.ForeignKey('Section', < GOOD -Doug On Mar 26, 6:23 pm, Anderson Santos Silva <[EMAIL PROTECTED]> wrote: >

Problem with order_with_respect_to and self

2007-03-26 Thread Anderson Santos Silva
Hello, I am having problem when I use the order_with_respect_to and a self related foreign key model: When I validate this, it raises "'str' object has no attribute 'get_section_order'" and when I use self or Section, it raises the error: "Section has no field named 'self'" class

Re: Problem with get_current_user via middleware

2007-03-26 Thread Honza Král
On 3/26/07, Gilhad <[EMAIL PROTECTED]> wrote: > > I am trying to get current user, but I have some problem with it. I got > different '_local' object each time ... > > I followed the example at > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > and make my model such way: > >

Re: Displaying Related Data

2007-03-26 Thread [EMAIL PROTECTED]
You are so close! this is a very common question. you want something like: {% for school_emp in School.schoolpersonel_set.all %} But passing in the Model class 'School' is considered bad form. In your view, add the result of all() to your context: extra_context['personel'] =

Displaying Related Data

2007-03-26 Thread Paul G. Barnes
OK, I'm a Python/Django newbie (more or less), and I have a problem. I had these two models (details stripped for clarity: class School(models.Model): ... name = models.CharField() street = models.CharField() mail = models.CharField() city = models.CharField() state =

Problem with get_current_user via middleware

2007-03-26 Thread Gilhad
I am trying to get current user, but I have some problem with it. I got different '_local' object each time ... I followed the example at http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser and make my model such way: class Vykon(models.Model): user =

Re: fcgi - issues

2007-03-26 Thread David Zhou
On Mar 25, 2007, at 8:19 PM, Malcolm Tredinnick wrote: > > On Sun, 2007-03-25 at 15:54 -0700, David M. Besonen wrote: >> are there any issues/caveats/problems around using django + fcgi? >> >> i'm guessing there might things to be wary of, given that >> mod_python appears more prominently in the

Database migration

2007-03-26 Thread [EMAIL PROTECTED]
I apologize for the vague newbie question, but I'm gonna ask it anyway... I'd like to switch DBs from mysql to postgres... how does one do so? I assume one must export from mysql, import to postgres, then make the appropriate changes in settings.py, but are there any gotchas I should be aware

Re: foreign key filtering

2007-03-26 Thread RajeshD
> > msgs = Messages.active.filter( Q( project=project.id, project.active=True ) ) > Try this: msgs = Messages.active.filter(project__active=True) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Announcing Django 0.96!

2007-03-26 Thread Eugene Lazutkin
I updated the Windows installer for Django 0.96 using bdist_nsi and NSIS 2.18. Until it is hosted by djangoproject.com, ask me for a copy. Thanks, Eugene James Bennett wrote: > We're pleased to announce the release of Django 0.96 today; this > release involves cleanup and stabilization of

newbie on django 0.96

2007-03-26 Thread johna
I downloaded the latest release from django and followed the install instructions for windows. I am using windows 2000. Python 2.4 django 0.96. PostgreSQL 8.1 psycopg2. I then started the tutorial. I started to have problems with not being able to find modules such as django.core.management.

foreign key filtering

2007-03-26 Thread Greg Donald
How can I base a query on a foreign key field? If I have a project and I have messages for the project, and I only want to return messages from active projects, how do I write that? I already have a manager for getting active messages, and that works, but then I also need something like this

Re: Announcing Django 0.96!

2007-03-26 Thread Marius Scurtescu
On 3/26/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > On 3/24/07, mariuss <[EMAIL PROTECTED]> wrote: > > Hm, yes, there is such a folder: > > /usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg > > > > but isn't this recorded in some registry/database/path as well? > > No -- this is

Re: sql log

2007-03-26 Thread James Bennett
On 3/26/07, gdonald <[EMAIL PROTECTED]> wrote: > I tried a couple of page reloads, stuff I know is querying the > database, still nothing. It resets at the end of each page load, and each request/response cycle gets its own copy, so you need to access it from within that. The 'debug' context

Re: sql log

2007-03-26 Thread Greg Donald
On 3/26/07, Tim Chase <[EMAIL PROTECTED]> wrote: >result = render_to_response('foo.html', context) >f = file('debug.txt', 'w') >f.write(repr(connection.queries)) >f.close() >return result Where can I put this so I get all queries for every request into a single file? >

Re: sql log

2007-03-26 Thread Eric Walstad
Hey Greg, gdonald wrote: > On Mar 13, 5:03 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: >> http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running > > When I try this I get nothing: > >> python manage.py shell > In [1]: from settings import * > >

Re: sql log

2007-03-26 Thread Tim Chase
> In [3]: from django.db import connection > > In [4]: connection.queries > Out[4]: [] > > I tried a couple of page reloads, stuff I know is querying the > database, still nothing. > > Any idea what I'm doing wrong? The connection.queries is only available within a session/transaction.

filters/sql

2007-03-26 Thread Greg Donald
I have added a manager so to only return active messages in my Message model: class ActiveMessageManager(models.Manager): def get_query_set(self): return super(ActiveMessageManager, self).get_query_set().filter(date_removed__isnull=True).order_by('date_sent') That works fine as far

Illegal mix of collations

2007-03-26 Thread Gerard M
Hello dear django comunnity, Im having a bad time with my database in MySQL the problem is that when I try to store a word with some "rare" characters like á é í and many others, django shows this message to me OperationalError at /uploading/ (1267, "Illegal mix of collations

Re: sql log

2007-03-26 Thread gdonald
On Mar 13, 5:03 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > http://www.djangoproject.com/documentation/faq/#how-can-i-see-the-raw-sql-queries-django-is-running When I try this I get nothing: > python manage.py shell In [1]: from settings import * In [2]: DEBUG Out[2]: True In [3]: from

Re: username > 30 characters?

2007-03-26 Thread John Lee
It does work. However the "email" field of User should be set to "blank=False" and "unique=True" if we really want to use email as the unique userid. How can we override the default field definition of User.email? I tried something like this: from django.contrib.auth.models import User as

min_value & max_value in newforms IntegerFields

2007-03-26 Thread chasfs
I'm using newforms via form_for_model and would like to take advantage of the min_value and max_value for a newforms integer field. Ideally, this could go in the model definition for the IntegerField, but it doesn't have equivalent parameters. What's the recommended way to do this? Should I

Adding extra fields in the Admin interface

2007-03-26 Thread George Sakkis
Hi Djangonauts, I read chapters 6 and 18 of the django book about the admin interface and how to extend/customize it but I'm still at a loss on if and how can I add custom fields in the add/change form. What I want to be able to do is set in my model's Admin class extra fields that do not

Re: Announcing Django 0.96!

2007-03-26 Thread Jacob Kaplan-Moss
On 3/24/07, mariuss <[EMAIL PROTECTED]> wrote: > Hm, yes, there is such a folder: > /usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg > > but isn't this recorded in some registry/database/path as well? No -- this is just one of the reasons I greatly dislike eggs :/ > Is it safe to just

Almost Free Electronics

2007-03-26 Thread New and used Electronics
Grand opening at www.amirelectronics.com. Electronics including printers, copiers, scanners, fax machines, shredders, CD players, Laser ink cartridges toners, Mini chopper, computer accessories and a lot more at very affordable price. --~--~-~--~~~---~--~~ You

Dear

2007-03-26 Thread :-)
Dear Don't know exactly How it works... I recently joined AGLOCO because of a friend recommended it to me. I am now promoting it to you because I like the idea and I want you to share in what I think will be an exciting new Internet concept. AGLOCO's story is simple: Do you realize how

Multiple types of users

2007-03-26 Thread Anton Stonor
Hi there, I'm evaluating Django for a project and the framework fits in many ways. However on one issue it would be nice with some help to hand-sew the glove: We need multiple types of users. Different profiles and different permission. To be more specific: it is a event site where different

Re: Newbie problem with view/model interaction

2007-03-26 Thread [EMAIL PROTECTED]
Sorry I didn't see this thead earlier. We wrote a proposal review system for PyCon2007. The source code is under the Python License. http://us.pycon.org/TX2007/PyConTech https://svn.python.org/conference/django/trunk/ The goal is to write conference software for any conference. I could use some

Re: Newbie problem with view/model interaction

2007-03-26 Thread Malcolm Tredinnick
Hey Ross. :-) On Mon, 2007-03-26 at 01:48 -0700, Ross Burton wrote: > On Mar 25, 3:28 pm, "Ross Burton" <[EMAIL PROTECTED]> wrote: > > > What is it you want to do with the ones they've voted on vs. haven't? If > > > you're going to hide the ones they've already voted on, just write a > > > query

Re: Newbie problem with view/model interaction

2007-03-26 Thread Ross Burton
On Mar 25, 3:28 pm, "Ross Burton" <[EMAIL PROTECTED]> wrote: > > What is it you want to do with the ones they've voted on vs. haven't? If > > you're going to hide the ones they've already voted on, just write a > > query in the view method that only returns those and pass that to the > > context.