Re: querySet + select distinct

2009-11-19 Thread Andy McKay
On 09-11-19 3:36 PM, Benjamin Wolf wrote: > I'm trying to create a select with the django query set which should > give me the same result like this sql statement: > SELECT distinct(YEAR(`mydate`)) FROM `table` > > I've tried it for a while but don't get it. Try using values in the filter eg:

Re: passing vars to filters?

2009-11-19 Thread neridaj
Thanks Karen. On Nov 19, 4:56 pm, Karen Tracey wrote: > On Thu, Nov 19, 2009 at 7:25 PM, neridaj wrote: > > Is it possible to pass vars to filters rather than hard coding the > > field name, something like this: > > > def search(request): > >    query =

Re: Multiple sites on a single server

2009-11-19 Thread Graham Dumpleton
On Nov 20, 4:33 am, Stodge wrote: > I got this working with several sites using Apache. I just created a > configuration file for each site and pointed it to different settings > files: > > >     SetHandler python-program >     PythonHandler django.core.handlers.modpython >  

Re: passing vars to filters?

2009-11-19 Thread Karen Tracey
On Thu, Nov 19, 2009 at 7:25 PM, neridaj wrote: > Is it possible to pass vars to filters rather than hard coding the > field name, something like this: > > def search(request): >query = request.GET.get('q', '') >bits = request.GET.get('models', '').partition('.') >

Re: Initial values for formwizard form

2009-11-19 Thread geraldcor
This worked perfectly. Thank you. I used parse_params because I needed to add default company profile stuff to the first wizard form. Thank you again for clearing up my ignorance. Greg On Nov 18, 9:10 pm, "Mark L." wrote: > On Nov 19, 1:28 am, geraldcor

passing vars to filters?

2009-11-19 Thread neridaj
Is it possible to pass vars to filters rather than hard coding the field name, something like this: def search(request): query = request.GET.get('q', '') bits = request.GET.get('models', '').partition('.') model_name = bits[0] field_name = bits[2] model_type =

Re: FAQ?

2009-11-19 Thread Kenneth Gonsalves
On Thursday 19 Nov 2009 9:32:59 pm Andy McKay wrote: > > Does anyone want to take a stab at an FAQ? There are a lot of repeated > > questions on the list. > > How about http://docs.djangoproject.com/en/dev/faq/ > there was also an IRC faq - but it is no longer mentioned in the IRC topic. --

Re: Multiple sites on a single server

2009-11-19 Thread Kenneth Gonsalves
On Thursday 19 Nov 2009 11:01:10 pm Eric Elinow wrote: > I currently do this for the 5 or so sites that I operate for a client. A > single Apache setup for Django, with the various virtual hosts being > directed to their own path(s), and any static media requests being port > forwarded from

Re: How should I use manage.py dumpdata, and loaddata?

2009-11-19 Thread Russell Keith-Magee
On Thu, Nov 19, 2009 at 9:59 AM, Sachi wrote: > Hi, all, > > I have been developing a website, where I use the same postgresql > database server for both development and production. Now that I have > had many users and a significant amount of data, I am trying to use > sqlite3

querySet + select distinct

2009-11-19 Thread Benjamin Wolf
Hello, I'm trying to create a select with the django query set which should give me the same result like this sql statement: SELECT distinct(YEAR(`mydate`)) FROM `table` I've tried it for a while but don't get it. Something like self.fields['field'].choices = [('x', 'x') for disp in

Re: autogenerated 'id' field from Django model doesn't autoincrement?

2009-11-19 Thread Karen Tracey
On Thu, Nov 19, 2009 at 4:50 PM, Ken MacDonald wrote: > Define a models.py as: > > from django.db import models > > # Create your models here. > class Cardrange(models.Model): > minbin = models.DecimalField(max_digits=12, decimal_places=0) > maxbin =

Re: Automatic swapping of field data?

2009-11-19 Thread Doug Blank
On Thu, Nov 19, 2009 at 4:36 PM, Preston Holmes wrote: > There are some details left out of how you want this to look. > > The lower the level you try to make an object self protecting, the > trickier it's going to be. > > The sweet spot I think here is a custom manager that

Re: autogenerated 'id' field from Django model doesn't autoincrement?

2009-11-19 Thread Karen Tracey
On Thu, Nov 19, 2009 at 4:50 PM, Ken MacDonald wrote: > > 1) is it a bug that 'id' is generated as an 'integer' rather than >> 'serial' >> > type? >> >> I'd be curious as to how your DB got set up that way, since Django's >> table-creation routines map AutoField to SERIAL: >>

