Command line app using Django is always "Idle in Transaction"

2007-11-09 Thread Nimrod A. Abing
Hello everyone, I have made a command line app that uses the Django ORM and transaction management. I followed much of what I have learned from this thread: http://www.mail-archive.com/django-users@googlegroups.com/msg32122.html there are other threads where I got "best practice" hints as well

Re: does is_valid handle unique=True

2007-11-09 Thread Malcolm Tredinnick
On Sat, 2007-11-10 at 11:41 +0530, Kenneth Gonsalves wrote: > hi, > > I was using form_for_model with one field which has unique=True. This > form passes the is_valid test, but postgres barfs on the duplicate > entry - am I doing something wrong, or does is_valid not handle > unique=True?

Re: does is_valid handle unique=True

2007-11-09 Thread Sean Perry
Kenneth Gonsalves wrote: > hi, > > I was using form_for_model with one field which has unique=True. This > form passes the is_valid test, but postgres barfs on the duplicate > entry - am I doing something wrong, or does is_valid not handle > unique=True? is_valid simply validates that the

Re: pull a random record from the database

2007-11-09 Thread James Bennett
On Nov 9, 2007 10:32 PM, Hani <[EMAIL PROTECTED]> wrote: > What I want to do is display 1 random book on the main page. I > currently use a generic view to display a list of books on the main > page but I also want a random book highlighted. (imagine two columns > on the main page, one is the

Re: __str__(self) for ManyToManyField

2007-11-09 Thread Malcolm Tredinnick
On Fri, 2007-11-09 at 08:19 -0800, Xan wrote: > > > On Nov 9, 2:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > On Thu, 2007-11-08 at 09:11 -0800, Xan wrote: > > > Hi, > > > > > I have these models: > > > > > class A(models.Model): > > > > > [...] > > >def __str__(self): > > >

Re: url tag difficulties

2007-11-09 Thread Todd O'Bryan
I've also been a little frustrated with the {% url %} tag. It's very easy to mess it up, and very hard to figure out what's messed up. I wonder if we couldn't provide some debugging information if DEBUG is set to true. Todd On Nov 9, 2007 10:54 PM, <[EMAIL PROTECTED]> wrote: > > I really hope

Using {% ifequal %} in my template is not working

2007-11-09 Thread Greg
Hello, I'm not sure what is going on here. In my template I have the following code: {% ifequal pinfo.shape "Round" %}Its Round{% else %}{{ pinfo.shape }} {% endifequal %} Everytime I run this code it goes directly to the else statement and {{ pinfo.material }} prints out Round. I'm not sure

Re: pull a random record from the database

2007-11-09 Thread Hani
Loren, Kenneth and Joe, Thanks for your response. I'm going to try your code and see. Thanks, Hani On Nov 9, 8:21 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 10-Nov-07, at 12:56 AM, LorenDavie wrote: > > > import random > > Book.objects.all()[random.randint(0,Book.objects.count()-1]

Re: pull a random record from the database

2007-11-09 Thread Hani
Hi again James, The section speaks to ordering the set randomly. I understand this to mean that the sort would be random. Is this incorrect? What I want to do is display 1 random book on the main page. I currently use a generic view to display a list of books on the main page but I also want a

Re: Django-multilingual

2007-11-09 Thread Matthias Urlichs
I've been hacking on django-multilingual a bit in the last few days. Fixes, so far: * import it into git (OK, that's not a fix per se, but how would I work on it otherwise?) * language codes in the database instead of in settings.py. Yay! * allow "unique" constraints in translated fields (they

url tag difficulties

2007-11-09 Thread girzel
I really hope this isn't embarrassingly obvious but... My {% url %} tags aren't producing anything -- no error and no url. My current setup is so bare-bones I can't imagine what's gone wrong. Here are the basics: ROOT_URLCONF = Project.urls In Project.urls: (r'^$', 'app1.views.index'),

Re: Getting a sum using an active QuerySet?

2007-11-09 Thread Steve Freitas
Thanks so much for your response, Russell. On Sat, 2007-11-10 at 12:10 +0900, Russell Keith-Magee wrote: > 1) Get hold of a cursor and write the full SQL query you want > yourself. It sounds like all you want is SELECT SUM(bar) FROM MYTABLE, > so this may be the easiest and most stable solution.

