Re: two way edit ManyToManyField in admin interface

2007-06-21 Thread KpoH

Stano you are inattentive,
Then you define your model User
in ManyToManyField you write Project, but it must be 'Project', in quotes.
I wrote  this in my preview post.

so your model will look like this

class User(models.Model):
. # definition of User model
projects = models.ManyToManyField('Project',   # < here you need quotes
filter_interface=models.HORIZONTAL)


class Project(models.Model):
... # definition of Project model


-- 
Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L.
http://www.asterisksupport.ru
http://www.asterisk-support.com


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ticket #3297 & Newforms Image Uploading

2007-06-21 Thread Bryan Veloso

> You can always write the code to process File/Image fields in the view
> or just extend your form to handle them properly. I have managed to do
> so either by processing in the view or extending the form. As of now,
> all processing of all forms occur in the view and validation for file
> and image fields in a method of the form.
>
> This is what I did for the field validationhttp://dpaste.com/12715/
> the code to save the field data is in the view that uses this form.
>
> There is also a recent thread discussing this very same issue. There
> are also good solutions there so check them out.
>
> HTH.

Thanks Nimrod. I'll check that out. But your code looks like something
I'd use too. :)


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Ivan Sagalaev

Malcolm Tredinnick wrote:
> Perhaps read the remainder of the thread? :-)

Sorry, I was too impatient this time :-)

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Malcolm Tredinnick

On Fri, 2007-06-22 at 10:05 +0400, Ivan Sagalaev wrote:
> Malcolm Tredinnick wrote:
> > Thanks, Ilya. I'd gotten that far, too. Unfortunately, though, it isn't
> > quite that easy. Well, it is that easy for mod_python, however for WSGI
> > compliance, we can't do that (since the WSGI handler returns an
> > iterable).
> 
> But a WSGI server calls "close()" on the iterator after iteration and we 
> support this in HttpResponse. Why not send "signals.request_finished" there?

Perhaps read the remainder of the thread? :-)

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Ivan Sagalaev

Malcolm Tredinnick wrote:
> Thanks, Ilya. I'd gotten that far, too. Unfortunately, though, it isn't
> quite that easy. Well, it is that easy for mod_python, however for WSGI
> compliance, we can't do that (since the WSGI handler returns an
> iterable).

But a WSGI server calls "close()" on the iterator after iteration and we 
support this in HttpResponse. Why not send "signals.request_finished" there?

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Ivan Sagalaev

Malcolm Tredinnick wrote:
> One other thing that I forgot in my earlier email: it's not actually
> clear why the database connections get "lost" in the current
> implementation. We close the connection too early, but when the template
> rendering needs to access the database, it just opens a new one (that is
> why everybody is seeing more opens than closes). However, the next time
> that thread or process is used, Django should be reusing the same
> connection, since it will still be open and we check for an existing
> connection before opening a new one.

In case of threads the old thread's connection can't be reused because 
it is stored in thread.local() and a new thread is new thread. This 
ad-hoc 'pooling' actually never worked AFAIR... And I suspect that at 
least under Apache every new request results in a new Python thread both 
with prefork and worker mpms.

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: two way edit ManyToManyField in admin interface

2007-06-21 Thread stano

I tried move Project into separate file models_project.py and in
models.py add
from models_project import Project

And in models_project.py add
from django.db import models
from models import User

but does not work too :-(

Stano.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using simplejson

2007-06-21 Thread aman r
i have attached my json result(http://dpaste.com/12719/) and the view(
http://dpaste.com/12718/) that i use to get this result and pass it to the
html page called 'results.html' , i am trying to get all the fields to
displayed in the html page, but unable to access it, how can i use
simplejson in my views.py to pass it to the html and wat do i need.Right now
i am getting the field as 'latest_search_list.totalHits' in the html page.



On 6/21/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
>
>
> Without seeing your code, it's hard to know what's happening. It
> sounds like you're having a problem using JSON objects with
> javascript, so I'll try and throw out a short example and see if that
> helps. If this doesn't do it for you, put up the actual javascript
> that's causing you the trouble, and we'll see if we can't debug it.
>
> The example: http://www.djangosnippets.org/snippets/292/
>
> This example uses Dojo, the idea being checking to see if a username
> is available. Most of the text of that example is pulling all the
> parts together, but the critical line to using JSON within the
> javascript is:
>
> arrayData = dojo.json.evalJson(data);
>
> which evaluates the data and returns it as object literals that you
> can then access with dot notation or whatever you use. In my case, I
> used the javascript array/dictionary lookup notation to get my simple
> "is it there" response and then I spew in some HTML accordingly.
>
> -joe
>
>
> On 6/20/07, aman r <[EMAIL PROTECTED]> wrote:
> > yes, u have understood my problem correctly but the JSON object is not
> > recognized in the html page so if i try to say something like list.name
> > (where list has my JSON and name is its one of the values present in
> that
> > list) then it doesnt get recognized, is gives me Type mismatch error ,
> is
> > there any conversion or decode i need to do ?
> >
> >
> > On 6/20/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> > >
> > > If I understand correctly, that sounds reasonably doable - what is
> > > your question? Taking JSON from whatever source and generating a form
> > > in HTML is pretty much straight javascript and/or templating.
> > >
> > > -joe
> > >
> > > On 6/20/07, cess <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi All,
> > > >I am very new to the Django framework, i have tried using free
> > > > admin API , it works fine,so i  wanted to design my own page where i
> > > > dont interact with database and dont create any models, i rather
> call
> > > > an JSP page in my view which returns an JSON object, i want to
> convert
> > > > it into a form which i can use to display in my template ( i.e.,) in
> a
> > > > form python form or something and access all different fields from
> > > > that JSON result.
> > > >
> > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >  >
> >
>
> >
>

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: two way edit ManyToManyField in admin interface

2007-06-21 Thread stano

I tried this before I comment it.
But it has error:
Error: Couldn't install apps, because there were errors in one or more
models:
timetracker.tracker: name 'Project' is not defined

I think because class Project is defined after User in source code. If
I copy Project above User,
timetracker.tracker: name 'User' is not defined

I remember that In C language I can write function header at the start
of source code and function body later...
I need something like this in this case...

It can be done somehow?

Stano.


KpoH napísal(a):
> projects = models.ManyToManyField('Project',
>
> without comments :)
>
> stano  :
> > Hi, I am totally new. I am trying make TimeTracker project.
> > Now I am playing only with admin interface.
> >
> > I have this model:
> >
> > class User(models.Model):
> > timestamp = models.DateTimeField()
> > login = models.CharField()
> > password = models.CharField()
> >
> > # does not work, Project is not defined here
> > #   projects = models.ManyToManyField(Project,
> > filter_interface=models.HORIZONTAL)
> >
> > def __str__(self):
> > return self.login
> >
> > class Admin:
> > fields = (
> > (None, {'fields':('timestamp',)}),
> > (None, {'fields':('login',)}),
> > (None, {'fields':('password',)}),
> > # does not work, unknown projects
> > #   (None, {'fields':('projects',)}),
> > )
> >
> > class Project(models.Model):
> > timestamp = models.DateTimeField()
> > name = models.CharField()
> > users = models.ManyToManyField(User,
> > filter_interface=models.HORIZONTAL)
> >
> > def __str__(self):
> > return self.name
> >
> > class Admin:
> > list_filter = ('name', 'timestamp')
> > search_fields = ('name',)
> >
> > While editing Project, I am able to select existing users which
> > belongs to project.
> > It is possible to show list of Projects while editing User?
> >
> >
> > Thanks.
> >
> > Stano Paška
> >
> >
> > >
> >
>
> --
> Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L.
> http://www.asterisksupport.ru
> http://www.asterisk-support.com


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Jeremy Dunck

On 6/21/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
> To be honest I haven't ever done anything with Django past the hello
> world examples,

Graham, thank you for frequently answering questions that fall in the
gap between Django and mod_python, especially given your more recent
work on mod_wsgi.

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Development / Production Setup

2007-06-21 Thread Nimrod A. Abing

See: http://dpaste.com/12716/

What you can do is setup a conditional like that in your settings.py
where settings will be loaded based on your current hostname. This is
what I have been doing for quite some time now and seems to work well.

For templates, you have to set URL_PREFIX, MEDIA_PREFIX, BASE_URL and
others in your Context so that you can use them in your templates.
Here is how I use them:

URL_PREFIX - Used in hyperlinks to relative URLs
MEDIA_PREFIX - Used in URLs for media files such as CSS
BASE_URL - Used whenever absolute URLs are needed

On 6/22/07, marknca <[EMAIL PROTECTED]> wrote:
>
> I've been hacking around and googling for a little while now and can't
> seem to track down a solution to what should be a pretty straight
> forward problem.
>
> The situation
> 
> I'm trying to setup a nice workflow between my development environment
> and my production environment. I would like to be able to move changes
> from development to production with a minimum of hassle.
>
> Production setup
> =
> I'm serving all the dynamic pages using Apache/mod_python. All static
> content (images, scripts, styles, etc.) are served from a _different_
> subdomain running lighttpd. This setup seems to work well and is in
> line with what's recommended in the documentation (with the exception
> of the different subdomain).
>
> domain.tld => Django running on Apache/mod_python
> sub.domain.tld => static content served from lighttpd
>
> Development setup
> ===
> I've setup development much the same way. The difference here is the
> server software. My development machine is Mac and my production
> server is running Ubuntu. The development environment is running
> straight from IP. So I've got:
>
> ip:8000 => Django running on manage.py
> ip:80 => static content served from Personal Web Sharing (basically
> Apache)
>
> Django configuration
> 
> I have 2 settings.py files (settings.py.development &
> settings.py.production). One for development and one for production.
> Each has the settings for the servers in the specific environment.
> Right now I simply copy whichever settings.py.* file to settings.py
> for the environment I'm working in at the time.
>
> Problem
> ===
> Templates! I'd like to refer to my local static files when running in
> my development environment. How do I setup the templates to use the
> proper static files.
>
> Right now my templates include lines like:
>
> http://sub.domain.tld/styles/base.css";
> type="text/css" media="screen" />
>
> I'm obviously missing something basic. I'm 99% sure I should be able
> to say something like:
>
>  media="screen" />
>
> I have looked around for a solution but everything seems to point to
> the Site object (which requires a different entry in the database
> which I want to avoid, development should be a near exact mirror of
> production) or passing a variable through a view (these changes should
> be global).
>
> I'm new so please be gentle.
>
> Thanks in advance,
> Mark
>
>
> >
>


-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



XML serializer

2007-06-21 Thread meledictas

Hi,

 Since serializer has query set as parameter. If data is not query
from database, How to construct data structure (query set) and pass to
serializer ?


Thank

Chatchai


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ticket #3297 & Newforms Image Uploading

2007-06-21 Thread Nimrod A. Abing

On 6/22/07, Bryan Veloso <[EMAIL PROTECTED]> wrote:
>
> RE: http://code.djangoproject.com/ticket/3297
>
> I'm wondering if anybody has actually used this patch for a production
> site. If not, then I'll put off a certain feature of my site until
> later. The patch is really tempting though, so I wanted to get a
> better outlook of experiences before taking the leap.

You can always write the code to process File/Image fields in the view
or just extend your form to handle them properly. I have managed to do
so either by processing in the view or extending the form. As of now,
all processing of all forms occur in the view and validation for file
and image fields in a method of the form.

This is what I did for the field validation http://dpaste.com/12715/
the code to save the field data is in the view that uses this form.

There is also a recent thread discussing this very same issue. There
are also good solutions there so check them out.

HTH.
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Graham Dumpleton

On Jun 22, 1:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I have restarted apache, and I do not have those directives in my
> config files.

I'm running out of ideas. What it comes down to is that, according to
your traceback, for some reason under atlantaice the:

  /djangosites/AGD/AGDWeb/views.py

module is being imported by the URL resolver in:

  django/core/urlresolvers.py

when presumably you are expecting it to be the corresponding views
module for atlantaice.

To be honest I haven't ever done anything with Django past the hello
world examples, so I am presuming that the urls.py file is the only
place the resolver gets things from. Thus can't see why it would pick
up the wrong one if the two applications are indeed in their own
VirtualHost and thus their own Python sub interpreter.

The only way I know where a module could be shared between sub
interpreters under mod_python is where it is a C extension module as
Python only loads them once for all sub interpreters. For that reason
one can't use different versions of a C extension module in two
applications running in different sub interpreters. Anyway, that can't
be happening here urls.py is only a Python code module and not a C
extension module, plus that module when identified is prefixed by the
site name.

Thus we come back simply to verifying whether the two sites are
running in two different sub interpreters. Beyond that the only other
thing I can think of is PYTHONPATH is set in the environment of the
user that Apache is run as and that is causing a problem. Even that I
would be dubious of as your prefix the site directory to PythonPath so
it should be at the front.

BTW, I don't recollect you saying which version of mod_python you are
using. If you aren't using mod_python 3.3.1 I would strongly recommend
upgrading and trying that version instead. The only other suggestion
is you try mod_wsgi instead and use the daemon mode of mod_wsgi to
setup each site so they run in their own processes and so you don't
have multiple sub interpreters in the one process. That way there can
be no way they somehow could be interfering with each other. I can
help with that if you want to try that.

At the end of the day I am sure this will be something obvious and
I'll make a fool of myself for not seeing it earlier. ;-)

Graham