Re: casting unicode to model

2009-11-19 Thread neridaj
I just found out that get() returns only one object. On Nov 19, 2:30 pm, neridaj wrote: > Thanks for the help. Is get_object_for_this_type() not made to handle > multiple objects? If more than one object is returned I get this > error: get() returned more than one Entry. > >

Re: casting unicode to model

2009-11-19 Thread neridaj
Thanks for the help. Is get_object_for_this_type() not made to handle multiple objects? If more than one object is returned I get this error: get() returned more than one Entry. On Nov 19, 4:10 am, David De La Harpe Golden wrote: > Karen Tracey wrote: > >

Strange debugger behavior

2009-11-19 Thread Nick Arnett
I'm not sure if this is a bug... couldn't find anything quite like it in the tracker. I'm using Komodo as my IDE. When I step through source, the filters in a Model.objects.filter method are ignored. Instead of getting the handful of rows that I want from my database, Django (1.1) grabs the

Re: autogenerated 'id' field from Django model doesn't autoincrement?

2009-11-19 Thread Ken MacDonald
> > > 1) is it a bug that 'id' is generated as an 'integer' rather than > 'serial' > > type? > > I'd be curious as to how your DB got set up that way, since Django's > table-creation routines map AutoField to SERIAL: > > >

Re: Automatic swapping of field data?

2009-11-19 Thread Preston Holmes
There are some details left out of how you want this to look. The lower the level you try to make an object self protecting, the trickier it's going to be. The sweet spot I think here is a custom manager that adds a protect filter, and perhaps a subclass of ModelForm if you need this in forms.

Re: how to run django with fastcgi, but not run as user "root" on linux

2009-11-19 Thread Carl Zmola
OOPS, sudo -u nobody (rest of the command line) but you have to be set up with appropriate privledges. check sudo -l to see what commands you are allowed to sudo. Carl Carl Zmola wrote: > su -u nobody (rest of the command line) works for me. > > Fm wrote: > >> I know how to solve it . >>

Re: autogenerated 'id' field from Django model doesn't autoincrement?

2009-11-19 Thread James Bennett
On Thu, Nov 19, 2009 at 1:57 PM, Ken MacDonald wrote: > So, a couple questions: > > 1) is it a bug that 'id' is generated as an 'integer' rather than 'serial' > type? I'd be curious as to how your DB got set up that way, since Django's table-creation routines map AutoField to

Re: how to run django with fastcgi, but not run as user "root" on linux

2009-11-19 Thread Carl Zmola
su -u nobody (rest of the command line) works for me. Fm wrote: > I know how to solve it . > su nobody -c cmdline -s /bin/sh > Thanks > > On Nov 19, 11:12 am, Fm wrote: > >> Hi, >> I'm am green-hand to linux. >> When I use /usr/bin/su nobody -c /usr/local/bin/python

Re: @login_required decorator sends me to the wrong URL

2009-11-19 Thread Preston Holmes
http://docs.djangoproject.com/en/1.1/ref/settings/#login-url There are going to be some other places you will have to be careful running django on a path other than / -Preston On Nov 19, 7:11 am, Stodge wrote: > I added the @login_required decorator to my view but it

Re: Django website stats

2009-11-19 Thread Brian McKeever
I haven't had a chance to play with this yet: http://code.google.com/p/django-tracking/ but it might do what you want. On Nov 19, 11:35 am, Fabio Natali wrote: > Martin Lundberg wrote: > > I am very new to Django but can't this be handled by middleware > > instead?

autogenerated 'id' field from Django model doesn't autoincrement?

2009-11-19 Thread Ken MacDonald
I have a postgreSQL / psycopg2 DB generated by my Django model with a single user table (normally read-only) that will be updated via batch job about once a week. The PK is the autogenerated 'id' field; however in postgreSQL the generated field is of type 'integer' rather than type 'serial' which

Re: Apache/mod_wsgi woes

2009-11-19 Thread Brandon Taylor
Well, for whatever reason, my setup is working again after updating to Fusion 3. I'm not sure if something within Fusion got hosed, but I doubt it, since I was seeing the same behavior on two different Macs, one at home, one at the office. After a clean install of Ubuntu 9.1, Apache2 and

Re: Django website stats