Re: Getting a sum using an active QuerySet?

2007-11-09 Thread Russell Keith-Magee
On 11/10/07, Steve Freitas <[EMAIL PROTECTED]> wrote: > > Hi all, > > I'm looking to get the sum of a column. I've seen plenty of examples > which illustrate using a QuerySet's extra(select={'foo': 'sum(bar)'}) > method, but my Postgres pukes on that: > > ERROR: column "app_model.id" must appear

Re: Using auth in model

2007-11-09 Thread James Bennett
On Nov 9, 2007 8:18 PM, Arnold Chen <[EMAIL PROTECTED]> wrote: > Sorry, there is a typo mistake, my question is "how to get logged-in" > user WITHOUT request parameter. > Because i want to use it in a function in models.py This is not possible. The logged-in user is an attribute of an HTTP

Fwd: Feed problems

2007-11-09 Thread Miguel Galves
Hi, i'm new to Django, and I'm warming up building a simple job board app. I'm trying to put a feed system to work using the middleware bundled with Django. - url.py: feeds = { 'ads': AdFeed, } urlpatterns = patterns('', (r'^admin/', include('django.contrib.admin.urls')), (r'^$',

Re: Using auth in model

2007-11-09 Thread Arnold Chen
Sorry, there is a typo mistake, my question is "how to get logged-in" user WITHOUT request parameter. Because i want to use it in a function in models.py regards, Arnold On 11月8日, 下午8時18分, Dan Fairs <[EMAIL PROTECTED]> wrote: > > My question above can be simplified as "how to get logged-in user

Getting a sum using an active QuerySet?

2007-11-09 Thread Steve Freitas
Hi all, I'm looking to get the sum of a column. I've seen plenty of examples which illustrate using a QuerySet's extra(select={'foo': 'sum(bar)'}) method, but my Postgres pukes on that: ERROR: column "app_model.id" must appear in the GROUP BY clause or be used in an aggregate function After

Re: pull a random record from the database

2007-11-09 Thread Kenneth Gonsalves
On 10-Nov-07, at 12:56 AM, LorenDavie wrote: > import random > Book.objects.all()[random.randint(0,Book.objects.count()-1] Book.objects.order_by('?')[0] -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You

Re: Apache post

2007-11-09 Thread Kenneth Gonsalves
On 09-Nov-07, at 7:28 PM, Mason wrote: > My Apache2.conf can be viewed here: http://dpaste.com/hold/24636/\ 1. never post the full conf file - relevant portion is enough 2. in debian/ubuntu, dont put vhost info in the main conf file. You make your vhosts files, one per vhost in

AutoImageField auto_rename

2007-11-09 Thread Matt
I using the AutoImageField[1] in a photo blog app. Has anyone had any luck getting the auto_rename to work properly. The first time I upload a photo the instance._get_pk_value returns None and the resulting image name is None.jpg. If I go in and change the image source via the admin the image is

Re: CSS problem

2007-11-09 Thread pepe
alert('x'); --~--~-~--~~~---~--~~ 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 PROTECTED]

Re: Unexpected logouts with latest from svn

2007-11-09 Thread Jason McVetta
On Nov 8, 2007 9:04 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > We're now at r6652 on trunk. So if that doesn't work for you, pick a > revision halfway betewen 6300 and 6652, update to that and see if the > problem appears. If so, go back halfway, otherwise go forwards halfway. > Keep

Re: pull a random record from the database