> On Jun 21, 9:34 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Jun 22, 10:14 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Interestingly, I am getting some strange errors when trying to output
> > > the interpreter ID to my error log.  Attempting to do so generates an
> > > error in my logs:
>
> > > [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> > > PythonHandler django.core.handlers.modpython:   File "/djangosites/
> > > atlantaice/settings.py", line 3, in ?\n
> > > apache.log_error("INTERPRETER %s" % apache.interpreter)
> > > [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> > > PythonHandler django.core.handlers.modpython: AttributeError: 'module'
> > > object has no attribute 'interpreter'
>
> > You must be using an older version ofmod_pythonthen. With older
> > versions ofmod_pythonyou would need to get access tomod_python
> > request object through the Django request object somehow and output
> > 'req.interpreter'. Ie., access 'interpreter' attribute ofmod_python
> > request object.
>
> > Nicest way of making this available which automatically shows in error
> > pages would be for the Djangomod_pythonadapter to push the value
> > into the request environment.
>
> > > atlantaice.urls doesn't reference AGDWeb in any way.
>
> > :-(
>
> > I don't understand then how the two supposedly separate applications
> > are mixing data then. You most definitely have restarted Apache and
> > checked again after a restart?
>
> > Can you verify that you don't have any of the following directives
> > anywhere in your Apache configuration files:
>
> >   PythonInterpreter
> >   PythonInterpPerDirective
> >   PythonInterpPerDirectory
>
> > Graham
>
> > > urlpatterns = patterns('',
> > > (r'^$', 'atlantaice.web.views.homepage'),
> > > (r'^alliedpartners/$', 'atlantaice.web.views.allied_partners'),
> > > (r'^contact/$', 'atlantaice.web.views.contact'),
> > > (r'^contact/confirm/$', 'atlantaice.web.views.contact_confirm'),
> > > (r'^emergency/$', 'atlantaice.web.views.emergency'),
> > > (r'^employmentopp/$', 'atlantaice.web.views.list_jobs'),
> > > (r'^employmentopp/(?P\d+)/$',
> > > 'atlantaice.web.views.show_job'),
> > > (r'^employmentopp/(?P\d+)/apply/$',
> > > 'atlantaice.web.views.job_apply'),
> > > (r'^employmentopp/confirm/$',
> > > 'atlantaice.web.views.employment_confirm'),
> > > (r'^eventrentals/$', 'atlantaice.web.views.event_rentals'),
> > > (r'^eventrentals/popup/(?P[0-9a-z\-]+)/$',
> > > 'atlantaice.web.views.show_popup'),
> > > (r'^faqs/$', 'atlantaice.web.views.faq'),
> > > (r'^iceestimator/$', 'atlantaice.web.views.ice

Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread [EMAIL PROTECTED]

I feel so stupid.  Somehow the urls file from the other site got
copied over the urls file for the site having the problems.

On Jun 21, 11:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I have restarted apache, and I do not have those directives in my
> config files.
>
> On Jun 21, 9:34 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Jun 22, 10:14 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Interestingly, I am getting some strange errors when trying to output
> > > the interpreter ID to my error log.  Attempting to do so generates an
> > > error in my logs:
>
> > > [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> > > PythonHandler django.core.handlers.modpython:   File "/djangosites/
> > > atlantaice/settings.py", line 3, in ?\n
> > > apache.log_error("INTERPRETER %s" % apache.interpreter)
> > > [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> > > PythonHandler django.core.handlers.modpython: AttributeError: 'module'
> > > object has no attribute 'interpreter'
>
> > You must be using an older version of mod_python then. With older
> > versions of mod_python you would need to get access to mod_python
> > request object through the Django request object somehow and output
> > 'req.interpreter'. Ie., access 'interpreter' attribute of mod_python
> > request object.
>
> > Nicest way of making this available which automatically shows in error
> > pages would be for the Django mod_python adapter to push the value
> > into the request environment.
>
> > > atlantaice.urls doesn't reference AGDWeb in any way.
>
> > :-(
>
> > I don't understand then how the two supposedly separate applications
> > are mixing data then. You most definitely have restarted Apache and
> > checked again after a restart?
>
> > Can you verify that you don't have any of the following directives
> > anywhere in your Apache configuration files:
>
> >   PythonInterpreter
> >   PythonInterpPerDirective
> >   PythonInterpPerDirectory
>
> > Graham
>
> > > urlpatterns = patterns('',
> > > (r'^$', 'atlantaice.web.views.homepage'),
> > > (r'^alliedpartners/$', 'atlantaice.web.views.allied_partners'),
> > > (r'^contact/$', 'atlantaice.web.views.contact'),
> > > (r'^contact/confirm/$', 'atlantaice.web.views.contact_confirm'),
> > > (r'^emergency/$', 'atlantaice.web.views.emergency'),
> > > (r'^employmentopp/$', 'atlantaice.web.views.list_jobs'),
> > > (r'^employmentopp/(?P\d+)/$',
> > > 'atlantaice.web.views.show_job'),
> > > (r'^employmentopp/(?P\d+)/apply/$',
> > > 'atlantaice.web.views.job_apply'),
> > > (r'^employmentopp/confirm/$',
> > > 'atlantaice.web.views.employment_confirm'),
> > > (r'^eventrentals/$', 'atlantaice.web.views.event_rentals'),
> > > (r'^eventrentals/popup/(?P[0-9a-z\-]+)/$',
> > > 'atlantaice.web.views.show_popup'),
> > > (r'^faqs/$', 'atlantaice.web.views.faq'),
> > > (r'^iceestimator/$', 'atlantaice.web.views.ice_estimator'),
> > > (r'^icemachines/$', 'atlantaice.web.views.ice_machines'),
> > > (r'^pastevents/$', 'atlantaice.web.views.past_events'),
> > > (r'^popup_blockice/$', 'atlantaice.web.views.popup_blockice'),
> > > (r'^popup_dryice/$', 'atlantaice.web.views.popup_dryice'),
> > > (r'^products/$', 'atlantaice.web.views.products'),
> > > (r'^servicearea/$', 'atlantaice.web.views.service_area'),
> > > (r'^services/$', 'atlantaice.web.views.services'),
> > > (r'^testimonials/$', 'atlantaice.web.views.testimonials'),
> > > (r'^weeklyroute/$', 'atlantaice.web.views.weekly_route'),
> > > (r'^weeklyroute/confirm/$',
> > > 'atlantaice.web.views.weekly_route_confirm'),
> > > (r'^admin/', include('django.contrib.admin.urls')),
>
> > > On Jun 21, 7:12 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > What is in:
>
> > > >   atlantaice.urls
>
> > > > If the details in the error page are to be believed, it would look
> > > > like one of the URL mapping rules is referencing the other site.
>
> > > > I really wish the Django error page would show the interpreter name
> > > > when using mod_python. I guess another suggestion I should create a
> > > > ticket for when I can catch up with my list of things to do.. :-)
>
> > > > Graham
>
> > > > On Jun 21, 11:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > Error can be seen herehttp://beta.atlantaicecompany.com/
>
> > > > > AGDWeb is an app in a totally separate project under the same
> > > > > PythonPath.  It has a separate settings file.
>
> > > > > I am not using any Django cache, I am referring to some sort of
> > > > > internal caching thatmod_pythonis doing.
>
> > > > > The settings file looks like this
>
> > > > > 
> > > > > ServerName beta.atlantaicecompany.com
> > > > > ServerAdmin [EMAIL PROTECTED]
> > > > > DocumentRoot /djangosites/atlantaice/
> > > > > 
> > > > > SetHandler python-program
> > > > > PythonHandler djang

Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread [EMAIL PROTECTED]

I have restarted apache, and I do not have those directives in my
config files.

On Jun 21, 9:34 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Jun 22, 10:14 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Interestingly, I am getting some strange errors when trying to output
> > the interpreter ID to my error log.  Attempting to do so generates an
> > error in my logs:
>
> > [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> > PythonHandler django.core.handlers.modpython:   File "/djangosites/
> > atlantaice/settings.py", line 3, in ?\n
> > apache.log_error("INTERPRETER %s" % apache.interpreter)
> > [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> > PythonHandler django.core.handlers.modpython: AttributeError: 'module'
> > object has no attribute 'interpreter'
>
> You must be using an older version of mod_python then. With older
> versions of mod_python you would need to get access to mod_python
> request object through the Django request object somehow and output
> 'req.interpreter'. Ie., access 'interpreter' attribute of mod_python
> request object.
>
> Nicest way of making this available which automatically shows in error
> pages would be for the Django mod_python adapter to push the value
> into the request environment.
>
> > atlantaice.urls doesn't reference AGDWeb in any way.
>
> :-(
>
> I don't understand then how the two supposedly separate applications
> are mixing data then. You most definitely have restarted Apache and
> checked again after a restart?
>
> Can you verify that you don't have any of the following directives
> anywhere in your Apache configuration files:
>
>   PythonInterpreter
>   PythonInterpPerDirective
>   PythonInterpPerDirectory
>
> Graham
>
> > urlpatterns = patterns('',
> > (r'^$', 'atlantaice.web.views.homepage'),
> > (r'^alliedpartners/$', 'atlantaice.web.views.allied_partners'),
> > (r'^contact/$', 'atlantaice.web.views.contact'),
> > (r'^contact/confirm/$', 'atlantaice.web.views.contact_confirm'),
> > (r'^emergency/$', 'atlantaice.web.views.emergency'),
> > (r'^employmentopp/$', 'atlantaice.web.views.list_jobs'),
> > (r'^employmentopp/(?P\d+)/$',
> > 'atlantaice.web.views.show_job'),
> > (r'^employmentopp/(?P\d+)/apply/$',
> > 'atlantaice.web.views.job_apply'),
> > (r'^employmentopp/confirm/$',
> > 'atlantaice.web.views.employment_confirm'),
> > (r'^eventrentals/$', 'atlantaice.web.views.event_rentals'),
> > (r'^eventrentals/popup/(?P[0-9a-z\-]+)/$',
> > 'atlantaice.web.views.show_popup'),
> > (r'^faqs/$', 'atlantaice.web.views.faq'),
> > (r'^iceestimator/$', 'atlantaice.web.views.ice_estimator'),
> > (r'^icemachines/$', 'atlantaice.web.views.ice_machines'),
> > (r'^pastevents/$', 'atlantaice.web.views.past_events'),
> > (r'^popup_blockice/$', 'atlantaice.web.views.popup_blockice'),
> > (r'^popup_dryice/$', 'atlantaice.web.views.popup_dryice'),
> > (r'^products/$', 'atlantaice.web.views.products'),
> > (r'^servicearea/$', 'atlantaice.web.views.service_area'),
> > (r'^services/$', 'atlantaice.web.views.services'),
> > (r'^testimonials/$', 'atlantaice.web.views.testimonials'),
> > (r'^weeklyroute/$', 'atlantaice.web.views.weekly_route'),
> > (r'^weeklyroute/confirm/$',
> > 'atlantaice.web.views.weekly_route_confirm'),
> > (r'^admin/', include('django.contrib.admin.urls')),
>
> > On Jun 21, 7:12 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > What is in:
>
> > >   atlantaice.urls
>
> > > If the details in the error page are to be believed, it would look
> > > like one of the URL mapping rules is referencing the other site.
>
> > > I really wish the Django error page would show the interpreter name
> > > when using mod_python. I guess another suggestion I should create a
> > > ticket for when I can catch up with my list of things to do.. :-)
>
> > > Graham
>
> > > On Jun 21, 11:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Error can be seen herehttp://beta.atlantaicecompany.com/
>
> > > > AGDWeb is an app in a totally separate project under the same
> > > > PythonPath.  It has a separate settings file.
>
> > > > I am not using any Django cache, I am referring to some sort of
> > > > internal caching thatmod_pythonis doing.
>
> > > > The settings file looks like this
>
> > > > 
> > > > ServerName beta.atlantaicecompany.com
> > > > ServerAdmin [EMAIL PROTECTED]
> > > > DocumentRoot /djangosites/atlantaice/
> > > > 
> > > > SetHandler python-program
> > > > PythonHandler django.core.handlers.modpython
> > > > SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
> > > > PythonPath "['/djangosites/'] + sys.path"
> > > > PythonDebug Off
> > > > 
> > > > 
> > > > SetHandler None
> > > > 
> > > > 
> > > > SetHandler None
> > > > 
> > > 

Re: object serialization problem

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 20:23 -0700, dailer wrote:
> seems like a very simple example based on
> http://www.djangoproject.com/documentation/0.96/serialization/:
> 
> def exportCountryCodeFixture():
> from django.core import serializers
> from mysite.models import CountryCode
> 
> out = open("CountryCode.xml", "w")
> serializers.serialize("xml", CountryCode.objects.all(), stream=out
> 
> causes this error:
[...]
> AttributeError: 'file' object has no attribute 'getvalue'

Yes. This was a bug in the 0.96 release. It's been fixed subsequently. 

You could grab the contents of django/core/serializers from a recent
subversion checkout and drop that into your current 0.96 code if you
didn't want to move entirely up to tracking subversion's trunk. The
fixes are very self-contained.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Development / Production Setup

2007-06-21 Thread marknca

I've been hacking around and googling for a little while now and can't
seem to track down a solution to what should be a pretty straight
forward problem.

The situation

I'm trying to setup a nice workflow between my development environment
and my production environment. I would like to be able to move changes
from development to production with a minimum of hassle.

Production setup
=
I'm serving all the dynamic pages using Apache/mod_python. All static
content (images, scripts, styles, etc.) are served from a _different_
subdomain running lighttpd. This setup seems to work well and is in
line with what's recommended in the documentation (with the exception
of the different subdomain).

domain.tld => Django running on Apache/mod_python
sub.domain.tld => static content served from lighttpd

Development setup
===
I've setup development much the same way. The difference here is the
server software. My development machine is Mac and my production
server is running Ubuntu. The development environment is running
straight from IP. So I've got:

ip:8000 => Django running on manage.py
ip:80 => static content served from Personal Web Sharing (basically
Apache)

Django configuration

I have 2 settings.py files (settings.py.development &
settings.py.production). One for development and one for production.
Each has the settings for the servers in the specific environment.
Right now I simply copy whichever settings.py.* file to settings.py
for the environment I'm working in at the time.

Problem
===
Templates! I'd like to refer to my local static files when running in
my development environment. How do I setup the templates to use the
proper static files.

Right now my templates include lines like:

http://sub.domain.tld/styles/base.css";
type="text/css" media="screen" />

I'm obviously missing something basic. I'm 99% sure I should be able
to say something like:



I have looked around for a solution but everything seems to point to
the Site object (which requires a different entry in the database
which I want to avoid, development should be a near exact mirror of
production) or passing a variable through a view (these changes should
be global).

I'm new so please be gentle.

Thanks in advance,
Mark


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



object serialization problem

2007-06-21 Thread dailer

seems like a very simple example based on
http://www.djangoproject.com/documentation/0.96/serialization/:

def exportCountryCodeFixture():
from django.core import serializers
from mysite.models import CountryCode

out = open("CountryCode.xml", "w")
serializers.serialize("xml", CountryCode.objects.all(), stream=out

causes this error:

Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Documents and Settings\administrator\My Documents\workspace
\Orb\src\mysite\tests\models.py", line 14
, in exportCountryCodeFixture
serializers.serialize("xml", CountryCode.objects.all(),
stream=out)
  File "c:\Python25\Lib\site-packages\django\core\serializers
\__init__.py", line 67, in serialize
s.serialize(queryset, **options)
  File "c:\Python25\Lib\site-packages\django\core\serializers
\base.py", line 50, in serialize
return self.getvalue()
  File "c:\Python25\Lib\site-packages\django\core\serializers
\base.py", line 110, in getvalue
return self.stream.getvalue()
AttributeError: 'file' object has no attribute 'getvalue'


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Malcolm Tredinnick

Hi Graham,

On Fri, 2007-06-22 at 02:44 +, Graham Dumpleton wrote:
> On Jun 22, 9:52 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
> > On Thu, 2007-06-21 at 07:45 -0700, Ilya Semenov wrote:
> > > Malcolm,
> >
> > > I traced the problem and submitted the patch, see details at
> > >http://code.djangoproject.com/ticket/4650
> > > I'm not completely sure about the logic of signals though, the change
> > > may affect some middleware depending on it.
> >
> > Thanks, Ilya. I'd gotten that far, too. Unfortunately, though, it isn't
> > quite that easy. Well, it is that easy formod_python, however for WSGI
> > compliance, we can't do that (since the WSGI handler returns an
> > iterable).
> >
> > There are a few possibilities I've been bouncing around, but they all
> > have downsides: introducing greater coupling between templates, HTTP and
> > database so that we know when rendering stops (which will make it
> > possible to behave similarly to the modpython case) or making WSGI
> > return a single item iterable as recommended in PEP 333 for performance
> > (downside is that the greater part of the memory savings are lost).
> 
> Sorry, showing my ignorance here. Are you saying that Django can
> currently return to the WSGI adapter for the web server a Python
> string in some cases?

Not at all. That would be bad (as you note below). If the HttpResponse
class is created with a string, the __iter__ method returns that as a
single chunk (we iterate over the list [content], where "content" is the
string). This is set up in HttpResponse.__init__ so that the _container
attribute on the instance is always an iterable.

My comment above was referring to the fact that HttpResponse can also be
initialised with an iterator (usually a Template.iter_render() result
after [5482]) and will use that in the __iter__ method in that case. One
solution to the problems we are seeing would involve collecting all the
output from that iterator and then returning a new iterator that gave
back all the data in one go. The advantage of that approach is better
control over signalling when the request is finished and possibly
slightly better network performance due to larger chunks being available
to the WSGI server. The downside is larger memory usage, which was what
the original template rendering change was designed to alleviate.

> Looking at the submitted patch it almost seems that that is possible
> in some cases, otherwise I don't understand the need for the check:
> 
>   197 if isinstance(self._response, basestring):
>   198 return chain([self._response],
> IterConsumedSignal)

Brian might just be being careful. It's relatively harmless.

> I only ask as returning a string means that the WSGI adapter would
> treat it as an array of single character strings and by the WSGI
> specification the WSGI adapter is required to write each character out
> one at a time and perform a flush between each character. If doing
> this in Apache this would result in absolutely dreadful performance.

Yep. Understood. Fear not; we've haven't made a design decision to bring
the web server to its knees on every response. :-)

> As it stands, this patch would actually change the behaviour of a WSGI
> adapter in that the string would then be written out in one go and not
> one character at a time as it would if just the string were passed
> through. 

Technically, yes; unfortunately implemented adaptors will no longer
behave badly. However, it's going to be used with Django's HttpResponse,
which doesn't iterate over strings one character at a time in the output
stream.

> Another issue with this check is that it checks against
> 'basestring' whereas WSGI is only supposed to be given 'string'
> objects. The check would allow through 'unicode' string objects.
> 
> Also, I am presuming 'chain' comes from itertools but don't see that
> module being imported. Nor is it prefixed by the module name anyway.

Indeed. Both are problems. We'll fix those.

> BTW, why does one need to be using chain of iterables anyway. The WSGI
> specification requires that a WSGI adapter call close() on the
> iterable when it is done. Ie., quoting WSGI specification:

Yes. Brian (Harring -- the author of the second patch) also mentioned
this on the django-developers list shortly after he wrote the initial
patch. Sounds like the right thing to do.

[...]
> > For portability reasons, supporting WSGI is very important, so any
> > solution that only works with modpython is unfortunately not an option.
> 
> Why was the patch only suitable for mod_python?

(Note that I was talking about Ilya's original patch; not Brian's
subsequent one with WSGI support.) With mod_python, we write the full
response content out before we return from Django's handler (see line
169 in django/core/handlers/modpython.py), so we know we have finished
all the database accesses necessary for template rendering. Thus we can
move the "request_finished" signal to the e

Ticket #3297 & Newforms Image Uploading

2007-06-21 Thread Bryan Veloso

RE: http://code.djangoproject.com/ticket/3297

I'm wondering if anybody has actually used this patch for a production
site. If not, then I'll put off a certain feature of my site until
later. The patch is really tempting though, so I wanted to get a
better outlook of experiences before taking the leap.

Thanks!
Bryan V.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



real article

2007-06-21 Thread hiruma222

real article
http://www.real-article.com/


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Graham Dumpleton

On Jun 22, 9:52 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-06-21 at 07:45 -0700, Ilya Semenov wrote:
> > Malcolm,
>
> > I traced the problem and submitted the patch, see details at
> >http://code.djangoproject.com/ticket/4650
> > I'm not completely sure about the logic of signals though, the change
> > may affect some middleware depending on it.
>
> Thanks, Ilya. I'd gotten that far, too. Unfortunately, though, it isn't
> quite that easy. Well, it is that easy formod_python, however for WSGI
> compliance, we can't do that (since the WSGI handler returns an
> iterable).
>
> There are a few possibilities I've been bouncing around, but they all
> have downsides: introducing greater coupling between templates, HTTP and
> database so that we know when rendering stops (which will make it
> possible to behave similarly to the modpython case) or making WSGI
> return a single item iterable as recommended in PEP 333 for performance
> (downside is that the greater part of the memory savings are lost).

Sorry, showing my ignorance here. Are you saying that Django can
currently return to the WSGI adapter for the web server a Python
string in some cases?

Looking at the submitted patch it almost seems that that is possible
in some cases, otherwise I don't understand the need for the check:

197 if isinstance(self._response, basestring):
198 return chain([self._response],
IterConsumedSignal)

I only ask as returning a string means that the WSGI adapter would
treat it as an array of single character strings and by the WSGI
specification the WSGI adapter is required to write each character out
one at a time and perform a flush between each character. If doing
this in Apache this would result in absolutely dreadful performance.

As it stands, this patch would actually change the behaviour of a WSGI
adapter in that the string would then be written out in one go and not
one character at a time as it would if just the string were passed
through. Another issue with this check is that it checks against
'basestring' whereas WSGI is only supposed to be given 'string'
objects. The check would allow through 'unicode' string objects.

Also, I am presuming 'chain' comes from itertools but don't see that
module being imported. Nor is it prefixed by the module name anyway.

BTW, why does one need to be using chain of iterables anyway. The WSGI
specification requires that a WSGI adapter call close() on the
iterable when it is done. Ie., quoting WSGI specification:

"""If the iterable returned by the application has a close() method,
the server or gateway must call that method upon completion of the
current request, whether the request was completed normally, or
terminated early due to an error. (This is to support resource release
by the application. This protocol is intended to complement PEP 325's
generator support, and other common iterables with close() methods."""

Thus, it wasn't necessary to introduce IterConsumedSignal at all.
Instead, if I understand what you are trying to do. The
ResponseWrapper could have provided its own close() method which
called response close() if it existed as well as call:

  dispatcher.send(signal=signals.request_finished)

> For portability reasons, supporting WSGI is very important, so any
> solution that only works with modpython is unfortunately not an option.

Why was the patch only suitable for mod_python? I admit I don't
understand fully the underlying problem you are trying to solve, but
as far as satisfying WSGI specification, it seemed to be going in the
right direction.

Graham


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Forest Bond
On Thu, Jun 21, 2007 at 11:04:40PM -, Rob Hudson wrote:
> 
> Just following up...
> 
> If you use the query string option, you don't need to know the current
> url, you can just do this:
> 
> {% if has_previous %}
> Previous
> {% endif %}

Which works fine & dandy as long as you're not using GET parameters for anything
else.  The canonical example is a search page with paginated results.  It's
actually a slight pain to come up with a good way to construct the prev/next
URLs without making too many assumptions about the order/presence of GET
parameters.  I'd be happy if django would come up with a nice solution to that
problem.

I'd also be happier if django's pagination template context parameters didn't
pollute the template context so much.  It'd be nice to stuff them all in a dict
called paginator:

{{paginator.next}}

etc.

But idunno, I guess it's not that big of a deal.  In practical terms, it
probably doesn't actually come up, since you can just avoid name conflicts by
not naming your context variables the same as the pagination variables.

-Forest


signature.asc
Description: Digital signature


Re: ANN: Django-fr.org is out!

2007-06-21 Thread Kelvin Nicholson

On Thu, 2007-06-21 at 11:42 +0200, David Larlet wrote:
> Hi,
> 
> I'm proud to announce that after a few months of stagnation the french
> community is online with a new site (powered by django of course) :
> http://www.django-fr.org/

Looks great! I like the similar, but not exact, design reference to
djangoproject.com

Cheers,

Kelvin



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Graham Dumpleton

On Jun 22, 10:14 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Interestingly, I am getting some strange errors when trying to output
> the interpreter ID to my error log.  Attempting to do so generates an
> error in my logs:
>
> [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> PythonHandler django.core.handlers.modpython:   File "/djangosites/
> atlantaice/settings.py", line 3, in ?\n
> apache.log_error("INTERPRETER %s" % apache.interpreter)
> [Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
> PythonHandler django.core.handlers.modpython: AttributeError: 'module'
> object has no attribute 'interpreter'

You must be using an older version of mod_python then. With older
versions of mod_python you would need to get access to mod_python
request object through the Django request object somehow and output
'req.interpreter'. Ie., access 'interpreter' attribute of mod_python
request object.

Nicest way of making this available which automatically shows in error
pages would be for the Django mod_python adapter to push the value
into the request environment.

> atlantaice.urls doesn't reference AGDWeb in any way.

:-(

I don't understand then how the two supposedly separate applications
are mixing data then. You most definitely have restarted Apache and
checked again after a restart?

Can you verify that you don't have any of the following directives
anywhere in your Apache configuration files:

  PythonInterpreter
  PythonInterpPerDirective
  PythonInterpPerDirectory

Graham

> urlpatterns = patterns('',
> (r'^$', 'atlantaice.web.views.homepage'),
> (r'^alliedpartners/$', 'atlantaice.web.views.allied_partners'),
> (r'^contact/$', 'atlantaice.web.views.contact'),
> (r'^contact/confirm/$', 'atlantaice.web.views.contact_confirm'),
> (r'^emergency/$', 'atlantaice.web.views.emergency'),
> (r'^employmentopp/$', 'atlantaice.web.views.list_jobs'),
> (r'^employmentopp/(?P\d+)/$',
> 'atlantaice.web.views.show_job'),
> (r'^employmentopp/(?P\d+)/apply/$',
> 'atlantaice.web.views.job_apply'),
> (r'^employmentopp/confirm/$',
> 'atlantaice.web.views.employment_confirm'),
> (r'^eventrentals/$', 'atlantaice.web.views.event_rentals'),
> (r'^eventrentals/popup/(?P[0-9a-z\-]+)/$',
> 'atlantaice.web.views.show_popup'),
> (r'^faqs/$', 'atlantaice.web.views.faq'),
> (r'^iceestimator/$', 'atlantaice.web.views.ice_estimator'),
> (r'^icemachines/$', 'atlantaice.web.views.ice_machines'),
> (r'^pastevents/$', 'atlantaice.web.views.past_events'),
> (r'^popup_blockice/$', 'atlantaice.web.views.popup_blockice'),
> (r'^popup_dryice/$', 'atlantaice.web.views.popup_dryice'),
> (r'^products/$', 'atlantaice.web.views.products'),
> (r'^servicearea/$', 'atlantaice.web.views.service_area'),
> (r'^services/$', 'atlantaice.web.views.services'),
> (r'^testimonials/$', 'atlantaice.web.views.testimonials'),
> (r'^weeklyroute/$', 'atlantaice.web.views.weekly_route'),
> (r'^weeklyroute/confirm/$',
> 'atlantaice.web.views.weekly_route_confirm'),
> (r'^admin/', include('django.contrib.admin.urls')),
>
> On Jun 21, 7:12 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > What is in:
>
> >   atlantaice.urls
>
> > If the details in the error page are to be believed, it would look
> > like one of the URL mapping rules is referencing the other site.
>
> > I really wish the Django error page would show the interpreter name
> > when using mod_python. I guess another suggestion I should create a
> > ticket for when I can catch up with my list of things to do.. :-)
>
> > Graham
>
> > On Jun 21, 11:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Error can be seen herehttp://beta.atlantaicecompany.com/
>
> > > AGDWeb is an app in a totally separate project under the same
> > > PythonPath.  It has a separate settings file.
>
> > > I am not using any Django cache, I am referring to some sort of
> > > internal caching thatmod_pythonis doing.
>
> > > The settings file looks like this
>
> > > 
> > > ServerName beta.atlantaicecompany.com
> > > ServerAdmin [EMAIL PROTECTED]
> > > DocumentRoot /djangosites/atlantaice/
> > > 
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
> > > PythonPath "['/djangosites/'] + sys.path"
> > > PythonDebug Off
> > > 
> > > 
> > > SetHandler None
> > > 
> > > 
> > > SetHandler None
> > > 
> > > 
> > > SetHandler None
> > > 
> > > 
> > > SetHandler None
> > > 
>
> > > ErrorLog /var/log/apache2/beta.atlantaicecompany.com-error.log
>
> > > # Possible values include: debug, info, notice, warn, error,
> > > crit,
> > > # alert, emerg.
> > > LogLev

Re: Django Developer Needed

2007-06-21 Thread Noah Gift
On 6/21/07, Tyson Tate <[EMAIL PROTECTED]> wrote:
>
>
> On Jun 21, 2007, at 5:11 PM, Noah Gift wrote:
>
> > I think your being a bit misleading.  Of course you can use django
> > for a CMS.  It certainly doesn't hurt that CMS was the problem
> > domain being addressed while Django was being written either.  Just
> > take a look at 99% of the jobs on django-users.  "Hi, I work for a
> > newspaper.".  So yes it can be a CMS if you write the code for
> > it, and it is probably one of the problems django does best.
> > Saying django is not a CMS is kind of like Elvis saying he wasn't
> > influenced by the Blues... :)
>
> Well, technically, Django is a *framework*. It is *not* a CMS. Once
> you install and configure Django, you still have absolutely nothing.
> You can build a CMS with it, certainly, but that doesn't make Django
> a CMS itself.


Yes.  That was my point as well if you notice.  My other subtle point was
when someone means to ask the question, "I have heard that the Django web
application framework is friendly toward the creation of CMS sites", but
really asks, "I need Django for a CMS..." understand this is probably what
they mean.  Btw, isn't a Newspaper quite literally content being managed
systematically?  Seems like the framework certainly helps solve that
problem:

"Developed and used over two years by a fast-moving online-news
operation..."  Seems like yes...CMS is something the "Django Framework" was
built for no?

Saying Django is a CMS because you can use it to make a CMS is like
> saying my oven is a pie because I can make a pie with it.
>
>
>


-- 
http://www.blog.noahgift.com

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to define stored procedures within django

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 13:05 -0500, Tim Chase wrote:
> > I want to use some stored procedures. I am mySql. Is there
> > some way I can define stored procedures from withing django? 
> > (We can call already defined procedures,
> > http://www.djangosnippets.org/snippets/118/ discusses how, but
> > can we also define stored procedures from within django?)
> 
> I don't believe Django holds your hand for creating SPs.  Each DB 
> engine tends to use its own languages for SPs which makes the 
> process even harder.  IIRC, PostgreSQL has support for SPs 
> written in Python in addition to umpteen other languages.  I 
> haven't toyed with SPs in MySQL, and I don't know if sqlite even 
> supports SPs (other than perhaps executing a bit of code on a 
> trigger).
> 
> You can always use cursor.execute() to create them, or you can 
> use Django's facilities for executing SQL when you 
> sqlcustom/sqlreset/sqlall/reset via manage.py as described at
> 
> http://www.djangoproject.com/documentation/model-api/#database-backend-specific-sql-data
> 
> and above.  However, I don't think there's much more in the way 
> of coddling facilities in Django.

Be aware, though, that there are lots of SQL constructs (including a lot
that crop up in stored procedures) that are not handled correctly in the
initial SQL parsing. For backend-specific stuff, that's a small bug. For
the more general initial SQL, it's an unsolvable problem.

So if you are using complicated SQL in your stored procedures, you may
need to load it manually.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread [EMAIL PROTECTED]

Interestingly, I am getting some strange errors when trying to output
the interpreter ID to my error log.  Attempting to do so generates an
error in my logs:

[Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
PythonHandler django.core.handlers.modpython:   File "/djangosites/
atlantaice/settings.py", line 3, in ?\n
apache.log_error("INTERPRETER %s" % apache.interpreter)
[Thu Jun 21 20:00:23 2007] [error] [client 209.155.235.13]
PythonHandler django.core.handlers.modpython: AttributeError: 'module'
object has no attribute 'interpreter'


atlantaice.urls doesn't reference AGDWeb in any way.

urlpatterns = patterns('',
(r'^$', 'atlantaice.web.views.homepage'),
(r'^alliedpartners/$', 'atlantaice.web.views.allied_partners'),
(r'^contact/$', 'atlantaice.web.views.contact'),
(r'^contact/confirm/$', 'atlantaice.web.views.contact_confirm'),
(r'^emergency/$', 'atlantaice.web.views.emergency'),
(r'^employmentopp/$', 'atlantaice.web.views.list_jobs'),
(r'^employmentopp/(?P\d+)/$',
'atlantaice.web.views.show_job'),
(r'^employmentopp/(?P\d+)/apply/$',
'atlantaice.web.views.job_apply'),
(r'^employmentopp/confirm/$',
'atlantaice.web.views.employment_confirm'),
(r'^eventrentals/$', 'atlantaice.web.views.event_rentals'),
(r'^eventrentals/popup/(?P[0-9a-z\-]+)/$',
'atlantaice.web.views.show_popup'),
(r'^faqs/$', 'atlantaice.web.views.faq'),
(r'^iceestimator/$', 'atlantaice.web.views.ice_estimator'),
(r'^icemachines/$', 'atlantaice.web.views.ice_machines'),
(r'^pastevents/$', 'atlantaice.web.views.past_events'),
(r'^popup_blockice/$', 'atlantaice.web.views.popup_blockice'),
(r'^popup_dryice/$', 'atlantaice.web.views.popup_dryice'),
(r'^products/$', 'atlantaice.web.views.products'),
(r'^servicearea/$', 'atlantaice.web.views.service_area'),
(r'^services/$', 'atlantaice.web.views.services'),
(r'^testimonials/$', 'atlantaice.web.views.testimonials'),
(r'^weeklyroute/$', 'atlantaice.web.views.weekly_route'),
(r'^weeklyroute/confirm/$',
'atlantaice.web.views.weekly_route_confirm'),
(r'^admin/', include('django.contrib.admin.urls')),

On Jun 21, 7:12 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> What is in:
>
>   atlantaice.urls
>
> If the details in the error page are to be believed, it would look
> like one of the URL mapping rules is referencing the other site.
>
> I really wish the Django error page would show the interpreter name
> when using mod_python. I guess another suggestion I should create a
> ticket for when I can catch up with my list of things to do.. :-)
>
> Graham
>
> On Jun 21, 11:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Error can be seen herehttp://beta.atlantaicecompany.com/
>
> > AGDWeb is an app in a totally separate project under the same
> > PythonPath.  It has a separate settings file.
>
> > I am not using any Django cache, I am referring to some sort of
> > internal caching thatmod_pythonis doing.
>
> > The settings file looks like this
>
> > 
> > ServerName beta.atlantaicecompany.com
> > ServerAdmin [EMAIL PROTECTED]
> > DocumentRoot /djangosites/atlantaice/
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
> > PythonPath "['/djangosites/'] + sys.path"
> > PythonDebug Off
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
>
> > ErrorLog /var/log/apache2/beta.atlantaicecompany.com-error.log
>
> > # Possible values include: debug, info, notice, warn, error,
> > crit,
> > # alert, emerg.
> > LogLevel warn
>
> > CustomLog /var/log/apache2/beta.atlantaicecompany.com-
> > access.log combined
> > ServerSignature Off
> > 
>
> > and
>
> > 
> > ServerName agdweb.gtagd.org
> > ServerAdmin [EMAIL PROTECTED]
> > DocumentRoot /djangosites/AGD/
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE AGD.settings
> > PythonPath "['/djangosites/'] + sys.path"
> > PythonDebug Off
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
>
> > ErrorLog /var/log/apache2/agdweb.gtagd.org-error.log
>
> > # Possible values include: debug, info, notice, warn, error,
> > crit,
> > # alert, emerg.
> > LogLevel warn
>
> > CustomLog /var/log/apache2/agdweb.gtagd.org-access.log
> > combined
> > ServerSignature Off
> > 
>
> > On Jun 21, 5:45 am, Graham Dumpleton 

RE: get_absolute_url(), sites and HTTPS

2007-06-21 Thread Chris Brand

> > Is there a way to tell Admin to use HTTPS rather than HTTP for these
> links ?
> 
> I guess if you admin site was accessed over https it would work.
> Otherwise, no, since it is a relative URL (and then redirected via an
> HTTP redirect), so it has to use the same schema (and hostname) as the
> originating page, which is the admin site change page.

But my admin site *is* accessed through https.
The "View on site" button links to a URL like https://[...]/admin/r/11/1/,
but when I click on it, it redirects to http://[...]/[get_absolute_url()
output]

Chris




--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Rob Hudson

Just following up...

If you use the query string option, you don't need to know the current
url, you can just do this:

{% if has_previous %}
Previous
{% endif %}

And the browser fills in the current url path minus any query string
and that just appends to it, which is kind of nice.

I like the clean URL of: /url/page2/

But I like how this works better in the template: /url/?page=2

Unless I'm missing something which I thought I might be.

Perhaps the pagination stuff could add support for building URLs for
you in either case and add "prev_url" and "next_url" to the context?
Then either way is a no brainer for template authors.

-Rob


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Bryan L. Fordham


> I don't understand. If you're one /foo/bar/baz/page1/, then why can't
> you write  as the link? It will work, is a
> well-formed URL and is independent of the prefix. Note that you must
> ensure your URLs are canonicalised if you use this system, though:
> always ending with a trailing slash, so that the "../" will go to the
> right place.
>   
that will work of the first page is /foo/bar/baz/page1/  and not 
/foo/bar/baz/



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Developer Needed

2007-06-21 Thread Tyson Tate

On Jun 21, 2007, at 5:11 PM, Noah Gift wrote:

> I think your being a bit misleading.  Of course you can use django  
> for a CMS.  It certainly doesn't hurt that CMS was the problem  
> domain being addressed while Django was being written either.  Just  
> take a look at 99% of the jobs on django-users.  "Hi, I work for a  
> newspaper.".  So yes it can be a CMS if you write the code for  
> it, and it is probably one of the problems django does best.   
> Saying django is not a CMS is kind of like Elvis saying he wasn't  
> influenced by the Blues... :)

Well, technically, Django is a *framework*. It is *not* a CMS. Once  
you install and configure Django, you still have absolutely nothing.  
You can build a CMS with it, certainly, but that doesn't make Django  
a CMS itself.

Saying Django is a CMS because you can use it to make a CMS is like  
saying my oven is a pie because I can make a pie with it.

Pedantically yours,
Tyson

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



RE: get_absolute_url(), sites and HTTPS

2007-06-21 Thread Chris Brand

> But my admin site *is* accessed through https.
> The "View on site" button links to a URL like https://[...]/admin/r/11/1/,
> but when I click on it, it redirects to http://[...]/[get_absolute_url()
> output]

I'd guess that it ends up at
http://code.djangoproject.org/browser/django/trunk/django/views/defaults.py#
L64 in shortcut(), which always uses http://.

Chris




--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Rob Hudson

> I don't understand. If you're one /foo/bar/baz/page1/, then why can't
> you write  as the link? It will work, is a
> well-formed URL and is independent of the prefix. Note that you must
> ensure your URLs are canonicalised if you use this system, though:
> always ending with a trailing slash, so that the "../" will go to the
> right place.

Ah, that's what I was looking for.  I hadn't thought about that.
Thanks!

And thanks for the extra note on the extra bit of checks -- I'll keep
an eye out.

-Rob


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 21:10 +, Rob Hudson wrote:
> On Jun 21, 1:23 pm, Tyson Tate <[EMAIL PROTECTED]> wrote:
> > Look at "next" and "previous" context variables. You can do:
> >
> > Next
> >
> > and
> >
> > Previous
> 
> Right, but it's the 'href="/url/..."' part that doesn't feel right to
> me.  If I either want to (a) re-use this template for other URLs (list
> view by tag, list view by date, etc) or (b) decide later that I want /
> url/ to be /foo/ in urls.py, then I have to remember to change the
> template, which I don't trust myself to do.

I don't understand. If you're one /foo/bar/baz/page1/, then why can't
you write  as the link? It will work, is a
well-formed URL and is independent of the prefix. Note that you must
ensure your URLs are canonicalised if you use this system, though:
always ending with a trailing slash, so that the "../" will go to the
right place.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Developer Needed

2007-06-21 Thread Noah Gift
On 6/21/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
>
>
> On 21-Jun-07, at 11:28 PM, Geoff wrote:
>
> > unique interactive web applications, etc. current plans include a
> > python-based CMS such as django on Linux.
>
> you could also inform them that django is not a CMS - if they are
> expecting one, they may be in for a disappointment.


I think your being a bit misleading.  Of course you can use django for a
CMS.  It certainly doesn't hurt that CMS was the problem domain being
addressed while Django was being written either.  Just take a look at 99% of
the jobs on django-users.  "Hi, I work for a newspaper.".  So yes it can
be a CMS if you write the code for it, and it is probably one of the
problems django does best.  Saying django is not a CMS is kind of like Elvis
saying he wasn't influenced by the Blues... :)

-- 
http://www.blog.noahgift.com

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get_absolute_url(), sites and HTTPS

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 10:45 -0700, Chris Brand wrote:
> I've recently been adding get_absolute_url() to my models and using it in my
> templates.
> In the documentation, it says that this also gives you a free "View on site"
> link in the Admin, which it does.
> My problem is that clicking that gives me an HTTP page rather than the HTTPS
> page which would actually show something. Apart from that one "s", the
> resulting URL is fine, but it's a pretty important "s".
> 
> Is there a way to tell Admin to use HTTPS rather than HTTP for these links ?

I guess if you admin site was accessed over https it would work.
Otherwise, no, since it is a relative URL (and then redirected via an
HTTP redirect), so it has to use the same schema (and hostname) as the
originating page, which is the admin site change page.

> 
> Failing that, is there a way to turn them off (as they don't work) ?

No. They are triggered by have get_absolute_url(). You could edit the
template in contrib/admin/templates/admin/change_form.html if you really
cared to.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 07:45 -0700, Ilya Semenov wrote:
> Malcolm,
> 
> I traced the problem and submitted the patch, see details at
> http://code.djangoproject.com/ticket/4650
> I'm not completely sure about the logic of signals though, the change
> may affect some middleware depending on it.

Thanks, Ilya. I'd gotten that far, too. Unfortunately, though, it isn't
quite that easy. Well, it is that easy for mod_python, however for WSGI
compliance, we can't do that (since the WSGI handler returns an
iterable).

There are a few possibilities I've been bouncing around, but they all
have downsides: introducing greater coupling between templates, HTTP and
database so that we know when rendering stops (which will make it
possible to behave similarly to the modpython case) or making WSGI
return a single item iterable as recommended in PEP 333 for performance
(downside is that the greater part of the memory savings are lost).

For portability reasons, supporting WSGI is very important, so any
solution that only works with modpython is unfortunately not an option.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Order_by lower...

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 06:41 -0700, greg wrote:
> Hi,
> 
> Please help me !
> 
> I just wanna know how to order my queryset by lowering my field
> before, like in SQL (ORDER BY LOWER(my_field) 'cause in this field
> I've upper et lower case and by default my result is not sorted as I
> want.

At the moment you cannot do this with the order_by field or any ordering
options on a Queryset. The reason is because all the ordering is done at
the database level and there is no way to pass through functions like
LOWER() to that level.

You could try sub-clasing QuerySet and adding extra code to do that. Off
the top of my head, I'm not sure how hard that would be to do, or even
if it's possible.

The alternative is to sort the results in Python.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms, unicode and umlauts

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 16:23 +0200, va:patrick.kranzlmueller wrote:
> the code below does not give a validation error when typing umlauts,  
> but the umlauts are not saved to the database.
> 
> al_re = re.compile(r'^\w+$', re.UNICODE)
> 
> def clean_last_name(self):
>  if 'last_name' in self.cleaned_data:
>  if not al_re.search(self.cleaned_data['last_name']):
>  raise forms.ValidationError('Error message.')
>  return self.cleaned_data['last_name']
> 
> when doing "print self.cleaned_data" I´m getting this:
> 'last_name': u'M\xfcller',
> 
> how am I supposed to deal with umlautes when using newforms?
> btw: all our data is utf-8

There are lots of little bugs like this on trunk at the moment. If you
want to use non-ASCII characters, switch to using the Unicode branch.
It's completely up-to-date with trunk (merged about twice a week,
providing there are no risky changes on trunk that haven't settled).

Part of the problem is that newforms (on trunk) tries hard to be
unicode-aware, but the transition from unicode to byestrings is not
handled well in other places in the framework. That is why we are making
all the changes on Unicode branch (which will soon be on trunk).

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Developer Needed

2007-06-21 Thread Kenneth Gonsalves


On 21-Jun-07, at 11:28 PM, Geoff wrote:

> unique interactive web applications, etc. current plans include a
> python-based CMS such as django on Linux.

you could also inform them that django is not a CMS - if they are  
expecting one, they may be in for a disappointment.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 07:45 -0700, Ilya Semenov wrote:
> Malcolm,
> 
> I traced the problem and submitted the patch, see details at
> http://code.djangoproject.com/ticket/4650
> I'm not completely sure about the logic of signals though, the change
> may affect some middleware depending on it.

One other thing that I forgot in my earlier email: it's not actually
clear why the database connections get "lost" in the current
implementation. We close the connection too early, but when the template
rendering needs to access the database, it just opens a new one (that is
why everybody is seeing more opens than closes). However, the next time
that thread or process is used, Django should be reusing the same
connection, since it will still be open and we check for an existing
connection before opening a new one. So in a sufficiently robust test
(that reuses threads), I would have expected no lost connections. The
reason why people are seeing them is something I haven't quite tracked
down yet.

Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Graham Dumpleton

What is in:

  atlantaice.urls

If the details in the error page are to be believed, it would look
like one of the URL mapping rules is referencing the other site.

I really wish the Django error page would show the interpreter name
when using mod_python. I guess another suggestion I should create a
ticket for when I can catch up with my list of things to do.. :-)

Graham

On Jun 21, 11:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Error can be seen herehttp://beta.atlantaicecompany.com/
>
> AGDWeb is an app in a totally separate project under the same
> PythonPath.  It has a separate settings file.
>
> I am not using any Django cache, I am referring to some sort of
> internal caching thatmod_pythonis doing.
>
> The settings file looks like this
>
> 
> ServerName beta.atlantaicecompany.com
> ServerAdmin [EMAIL PROTECTED]
> DocumentRoot /djangosites/atlantaice/
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
> PythonPath "['/djangosites/'] + sys.path"
> PythonDebug Off
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
>
> ErrorLog /var/log/apache2/beta.atlantaicecompany.com-error.log
>
> # Possible values include: debug, info, notice, warn, error,
> crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog /var/log/apache2/beta.atlantaicecompany.com-
> access.log combined
> ServerSignature Off
> 
>
> and
>
> 
> ServerName agdweb.gtagd.org
> ServerAdmin [EMAIL PROTECTED]
> DocumentRoot /djangosites/AGD/
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE AGD.settings
> PythonPath "['/djangosites/'] + sys.path"
> PythonDebug Off
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
>
> ErrorLog /var/log/apache2/agdweb.gtagd.org-error.log
>
> # Possible values include: debug, info, notice, warn, error,
> crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog /var/log/apache2/agdweb.gtagd.org-access.log
> combined
> ServerSignature Off
> 
>
> On Jun 21, 5:45 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Jun 21, 5:46 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote
>
> > > On 21-Jun-07, at 12:50 PM, [EMAIL PROTECTED] wrote:
>
> > > > cache gets confused.  But if I do that, the settings don't work
> > > > correctly and the site won't load.  What am I doing wrong?
>
> > > you need a pythonInterpretor line in each Location with a different
> > > name. It is in the documentation
>
> > Not true if each is in its own VirtualHost as the default behaviour of
> >mod_pythonis to give each VirtualHost its own sub interpreter. You
> > should only need to set PythonInterpreter if you were running two
> > Django instances within the same VirtualHost at different mount
> > points.
>
> > For completeness, it would help if OP posted both VirtualHost
> > configurations side by side in the same message, so one can see
> > properly the PythonPath setting for each and the
> > DJANGO_SETTINGS_MODULE setting.
>
> > BTW, if using recentmod_python, to confirm that distinct Python sub
> > interpreters are being used one can use:
>
> >   frommod_pythonimport apache
> >   apache.log_error("INTERPRETER %s" % apache.interpreter)
>
> > Then check the Apache error log file.
>
> > I would also suggest printing the value of sys.path to make sure it is
> > what you expect.
>
> > More importantly, when you say "Django's cache is confusing the two
> > sites and is saying that one table from a project doesn't exist in the
> > other project's db", can you post the actual full message you are
> > getting, and state where you are getting it. If it has a traceback,
> > also include the traceback.
>
> > Graham


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread [EMAIL PROTECTED]

prefork

On Jun 21, 3:42 pm, Joe <[EMAIL PROTECTED]> wrote:
> Are you using Apache Prefork or MPM?
>
> On Jun 21, 9:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Error can be seen herehttp://beta.atlantaicecompany.com/
>
> > AGDWeb is an app in a totally separate project under the same
> > PythonPath.  It has a separate settings file.
>
> > I am not using any Django cache, I am referring to some sort of
> > internal caching that mod_python is doing.
>
> > The settings file looks like this
>
> > 
> > ServerName beta.atlantaicecompany.com
> > ServerAdmin [EMAIL PROTECTED]
> > DocumentRoot /djangosites/atlantaice/
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
> > PythonPath "['/djangosites/'] + sys.path"
> > PythonDebug Off
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
>
> > ErrorLog /var/log/apache2/beta.atlantaicecompany.com-error.log
>
> > # Possible values include: debug, info, notice, warn, error,
> > crit,
> > # alert, emerg.
> > LogLevel warn
>
> > CustomLog /var/log/apache2/beta.atlantaicecompany.com-
> > access.log combined
> > ServerSignature Off
> > 
>
> > and
>
> > 
> > ServerName agdweb.gtagd.org
> > ServerAdmin [EMAIL PROTECTED]
> > DocumentRoot /djangosites/AGD/
> > 
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE AGD.settings
> > PythonPath "['/djangosites/'] + sys.path"
> > PythonDebug Off
> > 
> > 
> > SetHandler None
> > 
> > 
> > SetHandler None
> > 
>
> > ErrorLog /var/log/apache2/agdweb.gtagd.org-error.log
>
> > # Possible values include: debug, info, notice, warn, error,
> > crit,
> > # alert, emerg.
> > LogLevel warn
>
> > CustomLog /var/log/apache2/agdweb.gtagd.org-access.log
> > combined
> > ServerSignature Off
> > 
>
> > On Jun 21, 5:45 am, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Jun 21, 5:46 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote
>
> > > > On 21-Jun-07, at 12:50 PM, [EMAIL PROTECTED] wrote:
>
> > > > > cache gets confused.  But if I do that, the settings don't work
> > > > > correctly and the site won't load.  What am I doing wrong?
>
> > > > you need a pythonInterpretor line in each Location with a different
> > > > name. It is in the documentation
>
> > > Not true if each is in its own VirtualHost as the default behaviour of
> > > mod_python is to give each VirtualHost its own sub interpreter. You
> > > should only need to set PythonInterpreter if you were running two
> > > Django instances within the same VirtualHost at different mount
> > > points.
>
> > > For completeness, it would help if OP posted both VirtualHost
> > > configurations side by side in the same message, so one can see
> > > properly the PythonPath setting for each and the
> > > DJANGO_SETTINGS_MODULE setting.
>
> > > BTW, if using recent mod_python, to confirm that distinct Python sub
> > > interpreters are being used one can use:
>
> > >   from mod_python import apache
> > >   apache.log_error("INTERPRETER %s" % apache.interpreter)
>
> > > Then check the Apache error log file.
>
> > > I would also suggest printing the value of sys.path to make sure it is
> > > what you expect.
>
> > > More importantly, when you say "Django's cache is confusing the two
> > > sites and is saying that one table from a project doesn't exist in the
> > > other project's db", can you post the actual full message you are
> > > getting, and state where you are getting it. If it has a traceback,
> > > also include the traceback.
>
> > > Graham


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



using .fields when spanning relationships

2007-06-21 Thread Matthew Nuzum

My goal is to get a list of unique countries referenced through a
table. My model has:

class Country(models.Model):
Abbreviation = models.CharField(maxlength = 2, primary_key=True)
Country = models.CharField(maxlength = 50)

class TrainingEvent(models.Model):
 Country = models.ForeignKey(Country)
 Partner = models.ForeignKey(Partner)
 City = models.CharField(maxlength = 50)
 Course_Title = models.CharField(maxlength = 80)

class EventDates(models.Model):
TrainingEvent = models.ForeignKey(TrainingEvent)
Event_Start = models.DateField(core = True)
Event_Dates = models.CharField(core = True, maxlength = 30)

I only want a list of countries that are referenced for a
TrainingEvent whose Event_Start__range=(begin,end)

>>> eds = EventDates.objects.filter(Event_Start__range=(start,end)
>>> eds
[, ,
, ,
, ]
>>> eds.values('TrainingEvent').distinct()
[{'TrainingEvent': 1L}, {'TrainingEvent': 2L}]
>>> eds.values('TrainingEvent.Country')
FieldDoesNotExist: EventDates has no field named
'TrainingEvent.Country'
>>> eds.values('TrainingEvent_Country')
FieldDoesNotExist: EventDates has no field named
'TrainingEvent_Country'
>>> eds.values('TrainingEvent__Country')
FieldDoesNotExist: EventDates has no field named
'TrainingEvent__Country'

Again, my goal is to be able to show each Country that has a
TrainingEvent that has an Event_Start between start and end. There are
probably many ways to get there. I'm very used to SQL and could do
this in a heartbeat that way, but I want to learn the Django way.

On a related note, I often would like to do something like:
SELECT * FROM other_table WHERE some_value in ('a','b','c');

The way that seems logical to me is to do:
values = TableName.objects.values('id').filter(...)
t = OtherTable.objects.filter(TableName__in=values)

I've tried several permutations of this and haven't found anything
that works. What is the correct way to do this?


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: using .fields when spanning relationships

2007-06-21 Thread Matthew Nuzum

On 6/21/07, Matthew Nuzum <[EMAIL PROTECTED]> wrote:
> My goal is to get a list of unique countries referenced through a
> table. My model has:
>

Nice typo there... the subject should be:
using .values when spanning relationships

:-(


-- 
Matthew Nuzum
newz2000 on freenode

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Passing a list of field names to the value() method?

2007-06-21 Thread RichardH



On Jun 21, 4:54 pm, Gabriel Farrell <[EMAIL PROTECTED]> wrote:
> On Jun 19, 5:19 pm, RichardH <[EMAIL PROTECTED]> wrote:
>
>
>
> > This is probably more of a Python question than django, but django
> > provides the context for my problem.
>
> > Requirement: I have got a user defined list of field names (e.g.
> > field_names=['id','name','description',...]) and I want to pass this
> > list to the value() method on a QuerySet thereby returning a subset of
> > the model fields (as a dictionary).
>
> > Problem: value() takes individual field names as parameters (e.g.
> > value('id', 'name,' description'), not a list of field names (e.g.
> > value(field_names) ). Is there a simple way of passing the list of
> > field names to the value() method or is there an alternative strategy
> > for returning the subset of fields from the QuerySet?
>
> > Hopefully this is obvious to someone, but it has me stumped.
>
> > Richard
>
> Not obvious, and it's stumped me before in various Python projects, so
> I decided to search around for it.  Finally found it 
> athttp://mail.python.org/pipermail/python-list/2005-March/312568.html.
> That post says, in short, that one can pass a list of values to a
> function that expects those values as variable arguments by simply
> placing an asterisk before the list (or tuple) in the function input.
> For example:
>
> >>> def bob(*args):
> ... for arg in args:
> ... print arg
> ...
> >>> sally = ['june', 'andy', 'frank']
> >>> bob(sally)
> ['june', 'andy', 'frank']
> >>> bob(*sally)
> june
> andy
> frank
> >>>
>
> I tried so many ways around this problem, and I knew Python, by it's
> nature, had to have a simple solution.  Glad to have found it.
>
> HTH,
> Gabe

Gabe,
This helps a great deal. Such a simple solution, I am surprised it
isn't more prominently documented. Many thanks for making the effort
to find it. Much appreciated.
Richard


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Rob Hudson

On Jun 21, 1:23 pm, Tyson Tate <[EMAIL PROTECTED]> wrote:
> Look at "next" and "previous" context variables. You can do:
>
> Next
>
> and
>
> Previous

Right, but it's the 'href="/url/..."' part that doesn't feel right to
me.  If I either want to (a) re-use this template for other URLs (list
view by tag, list view by date, etc) or (b) decide later that I want /
url/ to be /foo/ in urls.py, then I have to remember to change the
template, which I don't trust myself to do.

I was kind of expecting to find in the pagination context variables a
prev_url and next_url I could use and not have to build my own in the
template.  I don't see all the pieces I'd need to make the /url/ part
be more dynamic.

Thanks,
Rob


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pagination

2007-06-21 Thread Tyson Tate

Look at "next" and "previous" context variables. You can do:

Next

and

Previous

to get what you want, as long as you've set up the URL regexes  
properly in urls.py. You'll want to surround each of the above with  
an if block to check and see if you do, indeed, have a next or  
previous page ("has_next" and "has_previous").

-Tyson

On Jun 21, 2007, at 1:11 PM, Rob Hudson wrote:

>
> I've set up a list view that I want paginated and I'm using the
> list_detail generic view.  I was thinking that I would prefer the / 
> url/
> page2/ URL over /url?page=2 so I set that up.  The problem is, in my
> template where I want to display the prev/next links there's no way
> that I see to avoid hard coding the "url" part of the path to the next
> and prev pages.
>
> With this in mind, it seems like the ?page=2 option is preferred.
>
> Is this right?  What are the pros/cons of one over the other?  *Is*
> there a way to get the URL prefix up to the /page2/ part?
>
> Thanks,
> Rob

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User data shared between two websites

2007-06-21 Thread James Bennett

On 6/21/07, Petey <[EMAIL PROTECTED]> wrote:
> Is there a way to use the same authentication tables between multiple
> sites? I want users on one of my websites to be able to use the same
> login on another without duplicating the tables. Is this possible. I
> couldn't tell if the add-on sites module could server that purpose or
> not.

Instances of django.contrib.auth.User on multiple sites which share a
single database are automatically shared among all of those sites; you
don't need to do anything special or make any changes.

The sites framework in django.contrib.sites is there to make it easier
to specify that certain objects are tied to specific sites, for cases
where you need to enforce such a restriction.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pagination

2007-06-21 Thread Rob Hudson

I've set up a list view that I want paginated and I'm using the
list_detail generic view.  I was thinking that I would prefer the /url/
page2/ URL over /url?page=2 so I set that up.  The problem is, in my
template where I want to display the prev/next links there's no way
that I see to avoid hard coding the "url" part of the path to the next
and prev pages.

With this in mind, it seems like the ?page=2 option is preferred.

Is this right?  What are the pros/cons of one over the other?  *Is*
there a way to get the URL prefix up to the /page2/ part?

Thanks,
Rob


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User data shared between two websites

2007-06-21 Thread Joe

Oops, mean to say subdomain in part 4

On Jun 21, 3:48 pm, Joe <[EMAIL PROTECTED]> wrote:
> Yes.  You need to meet several conditions though:
>
> 1. Obviously, the settings files for both sites must point at the same
> database
>
> 2. The two sites can't use the same model names.  If they do, they
> will share the data in those models as well, not just the users
> tables.
>
> 3. The settings files for the two sites must use the same secret key.
>
> 4. They must share the same domain name (they can be on different
> domains).  If they do not, the session cookie will be unaccessible
> between the two sites because the browser sees this as a security
> violation.
>
> 5. You will have to set the SESSION_COOKIE_DOMAIN to be the same on
> both sites as well.  ( .mydomain.com , for example)
>
> On Jun 21, 2:57 am, Petey <[EMAIL PROTECTED]> wrote:
>
> > Is there a way to use the same authentication tables between multiple
> > sites? I want users on one of my websites to be able to use the same
> > login on another without duplicating the tables. Is this possible. I
> > couldn't tell if the add-on sites module could server that purpose or
> > not.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User data shared between two websites

2007-06-21 Thread Joe

Yes.  You need to meet several conditions though:

1. Obviously, the settings files for both sites must point at the same
database

2. The two sites can't use the same model names.  If they do, they
will share the data in those models as well, not just the users
tables.

3. The settings files for the two sites must use the same secret key.

4. They must share the same domain name (they can be on different
domains).  If they do not, the session cookie will be unaccessible
between the two sites because the browser sees this as a security
violation.

5. You will have to set the SESSION_COOKIE_DOMAIN to be the same on
both sites as well.  ( .mydomain.com , for example)

On Jun 21, 2:57 am, Petey <[EMAIL PROTECTED]> wrote:
> Is there a way to use the same authentication tables between multiple
> sites? I want users on one of my websites to be able to use the same
> login on another without duplicating the tables. Is this possible. I
> couldn't tell if the add-on sites module could server that purpose or
> not.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Joe

Are you using Apache Prefork or MPM?

On Jun 21, 9:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Error can be seen herehttp://beta.atlantaicecompany.com/
>
> AGDWeb is an app in a totally separate project under the same
> PythonPath.  It has a separate settings file.
>
> I am not using any Django cache, I am referring to some sort of
> internal caching that mod_python is doing.
>
> The settings file looks like this
>
> 
> ServerName beta.atlantaicecompany.com
> ServerAdmin [EMAIL PROTECTED]
> DocumentRoot /djangosites/atlantaice/
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
> PythonPath "['/djangosites/'] + sys.path"
> PythonDebug Off
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
>
> ErrorLog /var/log/apache2/beta.atlantaicecompany.com-error.log
>
> # Possible values include: debug, info, notice, warn, error,
> crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog /var/log/apache2/beta.atlantaicecompany.com-
> access.log combined
> ServerSignature Off
> 
>
> and
>
> 
> ServerName agdweb.gtagd.org
> ServerAdmin [EMAIL PROTECTED]
> DocumentRoot /djangosites/AGD/
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE AGD.settings
> PythonPath "['/djangosites/'] + sys.path"
> PythonDebug Off
> 
> 
> SetHandler None
> 
> 
> SetHandler None
> 
>
> ErrorLog /var/log/apache2/agdweb.gtagd.org-error.log
>
> # Possible values include: debug, info, notice, warn, error,
> crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog /var/log/apache2/agdweb.gtagd.org-access.log
> combined
> ServerSignature Off
> 
>
> On Jun 21, 5:45 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Jun 21, 5:46 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote
>
> > > On 21-Jun-07, at 12:50 PM, [EMAIL PROTECTED] wrote:
>
> > > > cache gets confused.  But if I do that, the settings don't work
> > > > correctly and the site won't load.  What am I doing wrong?
>
> > > you need a pythonInterpretor line in each Location with a different
> > > name. It is in the documentation
>
> > Not true if each is in its own VirtualHost as the default behaviour of
> > mod_python is to give each VirtualHost its own sub interpreter. You
> > should only need to set PythonInterpreter if you were running two
> > Django instances within the same VirtualHost at different mount
> > points.
>
> > For completeness, it would help if OP posted both VirtualHost
> > configurations side by side in the same message, so one can see
> > properly the PythonPath setting for each and the
> > DJANGO_SETTINGS_MODULE setting.
>
> > BTW, if using recent mod_python, to confirm that distinct Python sub
> > interpreters are being used one can use:
>
> >   from mod_python import apache
> >   apache.log_error("INTERPRETER %s" % apache.interpreter)
>
> > Then check the Apache error log file.
>
> > I would also suggest printing the value of sys.path to make sure it is
> > what you expect.
>
> > More importantly, when you say "Django's cache is confusing the two
> > sites and is saying that one table from a project doesn't exist in the
> > other project's db", can you post the actual full message you are
> > getting, and state where you are getting it. If it has a traceback,
> > also include the traceback.
>
> > Graham


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to define stored procedures within django

2007-06-21 Thread shabda

thanks, That solves my problem.

On Jun 21, 11:05 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I want to use some stored procedures. I am mySql. Is there
> > some way I can define stored procedures from withing django?
> > (We can call already defined procedures,
> >http://www.djangosnippets.org/snippets/118/discusses how, but
> > can we also define stored procedures from within django?)
>
> I don't believe Django holds your hand for creating SPs.  Each DB
> engine tends to use its own languages for SPs which makes the
> process even harder.  IIRC, PostgreSQL has support for SPs
> written in Python in addition to umpteen other languages.  I
> haven't toyed with SPs in MySQL, and I don't know if sqlite even
> supports SPs (other than perhaps executing a bit of code on a
> trigger).
>
> You can always use cursor.execute() to create them, or you can
> use Django's facilities for executing SQL when you
> sqlcustom/sqlreset/sqlall/reset via manage.py as described at
>
> http://www.djangoproject.com/documentation/model-api/#database-backen...
>
> and above.  However, I don't think there's much more in the way
> of coddling facilities in Django.
>
> -tim


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Developer Needed

2007-06-21 Thread Geoff

Here's an add for a django programmer for a new magazine I'm not
sure what it pays, but I think it would be decent contract work that
can turn into more, I can get anyone interested in touch with the
publisher, just mail me

...snip...

Seeking Web Programmer for Indie Film Magazine Launch
The Independent, an indie film magazine published for over 30 years,
is relaunching its site and magazine.  Seeking a web programmer
looking to oversee all technology for the site - content system,
unique interactive web applications, etc. current plans include a
python-based CMS such as django on Linux.

A great opportunity for national exposure for your work.  Email
past projects.  For more information about the organization, visit
www.independent-magazine.org.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to define stored procedures within django

2007-06-21 Thread Tim Chase

> I want to use some stored procedures. I am mySql. Is there
> some way I can define stored procedures from withing django? 
> (We can call already defined procedures,
> http://www.djangosnippets.org/snippets/118/ discusses how, but
> can we also define stored procedures from within django?)

I don't believe Django holds your hand for creating SPs.  Each DB 
engine tends to use its own languages for SPs which makes the 
process even harder.  IIRC, PostgreSQL has support for SPs 
written in Python in addition to umpteen other languages.  I 
haven't toyed with SPs in MySQL, and I don't know if sqlite even 
supports SPs (other than perhaps executing a bit of code on a 
trigger).

You can always use cursor.execute() to create them, or you can 
use Django's facilities for executing SQL when you 
sqlcustom/sqlreset/sqlall/reset via manage.py as described at

http://www.djangoproject.com/documentation/model-api/#database-backend-specific-sql-data

and above.  However, I don't think there's much more in the way 
of coddling facilities in Django.

-tim






--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin date filter bug

2007-06-21 Thread [EMAIL PROTECTED]

I am using MySQL, last subversion for django and Python 2.4.4 on
debian linux
Tested some more with date fields and it all working fine, the problem
was with datetime fields and it was my fault because I did not include
the time.

Daniel

On Jun 20, 9:03 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2007-06-20 at 21:39 +, [EMAIL PROTECTED] wrote:
> > I had some doubts about my testing because my fields are datetime.
> > So I tested it some more and the same problem came up but not only on
> > the admin
>
> > I have an app with a datetime field. Then I saved enoght objects to
> > have one for each day of the month and the same results came up for:
> > App.objects.filter(date__gt=datetime.datetime(2007, 5, 21, 0, 0, 0))
> > or
> > App.objects.filter(date__gte=datetime.datetime(2007, 5, 21, 0, 0, 0))
> > also the same results for LTE or LT
>
> > its it my mistake somewhere? or is it a bug?
>
> We've fixed some tickets related to this in the past. I cannot remember
> off the top of my head if there is still one open or not. Make sure the
> problem is repeatable with the latest subversion code and the database
> backend you are using will probably be significant, too. Most of the
> problems that have been reported have been with SQLite (or caused by
> trying to fix SQLite issues).
>
> So django version, database backend and Python version (because Python
> 2.5 uses the builtin SQLite driver) are probably all relevant if you
> open a ticket. But have a search in the database component (just scan
> through the titles of all the open tickets in that component) first to
> see if it's a dupe.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing Views

2007-06-21 Thread [EMAIL PROTECTED]

the dict was supposed to be passing in the logged user, though I am
starting to think I don't need to pass anything as long as I can get
the session set.
Another developer in the office wrote the auth code so it took me a
bit to get a handle on just what it was doing.

I am thinking if i get the session set properly I will be ok...


On Jun 21, 12:44 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > Jeremy,
> >Thanks for the response.
>
> > to be more clear maybe -
> >i was actually trying to pass the dictionary as part of the request
> > object - since the view looks for the logged participant in the
> > request from the page.
>
> > what if my view does not take a qstring?  I need to pass it some
> > pieces in the request...
>
> I'm not sure I follow.  There are 4 ways to pass information in the
> request: the URL itself, the querystring, the POST variables, and
> cookies.
>
> How were you wanting to "pass in some pieces in the request"?


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



get_absolute_url(), sites and HTTPS

2007-06-21 Thread Chris Brand

I've recently been adding get_absolute_url() to my models and using it in my
templates.
In the documentation, it says that this also gives you a free "View on site"
link in the Admin, which it does.
My problem is that clicking that gives me an HTTP page rather than the HTTPS
page which would actually show something. Apart from that one "s", the
resulting URL is fine, but it's a pretty important "s".

Is there a way to tell Admin to use HTTPS rather than HTTP for these links ?

Failing that, is there a way to turn them off (as they don't work) ?

Thanks,

Chris Brand





--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



One-to-one - can't seem to be able to update Model

2007-06-21 Thread Merric Mercer


I have a model called REWARD, which has a one-to-one relationship with a 
model called PROMOTION

I seem to be able to access the attributes of REWARD via PROMOTIONS but 
I can't seem to update them.

promo=Promotion.objects.get(id=10)
promo.reward.user_visits
 >> 10L  

However:-
promo.reward.user_visits=12   #  This does not work.
promo.reward.user_visits
 >> 10L


What am I missing? I was sure that this was working in a previous 
incarnation, but not any more. Has something changed?

MerMer

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Json with Recursion

2007-06-21 Thread JGAllen23

I'm making a task application that allows for subtasks.  I have my
model set up so that it has ParentTask is a ForiegnKey('self), so
using Task.task_set.all() I can get all of the subtasks, but when I
serialize using json it doesn't show any of the subtasks.  Is there
any way for me to get the subtasks serialized into json?


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing Views

2007-06-21 Thread Jeremy Dunck

On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Jeremy,
>Thanks for the response.
>
> to be more clear maybe -
>i was actually trying to pass the dictionary as part of the request
> object - since the view looks for the logged participant in the
> request from the page.
>
> what if my view does not take a qstring?  I need to pass it some
> pieces in the request...

I'm not sure I follow.  There are 4 ways to pass information in the
request: the URL itself, the querystring, the POST variables, and
cookies.

How were you wanting to "pass in some pieces in the request"?

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using simplejson

2007-06-21 Thread Joseph Heck

Without seeing your code, it's hard to know what's happening. It
sounds like you're having a problem using JSON objects with
javascript, so I'll try and throw out a short example and see if that
helps. If this doesn't do it for you, put up the actual javascript
that's causing you the trouble, and we'll see if we can't debug it.

The example: http://www.djangosnippets.org/snippets/292/

This example uses Dojo, the idea being checking to see if a username
is available. Most of the text of that example is pulling all the
parts together, but the critical line to using JSON within the
javascript is:

arrayData = dojo.json.evalJson(data);

which evaluates the data and returns it as object literals that you
can then access with dot notation or whatever you use. In my case, I
used the javascript array/dictionary lookup notation to get my simple
"is it there" response and then I spew in some HTML accordingly.

-joe


On 6/20/07, aman r <[EMAIL PROTECTED]> wrote:
> yes, u have understood my problem correctly but the JSON object is not
> recognized in the html page so if i try to say something like list.name
> (where list has my JSON and name is its one of the values present in that
> list) then it doesnt get recognized, is gives me Type mismatch error , is
> there any conversion or decode i need to do ?
>
>
> On 6/20/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> >
> > If I understand correctly, that sounds reasonably doable - what is
> > your question? Taking JSON from whatever source and generating a form
> > in HTML is pretty much straight javascript and/or templating.
> >
> > -joe
> >
> > On 6/20/07, cess <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi All,
> > >I am very new to the Django framework, i have tried using free
> > > admin API , it works fine,so i  wanted to design my own page where i
> > > dont interact with database and dont create any models, i rather call
> > > an JSP page in my view which returns an JSON object, i want to convert
> > > it into a form which i can use to display in my template ( i.e.,) in a
> > > form python form or something and access all different fields from
> > > that JSON result.
> > >
> > >
> > > >
> > >
> >
> >
> >
> >
>
>
>  >
>

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing Views

2007-06-21 Thread [EMAIL PROTECTED]

Jeremy,
   Thanks for the response.

to be more clear maybe -
   i was actually trying to pass the dictionary as part of the request
object - since the view looks for the logged participant in the
request from the page.

what if my view does not take a qstring?  I need to pass it some
pieces in the request...

I will also try setting a real session variable..

thanks again, I will let you know if it works..

On Jun 21, 12:18 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> ...
>
> > response = self.client.get('/broadcasts/new/',
> > {'loggedParticipant': participant} )
>
> It's not clear to me what the dictionary there is meant to do.  That
> dictionary is passed as the querystring, *not* as the session.
>
> Also, if you have django.contrib.sessions in your INSTALLED_APPS (and
> you should if you're using Django sessions), then it appears that
> client.session re-constructs a SessionWrapper each call, based on
> .cookies[settings.SESSION_COOKIE_NAME].
>
> As such, you'll want to save a real session object (see
> Session.objects.save()), and then set a cookie with the session_key of
> that saved object.
>
> You could, of course, make that part of a fixture used by the test case.
>
> I haven't done this myself, so would be interested if it works out for you.
>
> Cheers,
>   Jeremy


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to define stored procedures within django

2007-06-21 Thread shabda

Hi,

I want to use some stored procedures. I am mySql. Is there some way I
can define stored procedures from withing django?
(We can call already defined procedures, 
http://www.djangosnippets.org/snippets/118/
discusses how, but can we also define stored procedures from within
django?)


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: classes

2007-06-21 Thread Joseph Heck

Ahhh! Thanks, didn't know (obviously) about that one!

-joe

On 6/21/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
>
> Actually, type is a function, not a method.
> type(x) == x.__class__
>
> Regards,
> Aidas Bendoraitis aka Archatas
>
>
> On 6/18/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> >
> > x = '123'
> > x.__class__ will give a reasonable answer, x.type() doesn't. (Python 2.4)
> >
> > If you can get away with using type(), it's probably a lot cleaner to use...
> >
> > -joe
> >
> > On 6/18/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> > >
> > > or type()
> > >
> > > On 6/7/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
> > > >
> > > > .__class__
> > > >
> > > > On 6/7/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote:
> > > > > how can I know insede a method the type of my class dynamicaly?
> > > > >
> > > > > --
> > > > > Lic. José M. Rodriguez Bacallao
> > > > > Cupet
> > > > >  >
> > > > >
> > > >
> > > > >
> > > >
> > >
> > > >
> > >
> >
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing Views

2007-06-21 Thread Jeremy Dunck

On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
...
> response = self.client.get('/broadcasts/new/',
> {'loggedParticipant': participant} )

It's not clear to me what the dictionary there is meant to do.  That
dictionary is passed as the querystring, *not* as the session.

Also, if you have django.contrib.sessions in your INSTALLED_APPS (and
you should if you're using Django sessions), then it appears that
client.session re-constructs a SessionWrapper each call, based on
.cookies[settings.SESSION_COOKIE_NAME].

As such, you'll want to save a real session object (see
Session.objects.save()), and then set a cookie with the session_key of
that saved object.

You could, of course, make that part of a fixture used by the test case.

I haven't done this myself, so would be interested if it works out for you.

Cheers,
  Jeremy

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Passing a list of field names to the value() method?

2007-06-21 Thread Gabriel Farrell

On Jun 19, 5:19 pm, RichardH <[EMAIL PROTECTED]> wrote:
> This is probably more of a Python question than django, but django
> provides the context for my problem.
>
> Requirement: I have got a user defined list of field names (e.g.
> field_names=['id','name','description',...]) and I want to pass this
> list to the value() method on a QuerySet thereby returning a subset of
> the model fields (as a dictionary).
>
> Problem: value() takes individual field names as parameters (e.g.
> value('id', 'name,' description'), not a list of field names (e.g.
> value(field_names) ). Is there a simple way of passing the list of
> field names to the value() method or is there an alternative strategy
> for returning the subset of fields from the QuerySet?
>
> Hopefully this is obvious to someone, but it has me stumped.
>
> Richard

Not obvious, and it's stumped me before in various Python projects, so
I decided to search around for it.  Finally found it at
http://mail.python.org/pipermail/python-list/2005-March/312568.html.
That post says, in short, that one can pass a list of values to a
function that expects those values as variable arguments by simply
placing an asterisk before the list (or tuple) in the function input.
For example:

>>> def bob(*args):
... for arg in args:
... print arg
...
>>> sally = ['june', 'andy', 'frank']
>>> bob(sally)
['june', 'andy', 'frank']
>>> bob(*sally)
june
andy
frank
>>>

I tried so many ways around this problem, and I knew Python, by it's
nature, had to have a simple solution.  Glad to have found it.

HTH,
Gabe


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Testing Views

2007-06-21 Thread [EMAIL PROTECTED]

I am in the process of working up my unit tests for an app set to
release pretty soon, the issue I am having is with getting the unit
tests for my views to run properly.

The issue is that in each view I have a login check for a custom login
function (we could not use the django auth system unfortunately),
every time I try to GET or POST to the view in my unit test  I get
redirected to the login view.

The login check checks that the info passed in the request matches
that in a session variable that is set on login.
So what i need to do is set the session variable and pass a
participant_id in my request, which I think I am doing.  However it is
not getting past the check...

Code is posted below:

this is the login check:

def getLoggedParticipant(request):
if 'participant_id' not in request.session:
return
try:
return
Participant.objects.get(pk=request.session['participant_id'])
except Participant.DoesNotExist:
return


I pass the participant id here:


class test_Views_TestCase(TestCase):
''' test the views return the correct items '''
fixtures = ['initial_data.json']
def setUp(self):
setup_test_environment()
cleanDB()
self.client = Client()



def test_broadcast_overview(self):
response = self.client.get('/broadcasts/new/' )
# Check that the respose is 302 Redirect OK
self.failUnlessEqual(response.status_code, 302)

def test_broadcast_overview_with_user(self):
participant = Participant.objects.get(nickname = 'twheeler')
''' Get the participant'''
self.client.session['participant_id']=
participant.participant_id
''' Set session '''

response = self.client.get('/broadcasts/new/',
{'loggedParticipant': participant} )

self.assertEqual(self.client.session['participant_id'],1)
self.assertEqual(response.status_code, 302)
redirects ok but to the wrong page

''' This piece I added to get an idea of what was happening
'''
print self.client.session  - returns {participant_id', 1}
print response returns the auth/login view which is the
issue,
print participant



I cannot get past the login check in the view... which is this
def broadcast_overview(request):
''' shows list of links to add new broadcasts when the broadcaster
has not yet created any, or shows the current broadcasters list'''
loggedParticipant = getLoggedParticipant(request)
if not loggedParticipant or not
loggedParticipant.isBroadcaster():
'''isBroadcaster() is a method in my model - check to see if the
participant is in a specific program'''
return HttpResponseRedirect('/auth/login')



any thoughts would be a great help


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: two way edit ManyToManyField in admin interface

2007-06-21 Thread KpoH

projects = models.ManyToManyField('Project',

without comments :)

stano пишет:
> Hi, I am totally new. I am trying make TimeTracker project.
> Now I am playing only with admin interface.
>
> I have this model:
>
> class User(models.Model):
>   timestamp = models.DateTimeField()
>   login = models.CharField()
>   password = models.CharField()
>
> # does not work, Project is not defined here
> # projects = models.ManyToManyField(Project,
> filter_interface=models.HORIZONTAL)
>
>   def __str__(self):
>   return self.login
>
>   class Admin:
>   fields = (
>   (None, {'fields':('timestamp',)}),
>   (None, {'fields':('login',)}),
>   (None, {'fields':('password',)}),
> # does not work, unknown projects
> # (None, {'fields':('projects',)}),
>   )
>
> class Project(models.Model):
>   timestamp = models.DateTimeField()
>   name = models.CharField()
>   users = models.ManyToManyField(User,
> filter_interface=models.HORIZONTAL)
>
>   def __str__(self):
>   return self.name
>
>   class Admin:
>   list_filter = ('name', 'timestamp')
>   search_fields = ('name',)
>
> While editing Project, I am able to select existing users which
> belongs to project.
> It is possible to show list of Projects while editing User?
>
>
> Thanks.
>
> Stano Paška
>
>
> >
>   

-- 
Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L.
http://www.asterisksupport.ru
http://www.asterisk-support.com

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysql sleeping queries

2007-06-21 Thread Ilya Semenov

Malcolm,

I traced the problem and submitted the patch, see details at
http://code.djangoproject.com/ticket/4650
I'm not completely sure about the logic of signals though, the change
may affect some middleware depending on it.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



two way edit ManyToManyField in admin interface

2007-06-21 Thread stano

Hi, I am totally new. I am trying make TimeTracker project.
Now I am playing only with admin interface.

I have this model:

class User(models.Model):
timestamp = models.DateTimeField()
login = models.CharField()
password = models.CharField()

# does not work, Project is not defined here
#   projects = models.ManyToManyField(Project,
filter_interface=models.HORIZONTAL)

def __str__(self):
return self.login

class Admin:
fields = (
(None, {'fields':('timestamp',)}),
(None, {'fields':('login',)}),
(None, {'fields':('password',)}),
# does not work, unknown projects
#   (None, {'fields':('projects',)}),
)

class Project(models.Model):
timestamp = models.DateTimeField()
name = models.CharField()
users = models.ManyToManyField(User,
filter_interface=models.HORIZONTAL)

def __str__(self):
return self.name

class Admin:
list_filter = ('name', 'timestamp')
search_fields = ('name',)

While editing Project, I am able to select existing users which
belongs to project.
It is possible to show list of Projects while editing User?


Thanks.

Stano Paška


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Development times

2007-06-21 Thread Eugene Morozov

Thanks.
In my project I've spent many hours learning Django, trying to
correctly implement support for i18n for everything from models to
templates (ended up using django-multlingual) and writing unit tests
(although I don't have a 100% coverage, far from it).

The site I'm building uses almost every feature of Django, some third-
party apps (most notably django-multilingual and django-tagging), and
custom templatetags, filters and middleware that I've written
specifically for it.

I guess if I'd need to build a second site, I'll do it much more
quickly.
Eugene

On 21 июн, 05:15, Bryan Veloso <[EMAIL PROTECTED]> wrote:
> I've only developed two sites, a blog and a dynamic scoreboard, having
> no prior python experience.
>
> The blog took about 4 weeks, with a lot of help, and it's still not
> done due to some limitations I've hit with the framework (or
> limitations in my own knowledge).
> The scoreboard I just finished an "alpha" of, and that took me less
> than 2 weeks. :)
>
> On Jun 20, 2:00 pm, Eugene Morozov <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > I'm interested how much time it took to develop some Django sites.
> > Just curious to compare my performance against others.
>
> > Currently, I have developed only a single Django site (it is very
> > complex and is actually only 90% ready). It took two months to
> > develop, I have detailed log created using beautiful gtimelog program.
> > Although I've started using it in the middle of the project, so I
> > don't have exact data how much time I spent on models, logic or HTML
> > layout (the lest interesting and most time-consuming part of the
> > project).
> > Eugene


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms-stability, django0.96

2007-06-21 Thread Jeremy Dunck

On 6/21/07, Gábor Farkas <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> i have to add some forms to our django0.96-using application.
> until now i used oldforms. are the newforms the recommended way to go
> with django0.96?

0.96 was [4810].  The newforms-admin branch is using newforms
extensively and as far as I can see, fixes needed in support of that
branch have been done on trunk and then merged to the branch.

There are been a fair number of fixes since 0.96 in newforms, but if
you're willing to go a bit past 0.96, I think you can pick them up
with little risk.

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms, unicode and umlauts

2007-06-21 Thread va:patrick.kranzlmueller

the code below does not give a validation error when typing umlauts,  
but the umlauts are not saved to the database.

al_re = re.compile(r'^\w+$', re.UNICODE)

def clean_last_name(self):
 if 'last_name' in self.cleaned_data:
 if not al_re.search(self.cleaned_data['last_name']):
 raise forms.ValidationError('Error message.')
 return self.cleaned_data['last_name']

when doing "print self.cleaned_data" I´m getting this:
'last_name': u'M\xfcller',

how am I supposed to deal with umlautes when using newforms?
btw: all our data is utf-8

thanks,
patrick







--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Markup as a function of User-Agent

2007-06-21 Thread [EMAIL PROTECTED]

Yup... first, don't do it based on user agent. Guaranteed you won't
think of one, or the specs will change, or something will go belly up
on you. Do it on capability. If it's a small screen, do x, otherwise,
do y, whatever the UA is.
What really matters to you is the size of the thing, right?

So, on the simplest level, you use a snippet of JS to get the clients
browser window size (not resolution), and feed additional/alternate
CSS for it. See http://www.themaninblue.com/writing/perspective/2006/01/19/

Getting more sophisticated, you could have the JS make the check and
either set a cookie or append some querystring (?small=true, maybe) to
each url, which you could then pick up in your view, if you needed
COMPLETELY different content.

But that sounds messy to me, and just making a smart small-screen CSS
is pretty trivial.

The same trick is also very helpful for taking small-to-mid-size fixed-
width layouts and resizing them for very large windows.



On Jun 20, 1:43 pm, EagerToUnderstand <[EMAIL PROTECTED]> wrote:
> I would like to change the information/size of the returned HTML page
> depending on the User-Agent accessing the content.
> (Typically rendering a smaller page for a PDA than for a PC browser.)
> I know how to get hold of the User-Agent.  It feels to me like this
> must be a common requirement, yet I can not find info on it.  Anybody
> got a eloquent solution?


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms-stability, django0.96

2007-06-21 Thread Gábor Farkas

hi,

i have to add some forms to our django0.96-using application.
until now i used oldforms. are the newforms the recommended way to go 
with django0.96?

thanks,
gabor

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Michal

> Then using distinct() might do the trick:
> 
>entries = entries.distinct()

I try this too in the past, but it doesn't work, because I want to 
filter out duplicate data in column note. In the other columns might be 
different values, so in query result isn't 2 or more absolutely 
identical rows.

Am I right, that distinct filter out only identical rows in result?

> Or, if you stick with using raw SQL, it's likely better to do
> 
>SELECT DISTINCT note
>FROM journals_journal
>WHERE length(note) > 0 and note like 'whatever%'
>ORDER BY note
> 
> as this tells the DB exactly what your intentions are, and it can 
> optimize accordingly.

Thank you, my SQL knowledge isn't very strong. I compare your and my 
(GROUP BY) version with EXPLAIN ANALYZE statement in DB, and your 
variant is faster. I rewrite my code. Thank you again.


Regards

Michal

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Order_by lower...

2007-06-21 Thread greg

Hi,

Please help me !

I just wanna know how to order my queryset by lowering my field
before, like in SQL (ORDER BY LOWER(my_field) 'cause in this field
I've upper et lower case and by default my result is not sorted as I
want.

Thank you so much for your answer !


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread [EMAIL PROTECTED]

Error can be seen here http://beta.atlantaicecompany.com/

AGDWeb is an app in a totally separate project under the same
PythonPath.  It has a separate settings file.

I am not using any Django cache, I am referring to some sort of
internal caching that mod_python is doing.

The settings file looks like this


ServerName beta.atlantaicecompany.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /djangosites/atlantaice/

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE atlantaice.settings
PythonPath "['/djangosites/'] + sys.path"
PythonDebug Off


SetHandler None


SetHandler None


SetHandler None


SetHandler None


ErrorLog /var/log/apache2/beta.atlantaicecompany.com-error.log

# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/beta.atlantaicecompany.com-
access.log combined
ServerSignature Off


and


ServerName agdweb.gtagd.org
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /djangosites/AGD/

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE AGD.settings
PythonPath "['/djangosites/'] + sys.path"
PythonDebug Off


SetHandler None


SetHandler None


ErrorLog /var/log/apache2/agdweb.gtagd.org-error.log

# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/agdweb.gtagd.org-access.log
combined
ServerSignature Off


On Jun 21, 5:45 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Jun 21, 5:46 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote
>
> > On 21-Jun-07, at 12:50 PM, [EMAIL PROTECTED] wrote:
>
> > > cache gets confused.  But if I do that, the settings don't work
> > > correctly and the site won't load.  What am I doing wrong?
>
> > you need a pythonInterpretor line in each Location with a different
> > name. It is in the documentation
>
> Not true if each is in its own VirtualHost as the default behaviour of
> mod_python is to give each VirtualHost its own sub interpreter. You
> should only need to set PythonInterpreter if you were running two
> Django instances within the same VirtualHost at different mount
> points.
>
> For completeness, it would help if OP posted both VirtualHost
> configurations side by side in the same message, so one can see
> properly the PythonPath setting for each and the
> DJANGO_SETTINGS_MODULE setting.
>
> BTW, if using recent mod_python, to confirm that distinct Python sub
> interpreters are being used one can use:
>
>   from mod_python import apache
>   apache.log_error("INTERPRETER %s" % apache.interpreter)
>
> Then check the Apache error log file.
>
> I would also suggest printing the value of sys.path to make sure it is
> what you expect.
>
> More importantly, when you say "Django's cache is confusing the two
> sites and is saying that one table from a project doesn't exist in the
> other project's db", can you post the actual full message you are
> getting, and state where you are getting it. If it has a traceback,
> also include the traceback.
>
> Graham


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Tim Chase

>> I'm not sure why you're GROUPing BY "note" as you don't have any 
>> aggregate functions in play in your example code.
> 
> I need grouping, because in the table could be several rows with the 
> same note and I want only "unique" note results.


Then using distinct() might do the trick:

   entries = entries.distinct()

Or, if you stick with using raw SQL, it's likely better to do

   SELECT DISTINCT note
   FROM journals_journal
   WHERE length(note) > 0 and note like 'whatever%'
   ORDER BY note

as this tells the DB exactly what your intentions are, and it can 
optimize accordingly.

Unfortunately, for all these cases, Length() is a 
non-standard/non-portable function and is sometimes len() but 
othertimes length() depending on your back-end.  Sigh. :(

If one needed to workaround that and could assume that you had 
some sort of alpha-numeric data in the field, it could be reduced 
to a single test of

   WHERE note ILIKE '%[a-z0-9]%'

or

   ...filter(note__icontains='[a-z0-9]')

Just a few more ideas,

-tim




--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Graphs and django

2007-06-21 Thread Chundermonkey


i've used chartdirector in the past with django, very easy to install,
although the free version cannot be used for commercial purposes.


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Django-fr.org is out!

2007-06-21 Thread Jeremy Dunck

On 6/21/07, David Larlet <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm proud to announce that after a few months of stagnation the french
> community is online with a new site (powered by django of course) :
> http://www.django-fr.org/

I don't speak French, but this is very nice to see.

Is there any interest in a #django-es for Spanish?  I speak a little
of that and would like to improve.  I could help with Django and
others could help me with Spanish.  ;-)

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Michal

Tim Chase wrote:

> I'm not sure why you're GROUPing BY "note" as you don't have any 
> aggregate functions in play in your example code.

I need grouping, because in the table could be several rows with the 
same note and I want only "unique" note results.


Regards

Michal

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Bryan L. Fordham


> This should be writable in a slightly more Djangoic (I suppose if 
> Python code is Pythonic, Django code is Djangoic?  Djanonic? 
> Djangonical?  Djangoish?) fashion:
>   
my vote would be to user "superfly," as in:
This should be writable in a slightly more superfly fashion
>entries = Journal.objects.filter(note__startswith = q)
>entries = entries.extra(where='length(note) > 0')
>   
I've spent some time recently rewriting some of my custom managers to 
use the extra method, and I highly recommend it. I know it may not be 
possible in all circumstances, but for things like sorting and using 
generic views it made my life a lot easier. I do suggest spending time 
playing with it in the shell to get the hang of it.

So, nothing of real substance to impart here, just to encourage you to 
check out the extras() method.

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Tim Chase

> I need to write some custom SQL in Django:
> 
>from django.db import connection
>cursor = connection.cursor()
>cursor.execute("SELECT note FROM journals_journal WHERE LENGTH(note) 
>  > 0 AND note LIKE %s GROUP BY note ORDER BY note;", [q+'%'])
> 
> where q is string, for example 'foo'.

This should be writable in a slightly more Djangoic (I suppose if 
Python code is Pythonic, Django code is Djangoic?  Djanonic? 
Djangonical?  Djangoish?) fashion:

   entries = Journal.objects.filter(note__startswith = q)
   entries = entries.extra(where='length(note) > 0')

(you might have to tweak that "length(note) > 0" bit, as Django 
mungs field-names a bit in the query).

I'm not sure why you're GROUPing BY "note" as you don't have any 
aggregate functions in play in your example code.

http://www.djangoproject.com/documentation/0.95/db-api/#startswith

and the "where" section of

http://www.djangoproject.com/documentation/0.95/db-api/#extra-select-none-where-none-params-none-tables-none

> I have problems with it so I print out connection.queries and I was 
> suprised, because foo% wasn't surrounded by ' or " :
> 
>SELECT note FROM journals_journal WHERE LENGTH(note) > 0 AND note 
> LIKE foo% GROUP BY note ORDER BY note;'
> 
> Is this normal? Isn't there possibility for SQL inject?

As Malcom noted, it's not quite what was sent to the DB. 
However, it /would/ be nice for debugging purposes to have the 
*exact* query sent to the DB.  However, this would have to be 
supported on a per-backend basis. :(

-tim







--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms and File (image) upload

2007-06-21 Thread Dirk van Oosterbosch, IR labs
On 20-jun-2007, at 22:19, SanPy wrote:

> File and image uploading for newforms, AFAIK, is not implemented in
> 0.96. There is a ticket for this (#3297). If you look in the django-
> developers newsgroup and search for #3297, you will find more
> information. It is possible to have it working with the latest trunk
> from SVN and a patch from #3297. It works fine on my machine with the
> latest trunk and patch.


Hi Sander,

Thanks for the pointers on this one,

There seems to be an incompatibility between the latest trunk (rev  
5505) and the last (06/13/07) patch for #3297. More on this below.

But my main problem at the moment is that my host doesn't like the  
idea of getting a -possibly- unstable trunk version with a patch on top.

So I guess I have to figure it out with the current 0.96 version and  
various examples. I found another one at http:// 
www.djangosnippets.org/snippets/95/ which helped me just a tidbit  
further.

Question: can I mix and match oldforms and newforms together? (in the  
same application that is, not in the same view or form obviously).


(En bedankt voor de code voorbeelden, ook al kan ik die dus niet op  
de server gebruiken)
best
dirk





The incompatibility between the latest trunk (rev 5505) and the last  
patch on http://code.djangoproject.com/ticket/3297 :
filefield_with_newforms_admin_integration_cleaner.diff (20.2 kB) -  
added by Øyvind Saltvik <[EMAIL PROTECTED]> on 06/13/07 05:19:27.

see this excerpt output from the command
[ /django_src]% patch -p0 <  
filefield_with_newforms_admin_integration_cleaner.diff
[...]
can't find file to patch at input line 302
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--
|Index: django/contrib/admin/options.py
|===
|--- django/contrib/admin/options.py(revision 5457)
|+++ django/contrib/admin/options.py(working copy)
--
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
patching file django/contrib/admin/urls.py
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file django/contrib/admin/ 
urls.py.rej
[...]





-
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands

http://labs.ixopusada.com
-



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Michal

>> Is this normal? Isn't there possibility for SQL inject?
> 
> No, because of the reason described in this email: 
> 
> http://groups.google.com/group/django-users/msg/0f3f9d729413ee32

Thak you for quick answer Malcolm.

Regards
Michal

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Important : VOTE FOR TAJ MAHAL, RESULT ON 07.07.07

2007-06-21 Thread Babita

HI,

VOTE FOR TAJ MAHAL NOW, ITS IN THE FINALS FOR NEW SEVEN WONDERS OF THE
WORLD. SHOW YOUR TRUE SPIRIT FOR INDIA. ITS NOW OR NEVER.

BE A PART OF THE WORLD'S LARGEST VOTING FOR THE NEW 7 WONDERS OF THE
WORLD.
RESULT WILL BE DECLARED ON 7TH JULY 2007.

www.chulbul.com/taj.htm

DON'T FORGET TO FORWARD THIS MAIL TO YOUR FRIENDS...



REGARDS


A TRUE INDIAN


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL query with LIKE statement

2007-06-21 Thread Malcolm Tredinnick

On Thu, 2007-06-21 at 13:47 +0200, Michal wrote:
> Hello,
> I need to write some custom SQL in Django:
> 
>from django.db import connection
>cursor = connection.cursor()
>cursor.execute("SELECT note FROM journals_journal WHERE LENGTH(note) 
>  > 0 AND note LIKE %s GROUP BY note ORDER BY note;", [q+'%'])
> 
> where q is string, for example 'foo'.
> 
> I have problems with it so I print out connection.queries and I was 
> suprised, because foo% wasn't surrounded by ' or " :
> 
>SELECT note FROM journals_journal WHERE LENGTH(note) > 0 AND note 
> LIKE foo% GROUP BY note ORDER BY note;'
> 
> Is this normal? Isn't there possibility for SQL inject?

No, because of the reason described in this email: 

http://groups.google.com/group/django-users/msg/0f3f9d729413ee32

Regards,
Malcolm



--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom SQL query with LIKE statement

2007-06-21 Thread Michal

Hello,
I need to write some custom SQL in Django:

   from django.db import connection
   cursor = connection.cursor()
   cursor.execute("SELECT note FROM journals_journal WHERE LENGTH(note) 
 > 0 AND note LIKE %s GROUP BY note ORDER BY note;", [q+'%'])

where q is string, for example 'foo'.

I have problems with it so I print out connection.queries and I was 
suprised, because foo% wasn't surrounded by ' or " :

   SELECT note FROM journals_journal WHERE LENGTH(note) > 0 AND note 
LIKE foo% GROUP BY note ORDER BY note;'

Is this normal? Isn't there possibility for SQL inject?


Regards
Michal

PS: I am using PostgreSQL 7.4.12 and psycopg-1.1.21

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Graphs and django

2007-06-21 Thread Kent Johnson

Martin Winkler wrote:
> If you want do do really nice graphs, you might take a look at some
> screenshots of matplotlib:
> http://matplotlib.sourceforge.net/screenshots.html
> 
> The module is quite large, but has really many functions: from simple
> pie charts (3D too) up to finance charts which gets data from
> finance.yahoo.com
> 
> I took quite some time until I figured how matplotlib/pylab works, but
> eventually I succeeded. Hopefully you'll get to some good results
> faster than me :)

I had a similar experience with matplotlib. The docs are not always too 
easy to understand so you have to do some digging and experimenting but 
it is very flexible  and powerful and the resulting charts are good quality.

A recipe here shows how to return a matplotlib image in a Django response:
http://www.scipy.org/Cookbook/Matplotlib/Django

Kent


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Bug with regroup ? (which does not regroup as he shoud / I hope...)

2007-06-21 Thread Nicolas Steinmetz

Nicolas Steinmetz a écrit :
> Nicolas Steinmetz a écrit :
> [...]
> 
>> I tried this but the bug persists. Sometimes it works well (technical 
>> skills are well regrouped by technical domaines) but if I refresh, it's 
>> no longer the case.
>>
>> I even tried this on an easier object and it does not work more 
>> efficiently (user_skill in my view). If I do not add .order_by() in the 
>> view, and add the |dictsort:"" filter, I have the same bug. If I add the 
>> order_by() and the dictsort filter, bug remains. It only works well if I 
>> add the order_by() and remove the dictsort filter.
>>
>> However for the 1st object on which I had the bug, I cannot sort it in 
>> my views unless I decompose my model...
>>
>> Any other clue ?
> 
> So should I fill a ticket or do I make something wrong ?

small up before filling tickets :)

For a more readable view on my files :

 
(line 38 > 138)

 
(lines 108/116)


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Deryck Hodge

On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have two sites configured just like the configuration below (except
> with different ServerName directives and different
> DJANGO_SETTINGS_MODULE variables.  The trouble is that Django's cache
> is confusing the two sites and is saying that one table from a project
> doesn't exist in the other project's db when I try to access it!

Are you using the site-wide cache, and did you set your
CACHE_MIDDLEWARE_KEY_PREFIX?  See that setting under
http://www.djangoproject.com/documentation/cache/#the-per-site-cache.
If you're not using caching site-wide, explain more about how you're
using caching and how it's getting confused.

Cheers,
deryck

-- 
Deryck Hodge
Lead Developer, Product Development
Washington Post.Newsweek Interactive

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hypothetical: Customizable Member Pages

2007-06-21 Thread Merric Mercer

We've taken the approach using cookies.   The value of the cookies is 
returned to the template via a simple context processor.  Each
cookie then simply refers to a stylesheet,  which can change the whole 
look and feel of the site.  Very straightforward.

MerMer

James Bennett wrote:
> On 6/20/07, Bryan Veloso <[EMAIL PROTECTED]> wrote:
>   
>> This feature is a show-stopper, since the market I'll be gearing this
>> to almost requires features like this to be there.  So am I dreaming
>> that this can be done? Has anybody else attempted something like this
>> yet?
>> 
>
> It should be relatively easy; look at Chapter 12 of the Django book,
> which covers extending the auth system with a custom profile model.
> You'll want to develop a model which includes the ability for users to
> specify whatever styles/customizations are needed (along with any
> other information you want to collect), and use that as the profile
> model. Then the 'get_profile()' method on each User will return the
> appropriate object which you can look at to determine how to display
> the user's customized page.
>
>   

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How reliable is using Ajax?

2007-06-21 Thread Aidas Bendoraitis

Have you restarted your webserver after updating your views? If you
are using mod_python, it sometimes shows a newer version of the code
and sometimes - the earlier.
Also install Firebug add-on for your Firefox browser and check the
requests and responses. It might show you the problem.
AJAX is as stable as you make it, as well as any other technologies.

Regards,
Aidas Bendoraitis aka Archatas

On 6/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have been tinkering with Ajax today, based on this tutorial:
> http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1
>
> I've noticed that my form submission seems to randomly fail ... the
> line  var response_obj = eval('(' + o.responseText + ')'); errors out
> in my javascript... then if I wait 10 minutes or so... it starts
> automagically working again... without changing any code.
>
> I'm pretty much doing everything the same as this guy.  I'm new to
> AJAX though... so if anyone has any idea why it would randomly fail,
> please enlighten me :)
>
>
> >
>

--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: virtualhosts, mod_python, and Django's cache

2007-06-21 Thread Graham Dumpleton

On Jun 21, 5:46 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote
> On 21-Jun-07, at 12:50 PM, [EMAIL PROTECTED] wrote:
>
> > cache gets confused.  But if I do that, the settings don't work
> > correctly and the site won't load.  What am I doing wrong?
>
> you need a pythonInterpretor line in each Location with a different
> name. It is in the documentation

Not true if each is in its own VirtualHost as the default behaviour of
mod_python is to give each VirtualHost its own sub interpreter. You
should only need to set PythonInterpreter if you were running two
Django instances within the same VirtualHost at different mount
points.

For completeness, it would help if OP posted both VirtualHost
configurations side by side in the same message, so one can see
properly the PythonPath setting for each and the
DJANGO_SETTINGS_MODULE setting.

BTW, if using recent mod_python, to confirm that distinct Python sub
interpreters are being used one can use:

  from mod_python import apache
  apache.log_error("INTERPRETER %s" % apache.interpreter)

Then check the Apache error log file.

I would also suggest printing the value of sys.path to make sure it is
what you expect.

More importantly, when you say "Django's cache is confusing the two
sites and is saying that one table from a project doesn't exist in the
other project's db", can you post the actual full message you are
getting, and state where you are getting it. If it has a traceback,
also include the traceback.

Graham


--~--~-~--~~~---~--~~
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms and File (image) upload

2007-06-21 Thread SanPy

The view should be like this, btw:

def photo_upload(request):
form = PhotoUploadForm()
if request.POST:
form = PhotoUploadForm(request.user, request.POST,
request.FILES)
if form.is_valid():
form.save()
json = {'status': 'success', 'message': _("Upload
succeeded.")}
return JsonResponse(json)
json = jsonify(form)
return JsonResponse(json)

On 21 jun, 10:32, SanPy <[EMAIL PROTECTED]> wrote:
> Here are some code samples. Functionality may change in the future:
>
> class PhotoUploadForm(newforms.Form):
> item_id =
> newforms.IntegerField(widget=newforms.widgets.HiddenInput)
> photo   = newforms.ImageField(label=_('photo'),
> widget=newforms.widgets.FileInput)
>
> def __init__(self, user, *args, **kwargs):
> super(PhotoUploadForm, self).__init__(*args, **kwargs)
> self.user = user
> self.item = None
>
> def clean_item_id(self):
> item_id = int(self.cleaned_data.get('item_id'))
> try:
> self.item = Item.on_site.get(pk=item_id)
> except Item.DoesNotExist:
> raise newforms.ValidationError(_("Invalid input."))
> return item_id
>
> def clean(self):
> if self.item.user != self.user:
> raise newforms.ValidationError(_("You are not allowed to
> upload photos for this item."))
> nr_of_images = self.item.photo_set.count()
> if nr_of_images >= MAXIMUM_IMAGES_PER_ITEM:
> raise newforms.ValidationError(_("Maximum number of photos
> reached for this item."))
> return self.cleaned_data
>
> def save(self):
> photo = Photo()
> photo.item = self.item
> if not self.item.photo_set.filter(**{'main' : True}):
> photo.main = True
> uploaded_file = self.cleaned_data['photo']
> content = uploaded_file.content
> photo.save_image_file(uploaded_file.filename, content)
> photo.size = len(content)
> photo.save()
>
> And the view (replace JsonResponse with HttpResponse). JsonResponse
> and jsonify are custom, not included in the django source:
>
> def photo_upload(request):
> if request.POST:
> form = PhotoUploadForm(request.user, request.POST,
> request.FILES)
> if form.is_valid():
> form.save()
> json = {'status': 'success', 'message': _("Upload
> succeeded.")}
> return JsonResponse(json)
> form = PhotoUploadForm()
> json = jsonify(form)
> return JsonResponse(json)
>
> Regards, Sander.
>
> On 20 jun, 22:19, SanPy <[EMAIL PROTECTED]> wrote:
>
> > Dirk,
>
> > File and image uploading for newforms, AFAIK, is not implemented in
> > 0.96. There is a ticket for this (#3297). If you look in the django-
> > developers newsgroup and search for #3297, you will find more
> > information. It is possible to have it working with the latest trunk
> > from SVN and a patch from #3297. It works fine on my machine with the
> > latest trunk and patch.
>
> > Als je er niet uitkomt, laat het hier dan even weten, dan geef ik je
> > wat code voorbeelden.
>
> > Groet, Sander.
>
> > On 20 jun, 18:15, "Dirk van Oosterbosch, IR labs" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hello,
>
> > > I'm starting with Django, so I was adviced to use the newforms. But I
> > > can't just figure out how to correctly upload images (or other files
> > > for that matter). I heard that there was already much discussion on
> > > this list, but on groups.google.com I couldn't find any pointers.
>
> > > I tried out two code examples from blogs, but get stuck with both.
>
> > > First I tried this 
> > > one:http://www.oluyede.org/blog/2007/03/18/django-image-uploading-
> > > validation-and-newforms/
> > > The strange thing about this example is that part of the validation
> > > happens in the view (not in the clean_photo method of the Form).
> > > I got stuck with this, because this (line 6 , in views):
> > >  img = Image.open(StringIO(request.FILES['photo']
> > > ['content']))
> > > kept failing. I would like to test this behavior of Image in the
> > > django shell, but wouldn't know how.
>
> > > Then I triedhttp://batiste.dosimple.ch/blog/2007-05-13-1/
> > > which claims to be based on the former example, but seems quite
> > > different to me. Probably the reason why I can't get this to work is
> > > my lack of understanding the monkey-patching business.
> > > The strange thing here (i.e. the part where I get lost), is that the
> > > clean_avatar method takes two arguments clean_avatar(self, value),
> > > but I have no idea where this other argument should be coming from.
> > > (Django has the same problem: TypeError at /upload/  clean_photo()
> > > takes exactly 2 arguments (1 given))
>
> > > I'm using 0.96
>
> > > I was hoping you guys could lead me towards working image upload. ;-)
>
> > > best
> > > dirk
>
> > > -
> > > Dirk van Oosterbosch
> > > de Wittenstraat 225
> 

  1   2   >