2009-11-19 Thread Fabio Natali
Martin Lundberg wrote: > I am very new to Django but can't this be handled by middleware > instead? It should have access to user and page data should it not? > > -Martin > > On Thursday, November 19, 2009, Fabio Natali > wrote: > > Hi there! > > > > I have a Django

Re: Internal server error 500 with mod_wsgi

2009-11-19 Thread Karen Tracey
On Thu, Nov 19, 2009 at 11:51 AM, Alessandro Ronchi < alessandro.ron...@soasi.com> wrote: > > > On Thu, Nov 19, 2009 at 5:28 PM, Alessandro Ronchi < > alessandro.ron...@soasi.com> wrote: > >> >>> Really, you can get both pretty debug pages and emails with mod_wsgi as >>> well as you can with the

Re: Django website stats

2009-11-19 Thread Martin Lundberg
I am very new to Django but can't this be handled by middleware instead? It should have access to user and page data should it not? -Martin On Thursday, November 19, 2009, Fabio Natali wrote: > Hi there! > > I have a Django based website with a few dozen users. Only

Re: Multiple sites on a single server

2009-11-19 Thread andreas schmid
i would suggest to everyone start using buildout to develop or deploy. it gives so many advantages about separation between projects. a huge advantage is the repetibility of the project and you dont have to touch the pythonpath of your server, everything is done by the buildout configuration!

Re: Multiple sites on a single server

2009-11-19 Thread Stodge
I got this working with several sites using Apache. I just created a configuration file for each site and pointed it to different settings files: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE test.settings PythonOption

Re: Multiple sites on a single server

2009-11-19 Thread Eric Elinow
On 19 Nov, 2009, at 12:23 , Mark Freeman wrote: > I currently have a working site running Django and now want to move a > couple of other of my sites to Django as well. I'm in the process of > moving off a hosted VPS to my own local server, where the existing > Django site is. > > My questions

Multiple sites on a single server

2009-11-19 Thread Mark Freeman
I currently have a working site running Django and now want to move a couple of other of my sites to Django as well. I'm in the process of moving off a hosted VPS to my own local server, where the existing Django site is. My questions is more of best practice when deploying multiple sites to the

Re: How should I use manage.py dumpdata, and loaddata?

2009-11-19 Thread f4nt
I typically dump all of my apps individually, and load them individually. Unfortunately finding out where/why imports break with loaddata is problematic without inserting some debugging code in your django stack. Hence, I dump all my stuff individually, and I can at least somewhat narrow down

How should I use manage.py dumpdata, and loaddata?

2009-11-19 Thread Sachi
Hi, all, I have been developing a website, where I use the same postgresql database server for both development and production. Now that I have had many users and a significant amount of data, I am trying to use sqlite3 engine when I do development locally instead of connecting to the production

Re: Internal server error 500 with mod_wsgi

2009-11-19 Thread Alessandro Ronchi
On Thu, Nov 19, 2009 at 5:28 PM, Alessandro Ronchi < alessandro.ron...@soasi.com> wrote: > >> Really, you can get both pretty debug pages and emails with mod_wsgi as >> well as you can with the development server or mod_python. I've seen both. >> The problem with both exception traces you have

Re: Internal server error 500 with mod_wsgi

2009-11-19 Thread Alessandro Ronchi
> > > Really, you can get both pretty debug pages and emails with mod_wsgi as > well as you can with the development server or mod_python. I've seen both. > The problem with both exception traces you have shown is that the exception > is occurring too early in the processing -- neither of these

Re: FAQ?

2009-11-19 Thread Andy McKay
On 09-11-19 7:57 AM, Carl Zmola wrote: > Does anyone want to take a stab at an FAQ? There are a lot of repeated > questions on the list. How about http://docs.djangoproject.com/en/dev/faq/ -- Andy McKay, @clearwind Training: http://clearwind.ca/training/ -- You received this message

FAQ?

2009-11-19 Thread Carl Zmola
Does anyone want to take a stab at an FAQ? There are a lot of repeated questions on the list. I am fairly new to Django, and I see many people asking questions about what I ran into. Also, I am running into new problems that I have seen asked before, but didn't appreciate at the time. Carl

Re: Apache/mod_wsgi woes

2009-11-19 Thread Brandon Taylor
Hi Andy, Thanks for the reply. The Ubuntu instance only has one Python installed - 2.6.4. I thought it might be a problem related to that as well. This has been a really, really frustrating problem! Even setting up a new VM from scratch and re-installing everything hasn't solved this issue. I

Re: Apache/mod_wsgi woes