2007-11-09 Thread Joe
How about : Book.objects.order_by('?')[:1].get() On Nov 9, 2:26 pm, LorenDavie <[EMAIL PROTECTED]> wrote: > How about this: > > import random > Book.objects.all()[random.randint(0,Book.objects.count()-1] > > On Nov 9, 2:00 pm, Hani <[EMAIL PROTECTED]> wrote: > > > Hi James, > > > I did go

Re: custom forms, models and django 0.96

2007-11-09 Thread RajeshD
On Nov 9, 12:37 pm, schlam <[EMAIL PROTECTED]> wrote: > I am a developing in django 0.96 and therefor don't have the option to > use form_for_model with fields, so having developed a custom form to > add users to the database am experiencing minor problems with model > validation. > so my form

Strange problem with flup response code

2007-11-09 Thread Jarek Zgoda
I'm using Django-0.96.1 deployed on apache/mod_fastcgi and sometimes I see strange result of handling HTTP errors by flup 0.5. I started investigating the problem when I saw my app *never* returns any 404 nor 500 response, but the error log is full of tracebacks. In the code I often throw Http404

[new app] Django authentification application with openid using django auth contrib

2007-11-09 Thread Benoit Chesneau
Hi all, Finally released (with improvements) the application I use on friendsnippets to manage openid authentification. You could find it here : http://code.google.com/p/django-authopenid/ This application allow a user to connect to you website with : * legacy account : username/password

Re: admin-interface - 500 error - missing MEDIA_URL

2007-11-09 Thread Marty Alchin
On Nov 9, 2007 2:40 PM, James Bennett <[EMAIL PROTECTED]> wrote: > If you want to specify a different handler for 500s, that's up to you, > but be prepared for the inevitable complete breaking of your site when > something running inside it raises another exception. I think I'll settle for

Re: Customizing the Django admin interface

2007-11-09 Thread Joe
There's a few things to put together - urls.py needs something like (add a line before the normal admin line): (r'^admin/your_report/csv/$', 'yourproject.admin_views.report.csv_report'), (r'^admin/', include('django.contrib.admin.urls')), Then in your admin_views/report.py (or whatever you

Re: admin-interface - 500 error - missing MEDIA_URL

2007-11-09 Thread James Bennett
On Nov 9, 2007 1:29 PM, Brot <[EMAIL PROTECTED]> wrote: > does this mean, that there is no solution for this problem or is there > a smart workaround? This means there is absolutely nothing in Django which will, in the server error view, attempt to run your context processors. There is not a

Re: admin-interface - 500 error - missing MEDIA_URL

2007-11-09 Thread Brot
does this mean, that there is no solution for this problem or is there a smart workaround? I think I could use a custom templatetag. But this would violate DRY. Regards Bernd On Nov 9, 7:49 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Nov 9, 2007 12:34 PM, Brot <[EMAIL PROTECTED]>

Re: pull a random record from the database

2007-11-09 Thread LorenDavie
How about this: import random Book.objects.all()[random.randint(0,Book.objects.count()-1] On Nov 9, 2:00 pm, Hani <[EMAIL PROTECTED]> wrote: > Hi James, > > I did go through the API documentation but did not find what I wanted. > Please note that I am both a Django and Python newbie so its

Re: pull a random record from the database

2007-11-09 Thread James Bennett
On Nov 9, 2007 1:00 PM, Hani <[EMAIL PROTECTED]> wrote: > I did go through the API documentation but did not find what I wanted. > Please note that I am both a Django and Python newbie so its likely I > did not 'get it'. Would you direct me to the pertinent topic/heading/ > paragraph?

Re: admin-interface - 500 error - missing MEDIA_URL

2007-11-09 Thread James Bennett
On Nov 9, 2007 12:49 PM, Marty Alchin <[EMAIL PROTECTED]> wrote: > I seem to remember something a while back about 500 not processing too > much, to reduce the possibility of getting into a recursive loop of > exceptions. I can't seem to find that now, but that could be what > we're running into.

Re: pull a random record from the database

2007-11-09 Thread Hani
Hi James, I did go through the API documentation but did not find what I wanted. Please note that I am both a Django and Python newbie so its likely I did not 'get it'. Would you direct me to the pertinent topic/heading/ paragraph? And I did not take your response as mean. No worries. :) On

Re: admin-interface - 500 error - missing MEDIA_URL

2007-11-09 Thread Marty Alchin
On Nov 9, 2007 12:34 PM, Brot <[EMAIL PROTECTED]> wrote: > I have defined a 500.html template in my root template directory. > This template "extends" from my base.html template. In the base > template I have something like: > > > But if there is an 500 error in the admin interface, it seems

Re: pull a random record from the database

2007-11-09 Thread James Bennett
On Nov 9, 2007 12:44 PM, Hani <[EMAIL PROTECTED]> wrote: > What I would like to do is create a method to the model, say > random_id, so that object.random_id will access a random instance. I'm not trying to be mean, but what you should do is read Django's database API documentation, which

pull a random record from the database

2007-11-09 Thread Hani
Hi, I have a model, Books. On the main page of the site, I want to pull and display the details for a random book. What I would like to do is create a method to the model, say random_id, so that object.random_id will access a random instance. Would I define a function in the model definition

Re: CSS problem

2007-11-09 Thread David
excuse me, can you explain this please? On Nov 9, 7:25 pm, pepe <[EMAIL PROTECTED]> wrote: > alert('x'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: CSS problem

2007-11-09 Thread David
I seem to have a similar (stupid) problem, which I just can't get: (Though it's not the backslashes!) This is from my settings.py: MEDIA_ROOT = 'C:/django/myProject/src/media/' MEDIA_URL = 'http://localhost:8000/media/' ADMIN_MEDIA_PREFIX = '/media/' in my html-template: in urls.py:

custom forms, models and django 0.96

2007-11-09 Thread schlam
I am a developing in django 0.96 and therefor don't have the option to use form_for_model with fields, so having developed a custom form to add users to the database am experiencing minor problems with model validation. so my form is this : class UserForm(forms.Form): username =

custom forms, models and django 0.96

2007-11-09 Thread schlam
I am a developing in django 0.96 and therefor don't have the option to use form_for_model with fields, so having developed a custom form to add users to the database am experiencing minor problems with model validation. so my form is this : class UserForm(forms.Form): username =

admin-interface - 500 error - missing MEDIA_URL

2007-11-09 Thread Brot
Hello, I have defined a 500.html template in my root template directory. This template "extends" from my base.html template. In the base template I have something like: But if there is an 500 error in the admin interface, it seems that MEDIA_URL is empty.

Re: webhostingbuzz, anyone tried

2007-11-09 Thread stranger
Hello guys. I am trying to learn Djangi these days but having tough time. ... I wanted to host my site using Django but I am currently with hostmonster.com they dont support Django... So if any of you with WebFaction hosting can share me some space.. I am willing to share my hostmonster

Django and PyAMF, AMF remoting

2007-11-09 Thread Arnar
Hi folks, Some here might be interested in the following, others - excuse this annoyance :o) A few folks (Nick Joyce and Thijs Triemstra mostly) are working on PyAMF, an AMF encoder and decoder in Python. It may be considered pre- alpha for the moment. It includes Remoting gateways for Twisted,

