dynamic mod wsgi

2008-12-08 Thread ben.dja...@googlemail.com
Hi, I'm converting to the excellent mod_wsgi and wondering if it's possible to make a single httpd virtual host/wsgi file to manage wildcard subdomains. Basically I have an app where i'm creating a new instance for each client and using subdomains. So client1.example.com and client2.example.com

Re: Please help me with static files serving

2008-12-08 Thread Jeff Anderson
Oleg Oltar wrote: > Hi! > > I am trying to setup django to use static files for development purposes. > I used http://docs.djangoproject.com/en/dev/howto/static-files/ > > But actually failed to serve anything :( > > My urls.py > > urlpatterns = patterns('django.views.generic.simple', >

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Jason Sidabras
Sounds good. I will probably work with Twill. Thanks! On Dec 8, 10:34 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-12-08 at 20:16 -0800, Jason Sidabras wrote: > > Sorry, I guess I missed that part. > > > In my template it checks if there is a user logged in or not. If there

Re: Complex lookups and SelectMultiple widget

2008-12-08 Thread issya
Thank you for the reply. I tried going the route of using the below. Is your way better? Since 'in' needs a list as an argument and SelectMultiple returns a list: if request.method == "POST" or request.GET.get('page', ''): search_form = SearchForm(request.POST)

Please help me with static files serving

2008-12-08 Thread Oleg Oltar
Hi! I am trying to setup django to use static files for development purposes. I used http://docs.djangoproject.com/en/dev/howto/static-files/ But actually failed to serve anything :( My urls.py urlpatterns = patterns('django.views.generic.simple',

OperationalError -- Table has no column named ..

2008-12-08 Thread djan
Hello, I'm running OpenSuSE-11.0 with the lastest version of django and sqlite3. When I enter the admin interface to enter data into my database, I got the error: OperationalError at /admin/archive/artist/add/ table archive_artist has no column named salutation Request Method: POST

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Malcolm Tredinnick
On Mon, 2008-12-08 at 20:16 -0800, Jason Sidabras wrote: > Sorry, I guess I missed that part. > > In my template it checks if there is a user logged in or not. If there > is not a user, it defaults the hidden field to send_id=1 and has a > form to place an email address. If the user is logged

Re: Bug / missing docs for ModelForms with string ForeignKeys?