2009-11-19 Thread Andy McKay
On 09-11-19 6:40 AM, Brandon Taylor wrote: > ImproperlyConfigured: ImportError filebrowser: No module named > filebrowser > > I can start python from the command line, and import filebrowser, > django, or any of my other modules without errors. You could be using a different python. If you

@login_required decorator sends me to the wrong URL

2009-11-19 Thread Stodge
I added the @login_required decorator to my view but it redirects me to: http://localhost/accounts/login whereas the URL for my site is: http://localhost/test/accounts/login This is on Apache. Did I forget to configure something in settings.py? Thanks -- You received this message because

URLs created by custom python-markup filter are incorrect

2009-11-19 Thread Stodge
I'm using a custom python-markup filter, which seems to be working well. However, my URLs aren't relative to my site. So if the rendered text before filtering contains: [/login Login] and the login page is at: http://localhost/test/login the filter produces an URL of: http://localhost/login

Apache/mod_wsgi woes

2009-11-19 Thread Brandon Taylor
Hi everyone, I'm developing on Ubuntu 9.1 in a VM Ware Fusion instance on OS X, 10.5.8. I have apache2-mpm-worker and mod_wsgi installed through aptitude. I have Django 1.1.1 installed in /usr/local/lib/python2.6/dist- packages. My django project is in: /home/btaylor/django_projects/cit My

Re: Use manage.py dumpdata, and loaddata?

2009-11-19 Thread Russell Keith-Magee
On Thu, Nov 19, 2009 at 10:07 PM, Dawei Shen wrote: > Hi, all, > > I have been developing a website, where I use the same postgresql > database server for both development and production. Now that I have > had many users and a significant amount of data, I am trying to use >

Use manage.py dumpdata, and loaddata?

2009-11-19 Thread Dawei Shen
Hi, all, I have been developing a website, where I use the same postgresql database server for both development and production. Now that I have had many users and a significant amount of data, I am trying to use sqlite3 engine when I do development locally instead of connecting to the production

Re: Strange reverse behaviour

2009-11-19 Thread Karen Tracey
On Thu, Nov 19, 2009 at 6:25 AM, Maksymus007 wrote: > I got my main urls.py file > > urlpatterns = patterns('', > (...) >(r'^wakers/$', include('appname.wakers.urls')), > (...) > ) > > and this works well > > then i got wakers.urls.py > > urlpatterns =

Re: how to run django with fastcgi, but not run as user "root" on linux

2009-11-19 Thread Fm
I know how to solve it . su nobody -c cmdline -s /bin/sh Thanks On Nov 19, 11:12 am, Fm wrote: > Hi, > I'm am green-hand to linux. > When I use /usr/bin/su nobody -c /usr/local/bin/python /home/admin/cc/ > manage.py runfcgi > method=threaded host=127.0.0.1 port=12345 > it say

Re: casting unicode to model

2009-11-19 Thread David De La Harpe Golden
Karen Tracey wrote: > Undocumented internal routine, but unlikely to change: > Just to note the contenttypes framework has a documented way: http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#methods-on-contenttype-instances from django.contrib.contenttypes.models import

Strange reverse behaviour

2009-11-19 Thread Maksymus007
I got my main urls.py file urlpatterns = patterns('', (...) (r'^wakers/$', include('appname.wakers.urls')), (...) ) and this works well then i got wakers.urls.py urlpatterns = patterns('wakers', (r'^$', 'views.add', {}, 'wakers-add'), (r'^b$', 'views.add', {}, 'wakers-add2'), )

how to serve multiple files using mod_wsgi

2009-11-19 Thread Amit Sethi
Hi , I have been trying to make a project work with mod_wsgi under apache . The project is not exactly in django . It has a development server of its own for adapting I was using this as a reference .The mod_wsgi manual says that you have to send the response in following manner def

Re: digg style pagination

2009-11-19 Thread Tim Chase
> But getting an exception. Could you help to fix it please? > > TemplateSyntaxError at /section/home > > Caught an exception while rendering: 'request' > > Original Traceback (most recent call last): > File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", > line 71, in

Forms ModelMultipleChoiceField with checkboxes?

2009-11-19 Thread Benjamin Wolf
Hello, I'm using Django's form and ModelMultipleChoiceField. ModelMultipleChoiceField produces a select list with multiple options. Is it possible to use checkboxes instead? Thanks, Greets Ben -- You received this message because you are subscribed to the Google Groups "Django users" group.