Re: OS X 10.5 and MySQLDB compile issues

2007-11-09 Thread Roboto
mysql-5.0.45-osx10.4-i686 MySQL-python-1.2.2 Django 96 I had mysql installed from Tiger so it ported over fine, my databases seem to work just fine. As for MySQL python I followed the instructions listed here: http://sourceforge.net/tracker/index.php?func=detail=1808476_id=22307=374932 Then I

Re: __str__(self) for ManyToManyField

2007-11-09 Thread Xan
On Nov 9, 2:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-11-08 at 09:11 -0800, Xan wrote: > > Hi, > > > I have these models: > > > class A(models.Model): > > > [...] > >def __str__(self): > >return "(%s, %s)" % (self.estudi, self.curs) > > >class

Using GoogleMaps class in views

2007-11-09 Thread Txus Sanchez
Hi all, This is Txus Sanchez, newbie in Django. I'm trying to put some google maps in my views. For this purpose, I'm using the class called GoogleMaps. I'm trying to put it on my views but unlucky. The view code is this one: def pointView(request, id): point =

Re: "You don't have permission to access /doc/lookup/ on this server."

2007-11-09 Thread Mason
Yes, the problem was that there was an alias "/doc/" "/usr/share/doc/" declared under sites-enabled, and this was being imported into my Apache2.conf. I commented out the import statement, restarted Apache, and the problem was gone. Thanks for the quick response Forest Bond and RajeshD, it might