2008-12-08 Thread Steven Skoczen
While that makes sense, and I understand the concerns about keeping documentation focused on highlighting the most common cases, a small note with the "suspension" information you described near the section on foreign keys doesn't seem out of place, and would greatly aid people who might not be

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Jason Sidabras
Sorry, I guess I missed that part. In my template it checks if there is a user logged in or not. If there is not a user, it defaults the hidden field to send_id=1 and has a form to place an email address. If the user is logged in the template uses the pk_id from the user (in the case of

Re: Bug / missing docs for ModelForms with string ForeignKeys?

2008-12-08 Thread Malcolm Tredinnick
On Mon, 2008-12-08 at 17:46 -0800, Steven Skoczen wrote: > Hi everyone, > > Have run into either a bug or a lack of documentation, and wanted to > see the consensus here before posting a ticket. > > When using a Model with an string foreign key (ie. for a second model > that appears after the

Re: modelformset_factory error: (Hidden field id) with this None already exists.

2008-12-08 Thread Karen Tracey
On Mon, Dec 8, 2008 at 12:52 PM, cyberjack <[EMAIL PROTECTED]> wrote: > > Thanks for the idea Karen, > > What's the right mechanism for passing the queryset back into the > form? I don't see an example in the docs. > Just pass the queryset= parm into formset creation during post as you do

Bug / missing docs for ModelForms with string ForeignKeys?

2008-12-08 Thread Steven Skoczen
Hi everyone, Have run into either a bug or a lack of documentation, and wanted to see the consensus here before posting a ticket. When using a Model with an string foreign key (ie. for a second model that appears after the referencing model), there's no way to make a modelform work if it's

Re: User in form wizard

2008-12-08 Thread Nathaniel Whiteinge
On Dec 8, 8:00Â am, chewynougat <[EMAIL PROTECTED]> wrote: > Could anyone tell me if I can pass the current user to a form wizard > step so I can prepopulate their object details in the form? If so, > how? It depends on where exactly you need to access the current user. If you can do it *after*

Re: Unit Testing forms with hidden fields

2008-12-08 Thread Malcolm Tredinnick
On Mon, 2008-12-08 at 15:00 -0800, Jason Sidabras wrote: > Hello, > > I am working on adding unit testing to my code and the snag I have > come across is in regards to unit fields. > > When user.is_anonymous() I have a hidden field sender_id = 1 which is > easy to test by: > > from

Re: i18n and l10n of templates for emails

2008-12-08 Thread Malcolm Tredinnick
On Mon, 2008-12-08 at 07:11 -0800, Kresimir Tonkovic wrote: > Hi! > > I'm using templetes to generate the HTML body for some reports I send > daily by email. I do it like this: > > context = Context() > context["some_var"] = some_value > > > resp =

custom distinct() method

2008-12-08 Thread jamesjacksonn...@gmail.com
Here comes the question about the proper usage of queryset's distinct () method. As i have a queryset model.objects.filter (column='name').distinct() , the distinct method is applied to whole objects, but i'd like it to be applied to column. Django makes SQL query "SELECT DISTINCT column,

Re: time it takes django to read database?

2008-12-08 Thread Jay Parlar
Could you post your urls.py file for your blog app? It's very easy to make a mistake in there that results in confusing time-related errors. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Development server crash with no error message

2008-12-08 Thread Graham Dumpleton
On Dec 9, 8:50 am, Andrew Fong <[EMAIL PROTECTED]> wrote: > When I'm poking around in my Django app, my development server > (manage.py runserver) will sometimes quit without raising an exception > or leaving any messages. I am not tinkering around with the code or > doing anything that would

Re: range-like template tag?

2008-12-08 Thread Berco Beute
Ah! Of course, why didn't I think of that! Works like a charm. Thx! 2B On Dec 8, 7:23 pm, Adi Sieker <[EMAIL PROTECTED]> wrote: > Couldn't you add a method get_range() (or whatever name makes sense in   > your context) > to the class the object is an instqnce of. > The method would look

Re: No module named urls

2008-12-08 Thread TheIvIaxx
Ok, i got it all sorted out. Thanks Rob and Malcom. It was a problem in my accounts.urls.py file. I had made some placeholder urls to edit and save but never put them into the view.py. I commented them out for now and it worked like a champ. Its wierd this never poped up in my windows box

Development server crash with no error message

2008-12-08 Thread Andrew Fong
When I'm poking around in my Django app, my development server (manage.py runserver) will sometimes quit without raising an exception or leaving any messages. I am not tinkering around with the code or doing anything that would force a reload. It just decides to quit. I can check the last

Re: Displaying image stored in models.ImageField

2008-12-08 Thread Craig Spry
Hello All, I fixed my problem I needed to add a line like this to urls.py: (r'^uploads/(?P.*)$', 'django.views.static.serve', { 'document_root': 'c:/src/webcomic/uploads' } ) Thanks, Craig Spry On Mon, Dec 8, 2008 at 10:49 PM, Craig Spry <[EMAIL PROTECTED]> wrote: > Hello All, > > Just to add

Re: time it takes django to read database?

2008-12-08 Thread garagefan
I've not set anything up... On Dec 8, 1:48 am, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > Do you use caching? > > On Mon, Dec 8, 2008 at 07:34, garagefan <[EMAIL PROTECTED]> wrote: > > > ok... i've been able to figure out how long it takes based on the time > > stamp... an hour and a half for

Many to Many entries being duplicated, any ideas?

2008-12-08 Thread Darthmahon
Hi Guys, I've got a model that has a Many to Many relationship on one of the fields. This relationship is basically on itself though like this: # class UserProfile(models.Model): user= models.ForeignKey(User, unique=True) friends_new

Re: running template filters after the page has loaded.

2008-12-08 Thread R. Gorman
You're likely going to need to need to run to urlencode function within the view that processes your ajax request. Should be able to import using 'from urllib import urlencode' and then 'urlencode(*your string variable*)'. R. --~--~-~--~~~---~--~~ You received

GeoDjango Server-side Clustering

2008-12-08 Thread Alfonso
Anyone know of an straightforward way to cluster co-ordinate points server-side i.e. in geoDjango prior to being displayed on an openlayers map via a standard KML? At the moment I'm loading some 2000 coordinates from a KML generated by geoDjango but this is quite understandably slowing the

running template filters after the page has loaded.

2008-12-08 Thread tod
I have an ajax-style update to a page that inserts html into the page after it has already loaded (and run template filters, etc). Is there a way to have the template filters run on the inserted html. Here are the specifics: A list of folders is displayed upon the initial load of the page.

Re: i18n and l10n of templates for emails

2008-12-08 Thread Kresimir Tonkovic
On 8 pro, 18:16, "R. Gorman" <[EMAIL PROTECTED]> wrote: > I ran into the same issue, but different encoding.  I found that > adding a special comment line to the beginning of the python file > allowed for the desired encoding (source: 2.2.3 > fromhttp://www.python.org/doc/2.5.2/tut/node4.html).

Re: Django Training

2008-12-08 Thread Milan Andric
On Mon, Dec 8, 2008 at 10:39 AM, Roland van Laar <[EMAIL PROTECTED]> wrote: > > Steve Holden wrote: >> I am looking at expanding our training offerings for the coming year, >> and a short course in Django looks like it might be popular. There >> don't seem to be many Django classes at the moment,

Re: How to import DoesNotExist exception ???

2008-12-08 Thread Info Cascade
I just want to catch the exception thrown when the query returns nothing. Thanks, that seems to have done the trick. [EMAIL PROTECTED] wrote: > I'm not sure where you got that code snippet from, but DoesNotExist is > an attribute on model classes, so that shoul read: > > except Tag.DoesNotExist.

Re: selected ModelMultipleChoiceField

2008-12-08 Thread Håkan Waara
Yes, that's what my reply to you was about. The below examples work for ModelChoiceField, you only need to use the same technique on a ModelMultipleChoiceField, where I - like I wrote - guess you can use a tuple of initial values, e.g. ("foo", "bar"). /Håkan 8 dec 2008 kl. 18.30 skrev

Re: How to import DoesNotExist exception ???

2008-12-08 Thread [EMAIL PROTECTED]
I'm not sure where you got that code snippet from, but DoesNotExist is an attribute on model classes, so that shoul read: except Tag.DoesNotExist. On Dec 8, 2:52 pm, Info Cascade <[EMAIL PROTECTED]> wrote: > How do I import the DoesNotExist exception? > > This doesn't seem to work:> from

Re: range-like template tag?

2008-12-08 Thread Adi Sieker
Hi, On 08.12.2008, at 17:30, Berco Beute wrote: > > The 'someInt' is an attribute of an object I pass to the template. It > varies with each object. I could of course make a dictionary with the > object and a list of the integers but it would be handy to solve it in > the template (although you

Re: templates database access

2008-12-08 Thread maeck
Your user will not have access to your database from the browser, so you cannot do any kind of create, update and deletes from templates directly. It will always have to go through POST on your views. You could do some AJAX to avoid web-page roundtrips, but then again, you will be using views to

Re: Reducing the number of my view's database queries

2008-12-08 Thread maeck
I think you are on something here. Below is what concerns me most in the example: data[o.name].append(o.model3_set.all().order_by('created')[0]) This will sort the entire model3 table just to get the min value. And if the db is doing this 6000 times, that is a bit useless. Have you tried using

Re: modelformset_factory error: (Hidden field id) with this None already exists.

2008-12-08 Thread cyberjack
Thanks for the idea Karen, What's the right mechanism for passing the queryset back into the form? I don't see an example in the docs. Thanks! -Josh On Dec 4, 4:10 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, Dec 4, 2008 at 2:12 AM, cyberjack <[EMAIL PROTECTED]> wrote: > > > Hi, >

Re: selected ModelMultipleChoiceField

2008-12-08 Thread Abdel Bolanos Martinez
what I want is use ModelMultipleChoiceField with a queryset but I need that some of the of the generated be mareked as

Re: i18n and l10n of templates for emails

2008-12-08 Thread R. Gorman
I ran into the same issue, but different encoding. I found that adding a special comment line to the beginning of the python file allowed for the desired encoding (source: 2.2.3 from http://www.python.org/doc/2.5.2/tut/node4.html). Hope that helps, R.

Re: Django Training

2008-12-08 Thread Roland van Laar
Steve Holden wrote: > I am looking at expanding our training offerings for the coming year, > and a short course in Django looks like it might be popular. There > don't seem to be many Django classes at the moment, and several of the > students from our introductory Python classes expressed

Re: selected ModelMultipleChoiceField

2008-12-08 Thread Håkan Waara
If you want to set it to always the same values, you can use the "initial" argument on your form field. Pseudo-example (haven't run the code, but it illustrates the solution): class MyForm(forms.Form): end = forms.DateField(label="Until", required=False, initial="2009-11-12") If you

no atribute instance in ModelMultipleChoiceField

2008-12-08 Thread Abdel Bolanos Martinez
Why ModelMultipleChoiceField has no atribute 'instance'? how can I select options in a ModelMultipleChoiceField Abdel Bolaños Martínez Ing. Infórmatico Telf. 266-8562 5to piso, oficina 526, Edificio Beijing, Miramar Trade Center. ETECSA --~--~-~--~~~---~--~~

Re: range-like template tag?

2008-12-08 Thread Berco Beute
The 'someInt' is an attribute of an object I pass to the template. It varies with each object. I could of course make a dictionary with the object and a list of the integers but it would be handy to solve it in the template (although you may argue that such functionality should stay out of the

selected ModelMultipleChoiceField

2008-12-08 Thread Abdel Bolanos Martinez
Hi, i'm new in django and i'm using ModelMultipleChoiceField and all works fine but i need to 'mark' o 'selected' some model objects from the queryset have ever someone did something like that??? Abdel Bolaños Martínez Ing. Infórmatico Telf. 266-8562 5to piso, oficina 526, Edificio Beijing,

Django Training

2008-12-08 Thread Steve Holden
I am looking at expanding our training offerings for the coming year, and a short course in Django looks like it might be popular. There don't seem to be many Django classes at the moment, and several of the students from our introductory Python classes expressed interest in Django. Without

Re: reverse problem

2008-12-08 Thread Grigory Fateyev
Hello Dmitry Dzhus! On Mon, 08 Dec 2008 18:25:47 +0300 you wrote: > > Grigory Fateyev wrote: > > In all my local projects when I want to use comments contrib, got > > the error [1]. Django is from last trunk, all *.pyc files from > > contrib/comments were removed. What it can be? > > Have you

Re: Reducing the number of my view's database queries

2008-12-08 Thread DavidA
If I undestand the problem correctly, in MySQL you could do this in one query as: select m.*, (select min(created) from model2 where id = m.model2_id) as first_created, (select max(created) from model2 where id = m.model2_id) as last_created from model1 m ; I don't know how that

Re: reverse problem

2008-12-08 Thread Dmitry Dzhus
Grigory Fateyev wrote: > In all my local projects when I want to use comments contrib, got the > error [1]. Django is from last trunk, all *.pyc files from > contrib/comments were removed. What it can be? Have you wiped out `urls/` subdirectory (left there from previous Django version) from

i18n and l10n of templates for emails

2008-12-08 Thread Kresimir Tonkovic
Hi! I'm using templetes to generate the HTML body for some reports I send daily by email. I do it like this: context = Context() context["some_var"] = some_value resp = render_to_string("daily_report.html", context) msg = EmailMultiAlternatives( _(u'Daily

User in form wizard

2008-12-08 Thread chewynougat
Could anyone tell me if I can pass the current user to a form wizard step so I can prepopulate their object details in the form? If so, how? Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Non-displayed fields on admin form get overwritten

2008-12-08 Thread Rajesh Dhawan
> > The code I pasted (poorly) *is* the model code that causes the > problem, minus the last couple of field entries. The code you pasted earlier uses the attribute name 'fields' where it should use the name 'fieldsets'. The former is used when you are providing a simple list of field names

Cookie muncher

2008-12-08 Thread globophobe
I am still having trouble with Safari and cookies. I can login only sometimes with Safari. About half the time I receive an error page. There is a login box on all the pages of my site. Since I need to set a test cookie before users login, I have the following code in a class that is in the base

Re: Help needed debugging a weird MySQL error!

2008-12-08 Thread bruno desthuilliers
On 8 déc, 14:28, taleinat <[EMAIL PROTECTED]> wrote: > I have a Django application, and I wrote an external script which > reads and writes to the Django database. I've started getting the > following exception consistently: > > Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out

Help needed debugging a weird MySQL error!

2008-12-08 Thread taleinat
I have a Django application, and I wrote an external script which reads and writes to the Django database. I've started getting the following exception consistently: Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in > ignored Has

Re: Strage utils problem

2008-12-08 Thread madhav
Just so that everybody knows how I am running the fcgi daemon: PYTHONPATH=/repo/django_src /usr/bin/python2.4 manage.py -- settings=PRODUCTION_settings runfcgi method=prefork host=127.0.0.1 port=8080 On Dec 8, 6:00 pm, madhav <[EMAIL PROTECTED]> wrote: > I have a very strange problem. My

Strage utils problem

2008-12-08 Thread madhav
I have a very strange problem. My project directory has got a directory named "utils" and all the modules related to the utils folder are not getting imported. All the rest are getting imported. That too this problem is only when I run the fcgi daemon(app server). When I try to import the same

Re: Displaying image stored in models.ImageField

2008-12-08 Thread Craig Spry
Hello All, Just to add to what I've said below, when I point the browser at the image url like this: http://localhost:8000/uploads/comics/john7_web.png I get a 404. Craig On Mon, Dec 8, 2008 at 10:34 PM, Craig Spry <[EMAIL PROTECTED]> wrote: > Hello All, > > I have an image stored in a

reverse problem

2008-12-08 Thread Grigory Fateyev
Hello! In all my local projects when I want to use comments contrib, got the error [1]. Django is from last trunk, all *.pyc files from contrib/comments were removed. What it can be? Thanks! [1] Exception Value:Caught an exception while rendering: Reverse for '' with arguments '()' and

Displaying image stored in models.ImageField

2008-12-08 Thread Craig Spry
Hello All, I have an image stored in a models.ImageField that looks like this: comic = models.ImageField(upload_to='comics') and I have this in the settings.py MEDIA_URL = 'http://localhost:8000/uploads/' and in the template I have this: And all I see in the rendered page is the comic.name.

Re: fields in object.values()

2008-12-08 Thread bruno desthuilliers
On 8 déc, 08:53, Sotiris Kazakis <[EMAIL PROTECTED]> wrote: > Hello, > > Thank you for your answer. > > I try : tbData = tableName.objects.values(*strFld.split(",")) > > but that error appears : > > File "/var/lib/python-support/python2.4/django/db/models/sql/query.py", > line 1503, in

Re: fields in object.values()

2008-12-08 Thread bruno desthuilliers
On 7 déc, 21:48, "sotiris.kazakis" <[EMAIL PROTECTED]> wrote: > hello, > > I search a lot about the use of object.values() but don't get what I > want. > > I want to put dynamically (with a string ?) Better to use a sequence of strings IMHO. > the fields that I want to > get from a model. i.e.:

Combine model form with a formset

2008-12-08 Thread Alistair Marshall
I have been hunting around but can't find a solution to this problem: It is probably best described with an example Example: class Author(models.Model): name= models.CharField() location = models.CharField() class Book(models.Model): name= models.CharField()

Re: Two different django version on the same server?

2008-12-08 Thread Pablo Ruiz Múzquiz
Got it! I've been actively using GNU/Linux since mid-90's and it's always the same issue... permissions... I got the OTHER_DJANGO_PATH pointing to a root-only directory, so apache (or mod_python), wisely, ignored it and, so, went on until site- packages gloriously appeared. I just can't

Re: Two different django version on the same server?

2008-12-08 Thread Graham Dumpleton
On Dec 8, 10:15 pm, Pablo Ruiz Múzquiz <[EMAIL PROTECTED]> wrote: > Hmm. That is exactly what I meant with "No matter what I do with > Apache's PythonPath". > I have that same configuration you posted and /admin (and other stuff) > won't work (most certainly because of the django version

Re: Two different django version on the same server?

2008-12-08 Thread Pablo Ruiz Múzquiz
Hmm. That is exactly what I meant with "No matter what I do with Apache's PythonPath". I have that same configuration you posted and /admin (and other stuff) won't work (most certainly because of the django version mismatch) The two errrors are "no module named urls" and "Viewdoesnotexist ..

Re: Writing SOAP Server in Django

2008-12-08 Thread 董诣
danlester 写道: > There are some posts on this list from a year or two ago suggesting > that there is a contrib module allowing a SOAP server to be built in > Django easily. It certainly isn't part of Django 1.0.2... > > Has anyone built a SOAP server using Django recently? > > I've been able to

Re: help with file uploads

2008-12-08 Thread Alan
Hi There, So, I am trying " http://docs.djangoproject.com/en/dev/topics/http/file-uploads/;, but can't see the results. I mean, I am confused because I don't know where to place the template (which I believe has to be "contact.html"). I have a folder "/mysite/templates/" and the tutorial

Re: templates database access

2008-12-08 Thread Daniel Roseman
On Dec 8, 10:25 am, Vicky <[EMAIL PROTECTED]> wrote: > Is there any way to insert, retrieve, delete and update tables in a > database from templates itself? Well, retrieving is what you do when you display data, but for the rest the answer is *definitely not omg why would you want to do such a

templates database access

2008-12-08 Thread Vicky
Is there any way to insert, retrieve, delete and update tables in a database from templates itself? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: ifequals in templates

2008-12-08 Thread Vicky
Yea that was the mistake :) it wrks fine nw On Dec 8, 3:16 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Dec 8, 9:31 am, Vicky <[EMAIL PROTECTED]> wrote: > > > > > I tried to use the code > > below: > >                                                {% ifequal oftype > > 'first_name' %} > >  

Re: ifequals in templates

2008-12-08 Thread Daniel Roseman
On Dec 8, 9:31 am, Vicky <[EMAIL PROTECTED]> wrote: > I tried to use the code > below: >                                                {% ifequal oftype > 'first_name' %} >                                                         {% for item in > datas.first_name %} >                              

Re: help with file uploads

2008-12-08 Thread Alan
Thank you very much Karen. Indeed, reading Django docs I was getting something very close to what you sent to me, but I am still failing to render (still have difficult to debug, but getting there). With your example I believe can solve the issues I have. I will describe what I want to do. We

ifequals in templates

2008-12-08 Thread Vicky
I tried to use the code below: {% ifequal oftype 'first_name' %} {% for item in datas.first_name %} {{ item }}