Re: OS X 10.5 and MySQLDB compile issues

2007-11-09 Thread GodOfGeeks
can u give me more info about the MySQL version and the commands u used for compiling On Nov 9, 4:19 pm, Roboto <[EMAIL PROTECTED]> wrote: > Help, has anyone got this to work? I've applied the patches to > _mysql.c and tried running it but it still continues to say that I am > missing the

OS X 10.5 and MySQLDB compile issues

2007-11-09 Thread Roboto
Help, has anyone got this to work? I've applied the patches to _mysql.c and tried running it but it still continues to say that I am missing the libraries required to make the build happen. This is brutal! --~--~-~--~~~---~--~~ You received this message because

Re: FlatPage and Internationalization

2007-11-09 Thread DvD
That's what i am about to do, but if guys from the development team agree we could implement it in the official django code On Nov 9, 3:34 pm, Eugene Morozov <[EMAIL PROTECTED]> wrote: > I've implemented similar system. Only I have used MyFlatPage and > MyFlatPageTranslation models, because it

Re: German dates (with date filter)

2007-11-09 Thread RajeshD
On Nov 9, 8:12 am, Florian Lindner <[EMAIL PROTECTED]> wrote: > Hello, > I use this line in my template: > > geschrieben am {{ entry.creationDate|date:"D, j.n.y, H:i" }} > > (geschrieben am == writen at) > > It produces output like "Wed, 26.9.07, 16:49" > > is there any way I can make this

Customizing the Django admin interface

2007-11-09 Thread GodOfGeeks
Hello all, I would like to add a new button to the searching page called "Convert to CSV". When I press the button, I want to covert the currently displayed results to a CSV (Comma separated values)format. if you could give me some guide lines about how to do this I would be really grateful.

Got IOError at < fp = open(full_filename, 'wb') > when I used ImageField.

2007-11-09 Thread Hu, Zhenghui
I added a ImageField(upload_to = ' ing/media/') into my model. MEDIA_ROOT = '/home/huzhenghui37/ppcat.huzhenghui37.net/' in settings.py. When I used this field in admin through (a file-upload widget), i chose an image ( /home/ huzhenghui37/faceicon.jpg ) and save. Then i got the error:

Re: strange custome sql

2007-11-09 Thread RajeshD
> > 1. cursor.execute( "insert into popo_status( id , author_id , body , > type ) VALUES (NULL , '1', body, '1') ") > no error, but insert nothing Try committing after that statement: connection.commit() > > 2. cursor.execute( "select * from popo_status where id=21 ") > no error, but ok > >

Re: "You don't have permission to access /doc/lookup/ on this server."

2007-11-09 Thread RajeshD
> > "You don't have permission to access /doc/lookup/ on this server." > > Note that /doc/lookup/ is a URL, not a folder, so there are no > permissions to set. I'm wondering if /doc might mean something special > to Apache? If not then any other ideas? > > My Apache2.conf can be viewed

Re: FlatPage and Internationalization

2007-11-09 Thread Eugene Morozov
I've implemented similar system. Only I have used MyFlatPage and MyFlatPageTranslation models, because it makes easier to locate and translate pages in the admin interface. On 9 нояб, 15:25, DvD <[EMAIL PROTECTED]> wrote: > Hi everyone, > lately i was trying to internationalize a wesite which

Re: "You don't have permission to access /doc/lookup/ on this server."

2007-11-09 Thread Forest Bond
Hi, On Fri, Nov 09, 2007 at 06:02:30AM -0800, Mason wrote: > I have a Django site that works fine on my Windows platform, but when > I ported it over Ubuntu I get the following error on just one of my > links: > > "You don't have permission to access /doc/lookup/ on this server." > > Note that

"You don't have permission to access /doc/lookup/ on this server."

2007-11-09 Thread Mason
Hi. I'm an Apache noobie using: Apache 2.0.59 Django 0.95.1-1ubuntu1 Python 2.5 Mod_python 3.2.10-3ubuntu1 Ubuntu 7.04 I have a Django site that works fine on my Windows platform, but when I ported it over Ubuntu I get the following error on just one of my links: "You don't have permission to

Apache post

2007-11-09 Thread Mason
Hi. I'm an Apache noobie using: Apache 2.0.59 Django 0.95.1-1ubuntu1 Python 2.5 Mod_python 3.2.10-3ubuntu1 Ubuntu 7.04 I have a Django site that works fine on my Windows platform, but when I ported it over Ubuntu I get the following error on just one of my links: "You don't have permission to

Re: German dates (with date filter)

2007-11-09 Thread Jarek Zgoda
Florian Lindner napisał(a): > I use this line in my template: > > geschrieben am {{ entry.creationDate|date:"D, j.n.y, H:i" }} > > (geschrieben am == writen at) > > It produces output like "Wed, 26.9.07, 16:49" > > is there any way I can make this output German which means in this case to >

German dates (with date filter)

2007-11-09 Thread Florian Lindner
Hello, I use this line in my template: geschrieben am {{ entry.creationDate|date:"D, j.n.y, H:i" }} (geschrieben am == writen at) It produces output like "Wed, 26.9.07, 16:49" is there any way I can make this output German which means in this case to print Mi instead of Wed? My local is

Re: FlatPage and Internationalization

2007-11-09 Thread DvD
Sorry, that shouldn't be MyFlatPage but just FlatPage... --~--~-~--~~~---~--~~ 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

FlatPage and Internationalization

2007-11-09 Thread DvD
Hi everyone, lately i was trying to internationalize a wesite which had flatpages, but i also needed to translate those pages so i came up with this idea to get site specific AND language specific flatpages. I put on the FlatPage class this attribute: language=

Re: Will there be a django 0.97 release ?

2007-11-09 Thread kahless
On Nov 9, 12:41 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > release, remain valid. It might sound harsh, but nothing's changed since > then. It's very time consuming to go around again on this topic (in > fact, it will slow down the next release, and I gather people in this > thread want

Re: Will there be a django 0.97 release ?

2007-11-09 Thread Jarek Zgoda
Malcolm Tredinnick napisał(a): > Finally, for everybody who feels that they really want to write > something in this thread about why there should be a 0.97, please accept > that (a) we are aiming for 1.0 and trying to read or intentionally > misread motivations into that, such as claiming it

Re: request.user -> logout

2007-11-09 Thread leahy_rich
I use the logout_then_login syntax in the urls.py Use this if you want to redirect the user back t the login screen when they log out. On Nov 9, 9:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-11-08 at 23:30 -0800, globophobe wrote: > > This is probably a simple question,

Re: Will there be a django 0.97 release ?

2007-11-09 Thread Remco Gerlich
On Nov 9, 2007 11:07 AM, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > > Malcolm Tredinnick napisał(a): > The next release will almost certainly be written as "1.0". > > Bad news. We have a policy to use only published versions of libraries, > so our way from 0.96.x to all sweet improvements like

Re: Will there be a django 0.97 release ?

2007-11-09 Thread Jarek Zgoda
Malcolm Tredinnick napisał(a): >> So are there any plans on releasing a 0.97 ? > > The next release will almost certainly be written as "1.0". Bad news. We have a policy to use only published versions of libraries, so our way from 0.96.x to all sweet improvements like unicode will be

Re: Will there be a django 0.97 release ?

2007-11-09 Thread kahless
On Nov 9, 2:58 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > work towards 1.0. Trust me on this: the maintainers want to get it out > the door as much as you do. i'm sure they do .. but my "fear" (or .. guess) is that it might be more important to be bug-free and stable for such a big

Re: Best Django Blogs

2007-11-09 Thread DierRe
Yes, the B-List is the top. I also suggest djangosnippets even if it is not a blog. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to