duplicate post_save signals

2010-08-17 Thread Kenneth Gonsalves
hi,

I am using a two post_save signal handlers for two different models. On
certain conditions they have to send emails to me and others. At times
one signal is generated, at other times two or even in one instance 4
signals were generated, which results in duplicate and triplicate
emails. Has anyone faced this problem?
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: CSRF verification failures (admin)

2010-08-17 Thread James Saxon
I've run into a similar situation where I'm getting CSRF errors
inconsistently.  I made sure I had the token and that I was using
RequestContext.  I haven't found out exactly what's wrong yet...

I have not run into the situation in the admin but I have not tried it much
but I haven't changed any admin templates.

It does seem to be something happening on the testing server but not on my
mac in dev

Hmmm..

On Tue, Aug 17, 2010 at 11:20 PM, PieterB  wrote:

> No I did not.
> I've only a modified (created) admin.py for each app in the project.
>
> Maybe this is also important: we use a proxy, maybe it's something
> with the cache?
> What can cause csrf verification to go crazy?
>
>
> On 17 aug, 15:58, Alex Robbins  wrote:
> > Have you done any admin template customization? If you copied a
> > template from django before 1.2, then upgraded, your admin template
> > might be missing the csrf_token template tag.
> >
> > Alex
> >
> > On Aug 17, 7:55 am, PieterB  wrote:
> >
> > > For an internal application, I constantly receiveCSRFverification
> > > failed" errors... most of the times when using the admin interface
> >
> > > It doesn't happen with the local dev version (dev http server) but
> > > happens with the deployment version (custom port, cherokee web server)
> >
> > > I can only use the admin interface (very) temporarily with a Clear
> > > Recent History command
> >
> > > This is very annoying :-S
> >
> > > I've included
> > > 'django.middleware.csrf.CsrfViewMiddleware',
> > > 'django.middleware.csrf.CsrfResponseMiddleware'
> >
> > > What am I doing wrong? Do I need also some sort of token for Django's
> > > admin interface?
> >
> > > -- PieterB
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
J A M E S   B E N N E T T   S A X O N  ja...@saxon.com
Biz: 310.823.0545 - Cell: 310.722.2785

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: CSRF verification failures (admin)

2010-08-17 Thread PieterB
No I did not.
I've only a modified (created) admin.py for each app in the project.

Maybe this is also important: we use a proxy, maybe it's something
with the cache?
What can cause csrf verification to go crazy?


On 17 aug, 15:58, Alex Robbins  wrote:
> Have you done any admin template customization? If you copied a
> template from django before 1.2, then upgraded, your admin template
> might be missing the csrf_token template tag.
>
> Alex
>
> On Aug 17, 7:55 am, PieterB  wrote:
>
> > For an internal application, I constantly receiveCSRFverification
> > failed" errors... most of the times when using the admin interface
>
> > It doesn't happen with the local dev version (dev http server) but
> > happens with the deployment version (custom port, cherokee web server)
>
> > I can only use the admin interface (very) temporarily with a Clear
> > Recent History command
>
> > This is very annoying :-S
>
> > I've included
> > 'django.middleware.csrf.CsrfViewMiddleware',
> > 'django.middleware.csrf.CsrfResponseMiddleware'
>
> > What am I doing wrong? Do I need also some sort of token for Django's
> > admin interface?
>
> > -- PieterB

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: geodjango: windows installer for geos dependency?

2010-08-17 Thread Sam Lai
Quick Google tells me that PostGIS contains GEOS 3.2.0. I know you're
not using PostgreSQL, but installing that might do the trick, or if
you don't want to pollute your server, you can probably extract it
from the setup somehow.

http://postgis.refractions.net/download/windows/#windbinaries

On 18 August 2010 03:33, Reinout van Rees  wrote:
> Hi,
>
> (I also mailed the mapnik user list with this problem, not sure what the
> best place is)
>
> I have to install my geodjango app on a windows server for a specific
> customer.  After one day, I've almost got it working.
>
> Remaining problem: the geo database is oracle, so apparently I need the
> "geos" library. The error I'm getting is:
>
> ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".
>
> Well, I didn't install the geos library yet, so that could be it. But I
> cannot find a windows installer for that. Either I'm blind or nobody uses
> oracle+geo stuff on windows :-)
>
> a) Do I really need that geos library? Or could there be something wrong
> with the oracle installation (like missing geo templates whatever).
>
> b) Where can I grab a windows installer for GEOS? I only see mentions of
> binary packages for osx and linux, none for windows.
>
>
> Reinout
>
> --
> Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
> Programmer at http://www.nelen-schuurmans.nl
> "Military engineers build missiles. Civil engineers build targets"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Kenneth Gonsalves
On Tue, 2010-08-17 at 23:05 -0700, Tang Daogang wrote:
> Emm, that's it. I want to find one file acting like Boot.scala of Lift
> within Django, but failed. If there is one file like that, I will put
> my plugins registering codes into it, thus, when I type "python
> manage.py runserver", it can be executed automatically and only once. 

this is ok if you are using runserver - but in production you will not
be using runserver, so how will you do this? Django is a webframework
not a server like zope or tomcat or whatever. Runserver is available
just to help development in a rapid manner, it is not part of the django
framework.
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Tang Daogang
hi, Emily,

Let me introduce Scala/Lift as example.

Every lift project has a file named 'Boot.scala', this file will only
be executed once when this project boots up. In this file, we can
write some initial codes to initial project and some userdefined
structures.

Emm, that's it. I want to find one file acting like Boot.scala of Lift
within Django, but failed. If there is one file like that, I will put
my plugins registering codes into it, thus, when I type "python
manage.py runserver", it can be executed automatically and only once.
By it, my plugins can be registered when app boot up.

Do you understand my meaning? Welcome suggestion.


On 8月17日, 下午8时45分, Emily Rodgers  wrote:
> On Aug 17, 2:26 am, Tang Daogang  wrote:
>
> > Dear all,
>
> > Recently, I have developed a plugin system for my app, and I want to
> > register those plugins when my app boot up, this need to execute some
> > user defined codes (functions) in app boot procedure, I don't know
> > where insert my registering codes to, anyone can help?
>
> > Thank you.
>
> Hi,
>
> I don't know how to help you, but I think it is because you haven't
> explained what you want to do thoroughly enough.
>
> What do you mean by a plugin system, and what do you mean by
> registering them with the app on boot up? Are you talking about
> including another python module in your code? Or perhaps including
> another django app in your code?
>
> Can you give us a bit more information (and maybe examples) of what
> you are trying to do.
>
> Cheers,
> Em

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Tang Daogang
Mathieu,

What you said prompt me some idea: If I write my plugin registering
codes into a middleware, and load it in django's settings.py, will it
executed when app boot up?

On 8月17日, 下午11时51分, Mathieu Leduc-Hamel  wrote:
> Paul, no it's not exactly the point. When you said some code on the boot up
> it means really a piece of code shared by everyone and executed just one
> time, by example, for mod_wsgi it would be when apache is starting.
>
> That's exactly what's done in the Pylons world to be able to load some piece
> of code like the different middleware initialization. It could be useful
> when you need launch some external long running process or anything like
> that.
>
> But putting the code anywhere cause it would be evaluated when the code is
> loaded is not safe cause you don't if everything was correctly loaded a this
> time...
>
>
>
> On Tue, Aug 17, 2010 at 5:13 PM, Paul Winkler  wrote:
> > Seems to me that "on boot up" doesn't mean anything in a shared-
> > nothing architecture like Django's.  For example if you deploy on eg.
> > mod_wsgi.
> > You have no idea how long any particular thread or process is going to
> > live,
> > and no idea how often this "boot" code would get run.
>
> > But assuming that's OK, one naive strategy would be to just call the
> > function(s) at top level in some module that gets imported by your
> > app.
> > Good enough?
>
> > On Aug 17, 9:12 am, Mathieu Leduc-Hamel  wrote:
> > > Tang,
>
> > > do you mean :
>
> > > "How to execute some pieces of code when you launch the "runserver"
> > command
> > > by example" ? If this is what you mean, it's not a easy thing to do right
> > > now. Then only way i found it possible is by using: twod.wsgi
>
> > > With twod.wsgi you can use the entry points system of python and do, like
> > in
> > > Pylons, an entry defined by Paster "app_factory"
>
> > > You can see an example there:
> >http://packages.python.org/twod.wsgi/manual/paste-factory.html#using-...
>
> > > mathieu
>
> > > On Tue, Aug 17, 2010 at 2:45 PM, Emily Rodgers <
> > emily.kate.rodg...@gmail.com
>
> > > > wrote:
> > > > On Aug 17, 2:26 am, Tang Daogang  wrote:
> > > > > Dear all,
>
> > > > > Recently, I have developed a plugin system for my app, and I want to
> > > > > register those plugins when my app boot up, this need to execute some
> > > > > user defined codes (functions) in app boot procedure, I don't know
> > > > > where insert my registering codes to, anyone can help?
>
> > > > > Thank you.
>
> > > > Hi,
>
> > > > I don't know how to help you, but I think it is because you haven't
> > > > explained what you want to do thoroughly enough.
>
> > > > What do you mean by a plugin system, and what do you mean by
> > > > registering them with the app on boot up? Are you talking about
> > > > including another python module in your code? Or perhaps including
> > > > another django app in your code?
>
> > > > Can you give us a bit more information (and maybe examples) of what
> > > > you are trying to do.
>
> > > > Cheers,
> > > > Em
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com
> > 
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.- 隐藏被引用文字 -
>
> - 显示引用的文字 -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Migration: AlreadyRegistered

2010-08-17 Thread Sam Lai
This error looks like an import error in disguise. (
http://code.djangoproject.com/browser/django/tags/releases/1.2.1/django/utils/importlib.py
)

Fire up the python interpreter shell, and trying importing the
django.contrib.admin module manually and see if you get any errors.

Django seems to be installed ok according to your python path. Are you using
virtualenv at all?

On 18 August 2010 12:23, Christos Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> I realized there may have been some pre-existing stuff in the directory, so
> I renamed it and extracted fresh from tarball. I got an error I had seen
> earlier but couldn't reproduce:
>
> AttributeError at /
>
> 'module' object has no attribute 'register'
>
>  Request Method:GET Request URL:http://localhost:8000/ Django Version:
> 1.2.1 Exception Type:AttributeError Exception Value:
>
> 'module' object has no attribute 'register'
>
>  Exception 
> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/importlib.py
> in import_module, line 35 Python Executable:/usr/bin/python Python
> Version:2.6.1 Python Path:['/Users/jonathan/directory',
> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
> '/Library/Python/2.6/site-packages',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
>  Server
> time:Tue, 17 Aug 2010 21:20:53 -0500
>
> On Tue, Aug 17, 2010 at 8:39 PM, Christos Jonathan Hayward <
> christos.jonathan.hayw...@gmail.com> wrote:
>
>> Thank you; I'm not seeing how. My admin.py reads:
>>
>> import django.contrib.admin
>> import directory.models
>> import tagging
>>
>> django.contrib.admin.autodiscover()
>> django.contrib.admin.site.register(directory.models.Entity)
>> django.contrib.admin.site.register(directory.models.Location)
>> tagging.register(directory.models.Entity)
>>
>>
>> Commenting the tagging.register() call doesn't seem to make a difference.
>>
>> On Tue, Aug 17, 2010 at 8:27 PM, Sam Lai  wrote:
>>
>>> It means somehow you're calling this line in an admin.py file twice -
>>>
>>> admin.site.register(Entity)
>>>
>>> Check the admin.py file for the app that contains the Entity model.
>>>
>>> On 18 August 2010 10:57, Christos Jonathan Hayward <
>>> christos.jonathan.hayw...@gmail.com> wrote:
>>>
 I am trying to migrate from one server to another: I tarred it up on the
 Linux server, untarred on a Mac, got one or two complaints about missing
 packages, and when I had resolved them, got the error below.

 Entity is the name of one of my models. What does this mean, and how is
 this issue addressed? (I had been actively developing on the old server and
 don't remember seeing this error.)

 AlreadyRegistered at /

 The model Entity is already registered

  Request Method:GET Request URL:http://localhost:8000/ Django Version:
 1.2.1 Exception Type:AlreadyRegistered Exception Value:

 The model Entity is already registered

 Exception 
 Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py
 in register, line 78 Python Executable:/usr/bin/python Python Version:
 2.6.1 Python Path:['/Users/jonathan/directory',
 '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
 '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
>>

Re: Any job queue systems that integrates with Django & allow scheduling jobs by date?

2010-08-17 Thread Rohan Jain
i think what you need is http://code.google.com/p/django-cron/

Also you may want to check out http://celeryq.org/ if you want to do
parallel processing,
distribute jobs to other computers to ease the web server load.

On Aug 18, 5:10 am, Andy  wrote:
> I have a Django application.
>
> One of my models looks like this:
>
>     class MyModel(models.Model):
>
>         def house_cleaning(self):
>         // cleaning up data of the model instance
>
> Every time when I update an instance of MyModel, I'd need to clean up
> the data N days later. So I'd like to schedule a job to call
>
>     this_instance.house_cleaning()
>
> N days from now.
>
> Is there any job queue that would allow me to:
>
>  - Integrate well with Django - allow me to call a method of
> individual model instances
>  - Only run jobs that are scheduled to run today
>  - Ideally handle failures gracefully
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: /path/to/project

2010-08-17 Thread Kenneth Gonsalves
On Wed, 2010-08-18 at 10:19 +0530, Kenneth Gonsalves wrote:
> On Tue, 2010-08-17 at 22:14 -0300, Alex s wrote:
> > 
> > Using your example '/home/alex/projects/' need to be replaced by:
> > "WSGIScriptAlias / /home/alex/projects/mysite/apache/django.wsgi"
> > 
> > Rigth? 
> 
> wrong - /home/alex/projects/mysite/apache/ 

sorry - what you have said is correct in this context. But normally for
wsgi, the path to project would lead only to the parent directory of the
project - this is actually 'path/to/scriptfile/ which obviously include
the name of the file
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: /path/to/project

2010-08-17 Thread Kenneth Gonsalves
On Tue, 2010-08-17 at 22:14 -0300, Alex s wrote:
> 
> Using your example '/home/alex/projects/' need to be replaced by:
> "WSGIScriptAlias / /home/alex/projects/mysite/apache/django.wsgi"
> 
> Rigth? 

wrong - /home/alex/projects/mysite/apache/
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: utf-8 encoding not working with mysql

2010-08-17 Thread adam
Karen, Thank you very much. Our collation is set to utf8_bin, which
was the source of the problem. Adam

On Aug 17, 9:01 pm, Karen Tracey  wrote:
> 2010/8/17 adam 
>
>
>
>
>
> > When I connect directly to mysql using the mysql client program, I see
> > that my table contains utf-8 data. Here are the environment settings:
>
> > mysql> SHOW VARIABLES LIKE '%character%';
> > [snip]
>
> > However, when I access my model through the django shell, I have
> > problems:
>
> > In [4]: video = models.Video.objects.get(video_id='i265mCSdlsEl')
> > In [5]: video.title
> > Out[5]: '\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
> > \xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
> > In [6]: video.title == u'русский язык'
> > manage.py:1: UnicodeWarning: Unicode equal comparison failed to
> > convert both arguments to Unicode - interpreting them as being unequal
> >  # Universal Subtitles, universalsubtitles.org
> > Out[6]: False
> > In [7]: str = u'русский язык'
> > In [8]: str
> > Out[8]: u'\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
> > \xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
>
> > I'm hoping that there is some obvious solution to this, since we're at
> > our wits' end. Any suggestions would be of great use.
>
> This looks like a collation issue, not a character set issue. You seem to be
> getting bytestrings returned from the database instead of unicode. The only
> way I know to have that happen is to set the collation for the table/column
> to a binary one. See:
>
> http://docs.djangoproject.com/en/dev/ref/databases/#collation-settings
>
> Karen
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Bind variables in Oracle backend - how to use them?

2010-08-17 Thread Ian
On Aug 17, 4:59 pm, buddhasystem  wrote:
> I guess the problem is that I need to use raw queries to provide "hints" to
> Oracle.

There has been some chatter recently on the developers list about
adding support for optimizer hints, but I don't believe the syntax has
settled yet.  For now you're correct in that you'll need to use raw
queries for this.

> The class RawQuerySet does not have the "extra" method, as it appears.

The "extra" method is for adding custom columns, where clauses, etc.
to a query constructed via the Django ORM.  A raw query is written
entirely by the developer, so there is no reason for it to have an
"extra" method.

Cheers,
Ian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Migration: AlreadyRegistered

2010-08-17 Thread Christos Jonathan Hayward
I realized there may have been some pre-existing stuff in the directory, so
I renamed it and extracted fresh from tarball. I got an error I had seen
earlier but couldn't reproduce:

AttributeError at /

'module' object has no attribute 'register'

Request Method:GETRequest URL:http://localhost:8000/Django
Version:1.2.1Exception
Type:AttributeErrorException Value:

'module' object has no attribute 'register'

Exception 
Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/importlib.py
in import_module, line 35Python Executable:/usr/bin/pythonPython Version:
2.6.1Python Path:['/Users/jonathan/directory',
'/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
'/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
'/Library/Python/2.6/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']Server
time:Tue, 17 Aug 2010 21:20:53 -0500
On Tue, Aug 17, 2010 at 8:39 PM, Christos Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> Thank you; I'm not seeing how. My admin.py reads:
>
> import django.contrib.admin
> import directory.models
> import tagging
>
> django.contrib.admin.autodiscover()
> django.contrib.admin.site.register(directory.models.Entity)
> django.contrib.admin.site.register(directory.models.Location)
> tagging.register(directory.models.Entity)
>
>
> Commenting the tagging.register() call doesn't seem to make a difference.
>
> On Tue, Aug 17, 2010 at 8:27 PM, Sam Lai  wrote:
>
>> It means somehow you're calling this line in an admin.py file twice -
>>
>> admin.site.register(Entity)
>>
>> Check the admin.py file for the app that contains the Entity model.
>>
>> On 18 August 2010 10:57, Christos Jonathan Hayward <
>> christos.jonathan.hayw...@gmail.com> wrote:
>>
>>> I am trying to migrate from one server to another: I tarred it up on the
>>> Linux server, untarred on a Mac, got one or two complaints about missing
>>> packages, and when I had resolved them, got the error below.
>>>
>>> Entity is the name of one of my models. What does this mean, and how is
>>> this issue addressed? (I had been actively developing on the old server and
>>> don't remember seeing this error.)
>>>
>>> AlreadyRegistered at /
>>>
>>> The model Entity is already registered
>>>
>>>  Request Method:GET Request URL:http://localhost:8000/ Django Version:
>>> 1.2.1 Exception Type:AlreadyRegistered Exception Value:
>>>
>>> The model Entity is already registered
>>>
>>> Exception 
>>> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py
>>> in register, line 78 Python Executable:/usr/bin/python Python Version:
>>> 2.6.1 Python Path:['/Users/jonathan/directory',
>>> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
>>> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
>>> '/Library/Python/2.6/site-packages',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
>>>  Server
>>> time:Tue, 17 Aug 2010 19:53:40 -0500
>>> --
>>> [image: Christos Jonathan Hayward ← An Orthodox Christian 
>>> author.]
>>> Christos Jonathan Hayward, an Orthodox Christian author.
>>>
>>> Author Bio  • 
>>> Bo

Re: utf-8 encoding not working with mysql

2010-08-17 Thread Karen Tracey
2010/8/17 adam 

> When I connect directly to mysql using the mysql client program, I see
> that my table contains utf-8 data. Here are the environment settings:
>
> mysql> SHOW VARIABLES LIKE '%character%';
> [snip]
>
> However, when I access my model through the django shell, I have
> problems:
>
> In [4]: video = models.Video.objects.get(video_id='i265mCSdlsEl')
> In [5]: video.title
> Out[5]: '\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
> \xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
> In [6]: video.title == u'русский язык'
> manage.py:1: UnicodeWarning: Unicode equal comparison failed to
> convert both arguments to Unicode - interpreting them as being unequal
>  # Universal Subtitles, universalsubtitles.org
> Out[6]: False
> In [7]: str = u'русский язык'
> In [8]: str
> Out[8]: u'\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
> \xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
>
> I'm hoping that there is some obvious solution to this, since we're at
> our wits' end. Any suggestions would be of great use.
>
>
This looks like a collation issue, not a character set issue. You seem to be
getting bytestrings returned from the database instead of unicode. The only
way I know to have that happen is to set the collation for the table/column
to a binary one. See:

http://docs.djangoproject.com/en/dev/ref/databases/#collation-settings

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Migration: AlreadyRegistered

2010-08-17 Thread Christos Jonathan Hayward
Thank you; I'm not seeing how. My admin.py reads:

import django.contrib.admin
import directory.models
import tagging

django.contrib.admin.autodiscover()
django.contrib.admin.site.register(directory.models.Entity)
django.contrib.admin.site.register(directory.models.Location)
tagging.register(directory.models.Entity)


Commenting the tagging.register() call doesn't seem to make a difference.

On Tue, Aug 17, 2010 at 8:27 PM, Sam Lai  wrote:

> It means somehow you're calling this line in an admin.py file twice -
>
> admin.site.register(Entity)
>
> Check the admin.py file for the app that contains the Entity model.
>
> On 18 August 2010 10:57, Christos Jonathan Hayward <
> christos.jonathan.hayw...@gmail.com> wrote:
>
>> I am trying to migrate from one server to another: I tarred it up on the
>> Linux server, untarred on a Mac, got one or two complaints about missing
>> packages, and when I had resolved them, got the error below.
>>
>> Entity is the name of one of my models. What does this mean, and how is
>> this issue addressed? (I had been actively developing on the old server and
>> don't remember seeing this error.)
>>
>> AlreadyRegistered at /
>>
>> The model Entity is already registered
>>
>>  Request Method:GET Request URL:http://localhost:8000/ Django Version:
>> 1.2.1 Exception Type:AlreadyRegistered Exception Value:
>>
>> The model Entity is already registered
>>
>> Exception 
>> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py
>> in register, line 78 Python Executable:/usr/bin/python Python Version:
>> 2.6.1 Python Path:['/Users/jonathan/directory',
>> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
>> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
>> '/Library/Python/2.6/site-packages',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
>>  Server
>> time:Tue, 17 Aug 2010 19:53:40 -0500
>> --
>> [image: Christos Jonathan Hayward ← An Orthodox Christian 
>> author.]
>> Christos Jonathan Hayward, an Orthodox Christian author.
>>
>> Author Bio  • 
>> Books
>>  • *Email * • 
>> Facebook
>>  • LinkedIn  • 
>> Twitter
>>  • *Web * • What's 
>> New?
>> I invite you to visit my "theology, literature, and other creative works"
>> site.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
[image: Christos Jonathan Hayward ← An Orthodox Christian
author.]
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio  • Books
 • *Email * •
Facebook
 • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+u

Re: Migration: AlreadyRegistered

2010-08-17 Thread Sam Lai
It means somehow you're calling this line in an admin.py file twice -

admin.site.register(Entity)

Check the admin.py file for the app that contains the Entity model.

On 18 August 2010 10:57, Christos Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> I am trying to migrate from one server to another: I tarred it up on the
> Linux server, untarred on a Mac, got one or two complaints about missing
> packages, and when I had resolved them, got the error below.
>
> Entity is the name of one of my models. What does this mean, and how is
> this issue addressed? (I had been actively developing on the old server and
> don't remember seeing this error.)
>
> AlreadyRegistered at /
>
> The model Entity is already registered
>
>  Request Method:GET Request URL:http://localhost:8000/ Django Version:
> 1.2.1 Exception Type:AlreadyRegistered Exception Value:
>
> The model Entity is already registered
>
> Exception 
> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py
> in register, line 78 Python Executable:/usr/bin/python Python Version:
> 2.6.1 Python Path:['/Users/jonathan/directory',
> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
> '/Library/Python/2.6/site-packages',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
>  Server
> time:Tue, 17 Aug 2010 19:53:40 -0500
> --
> [image: Christos Jonathan Hayward ← An Orthodox Christian 
> author.]
> Christos Jonathan Hayward, an Orthodox Christian author.
>
> Author Bio  • 
> Books
>  • *Email * • 
> Facebook
>  • LinkedIn  • 
> Twitter
>  • *Web * • What's 
> New?
> I invite you to visit my "theology, literature, and other creative works"
> site.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Setup

2010-08-17 Thread Sam Lai
On 18 August 2010 07:29, Marty  wrote:
> Runing on Windows 7
> First time user of Django and Python.  Got python installed at f:
> \python27,  downloaded DJango tar file.  Used WInRAR to extract.
> Copied all of DJANGO into Python27

You actually don't need to do that; setup.py automatically copies the
files into the right location. There's no harm done, but just a waste
of space sitting in Python27 (although probably too hard now to
identify the Django files and delete them).

For reference in the future, or if someone else stumbles on to this
thread, here's the easiest way to install and use Python + Django on
Windows 7.

1. Download and install ActivePython (it's a Python distribution by
ActiveState specifically designed for Windows).
http://www.activestate.com/activepython/downloads

2. Open up the command prompt (Start -> Accessories -> Command
Prompt). [Sidenote - Windows PowerShell is not the same as the Command
Prompt; similar, but not the same]

3. Type 'pip install Django' (without the quotes) and press ENTER.
Django will start installing. [Sidenote - it will install it into
\Lib\site-packages, but you don't really need to worry
about this.]

4. Navigate to the directory you want your Django code to reside in.
If you don't like using the command prompt, find the directory in
Windows Explorer, hold SHIFT and right-click on the directory. Select
'Open Command Window Here'.

5. Type 'django-admin.py startproject project_name' (without quotes),
replacing project_name with your project name, then press ENTER.

>From here on, you should be able to follow the tutorial as it is
written because ActivePython has set up the Python environment as it
is on *nix systems (i.e. set up file associations for .py files, put
in the right PATH variables etc.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: /path/to/project

2010-08-17 Thread Alex s
So, this instruction..
"WSGIScriptAlias / /path/to/mysite/apache/django.wsgi"

Using your example '/home/alex/projects/' need to be replaced by:
"WSGIScriptAlias / /home/alex/projects/mysite/apache/django.wsgi"

Rigth?

Thanks
Alex


On Tue, Aug 17, 2010 at 9:59 PM, Kenneth Gonsalves wrote:

> On Tue, 2010-08-17 at 21:48 -0300, Alex s wrote:
> > What does "/path/to/project" means ?
>
> if your project is in /home/alex/projects/myproject/
> then /path/to/project/ is '/home/alex/projects/'
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: /path/to/project

2010-08-17 Thread Kenneth Gonsalves
On Tue, 2010-08-17 at 21:48 -0300, Alex s wrote:
> What does "/path/to/project" means ?

if your project is in /home/alex/projects/myproject/
then /path/to/project/ is '/home/alex/projects/'
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Migration: AlreadyRegistered

2010-08-17 Thread Christos Jonathan Hayward
I am trying to migrate from one server to another: I tarred it up on the
Linux server, untarred on a Mac, got one or two complaints about missing
packages, and when I had resolved them, got the error below.

Entity is the name of one of my models. What does this mean, and how is this
issue addressed? (I had been actively developing on the old server and don't
remember seeing this error.)

AlreadyRegistered at /

The model Entity is already registered

Request Method:GETRequest URL:http://localhost:8000/Django
Version:1.2.1Exception
Type:AlreadyRegisteredException Value:

The model Entity is already registered

Exception 
Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py
in register, line 78Python Executable:/usr/bin/pythonPython Version:2.6.1Python
Path:['/Users/jonathan/directory',
'/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
'/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
'/Library/Python/2.6/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']Server
time:Tue, 17 Aug 2010 19:53:40 -0500
-- 
[image: Christos Jonathan Hayward ← An Orthodox Christian
author.]
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio  • Books
 • *Email * •
Facebook
 • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



/path/to/project

2010-08-17 Thread Alex s
Hi People

What does "/path/to/project" means ?

Thanks
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Any job queue systems that integrates with Django & allow scheduling jobs by date?

2010-08-17 Thread Andy
I have a Django application.

One of my models looks like this:

class MyModel(models.Model):

def house_cleaning(self):
// cleaning up data of the model instance

Every time when I update an instance of MyModel, I'd need to clean up
the data N days later. So I'd like to schedule a job to call

this_instance.house_cleaning()

N days from now.

Is there any job queue that would allow me to:

 - Integrate well with Django - allow me to call a method of
individual model instances
 - Only run jobs that are scheduled to run today
 - Ideally handle failures gracefully

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to automatically insert user_id in admin

2010-08-17 Thread Martin Tiršel

Hello,

I need to auto-fill currently logged in user in admin after saving a  
model, but can not find a solution :( In save method of a model is no  
access to the HttpRequest object, so I don't know how to get the User.


I found a "solution" with Modelform  
(http://stackoverflow.com/questions/862522/django-populate-user-id-when-saving-a-model),  
but this is not working, __init__ method of MyCustomModelForm has no  
request object in arguments:



class TaskAdmin(admin.ModelAdmin):
exclude = ('user', )
form = TaskForm


class TaskForm(ModelForm):
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
return super(TaskForm, self).__init__(*args, **kwargs)

def save(self, *args, **kwargs):
kwargs['commit'] = False
obj = super(TaskForm, self).save(*args, **kwargs)
if self.request:
obj.user = self.request.user
obj.save()

class Meta:
model = Task

kwargs in __init__ is empty

Thanks,
Martin

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



utf-8 encoding not working with mysql

2010-08-17 Thread adam
When I connect directly to mysql using the mysql client program, I see
that my table contains utf-8 data. Here are the environment settings:

mysql> SHOW VARIABLES LIKE '%character%';
+--
+-+
| Variable_name|
Value   |
+--
+-+
| character_set_client |
utf8|
| character_set_connection |
utf8|
| character_set_database   |
utf8|
| character_set_filesystem |
binary  |
| character_set_results|
utf8|
| character_set_server |
utf8|
| character_set_system |
utf8|
| character_sets_dir   | /rdsdbbin/mysql-5.1.45.R1/share/mysql/
charsets/ |
+--
+-+
8 rows in set (0.00 sec)

However, when I access my model through the django shell, I have
problems:

In [4]: video = models.Video.objects.get(video_id='i265mCSdlsEl')
In [5]: video.title
Out[5]: '\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
\xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
In [6]: video.title == u'русский язык'
manage.py:1: UnicodeWarning: Unicode equal comparison failed to
convert both arguments to Unicode - interpreting them as being unequal
  # Universal Subtitles, universalsubtitles.org
Out[6]: False
In [7]: str = u'русский язык'
In [8]: str
Out[8]: u'\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
\xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'

I'm hoping that there is some obvious solution to this, since we're at
our wits' end. Any suggestions would be of great use.

Thank you,
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Setup

2010-08-17 Thread Steve Holden
On 8/17/2010 5:29 PM, Marty wrote:
> Runing on Windows 7
> First time user of Django and Python.  Got python installed at f:
> \python27,  downloaded DJango tar file.  Used WInRAR to extract.
> Copied all of DJANGO into Python27
> 
> Ran python setup.py install
> 
> Tutorial one says:
> 
>>From the command line, cd into a directory where you’d like to store
> your code, then run the command django-admin.py startproject mysite.
> This will create a mysite directory in your current directory
> 
> Do I need to add somethgni to my path?
> 
> django-admin.py is not an executable?
> 
> Am I suposed to be in the pyrhon interpreter?
> 
Oops. Sorry, read "manage.py" where you said "django-admin.py". Please
ignore the first response.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Setup

2010-08-17 Thread Steve Holden
On 8/17/2010 5:29 PM, Marty wrote:
> Runing on Windows 7
> First time user of Django and Python.  Got python installed at f:
> \python27,  downloaded DJango tar file.  Used WInRAR to extract.
> Copied all of DJANGO into Python27
> 
> Ran python setup.py install
> 
> Tutorial one says:
> 
>>From the command line, cd into a directory where you’d like to store
> your code, then run the command django-admin.py startproject mysite.
> This will create a mysite directory in your current directory
> 
> Do I need to add somethgni to my path?
> 
> django-admin.py is not an executable?
> 
> Am I suposed to be in the pyrhon interpreter?
> 
Usually you just invoke the python interpreter with the arguments given,
as in

  python django-admin.py startproject mysite

This should work, because python is available (otherwise you would not
have been able to run setup.py as you did).

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Setup

2010-08-17 Thread cootetom
django-admin.py is usually located in the bin directory of the django
source. You can use it from there but you need to also say:

python django-admin.py startproject mysite

You must use the python interpreter in order to run a .py file. Hope
that helps.




On Aug 17, 10:29 pm, Marty  wrote:
> Runing on Windows 7
> First time user of Django and Python.  Got python installed at f:
> \python27,  downloaded DJango tar file.  Used WInRAR to extract.
> Copied all of DJANGO into Python27
>
> Ran python setup.py install
>
> Tutorial one says:
>
> From the command line, cd into a directory where you’d like to store
> your code, then run the command django-admin.py startproject mysite.
> This will create a mysite directory in your current directory
>
> Do I need to add somethgni to my path?
>
> django-admin.py is not an executable?
>
> Am I suposed to be in the pyrhon interpreter?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django Setup

2010-08-17 Thread Marty
Runing on Windows 7
First time user of Django and Python.  Got python installed at f:
\python27,  downloaded DJango tar file.  Used WInRAR to extract.
Copied all of DJANGO into Python27

Ran python setup.py install

Tutorial one says:

>From the command line, cd into a directory where you’d like to store
your code, then run the command django-admin.py startproject mysite.
This will create a mysite directory in your current directory

Do I need to add somethgni to my path?

django-admin.py is not an executable?

Am I suposed to be in the pyrhon interpreter?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can I simply disable the CSRF? crazy

2010-08-17 Thread Karim Gorjux
On Tue, Aug 17, 2010 at 23:29, Rolando Espinoza La Fuente
 wrote:
> See csrf_exempt decorator:
> http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#exceptions

I had problems too, but the decorator is a good patch for the moment :-)

Thanks!

-- 
Karim Gojux
www.karimblog.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Bind variables in Oracle backend - how to use them?

2010-08-17 Thread buddhasystem

I guess the problem is that I need to use raw queries to provide "hints" to
Oracle.
The class RawQuerySet does not have the "extra" method, as it appears.



Ian Kelly-2 wrote:
> 
> On Aug 13, 11:04 am, buddhasystem  wrote:
>> Friends,
>>
>> I'm in need of an implementation which calls for using bind variables (in
>> Oracle sense, not generic) in my SQL in a Django application.
>>
>> Any experience with that, anyone?
> 
> To use raw SQL with Django, see:
> http://docs.djangoproject.com/en/1.2/topics/db/sql/#topics-db-sql
> 
> To add parameters to an ordinary Django query, use the
> QuerySet.extra() method
> http://docs.djangoproject.com/en/1.2/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none
> 
> Note that Django placeholders always use the %s syntax regardless of
> backend, so you'll need to use that rather than the named syntax
> normally used with Oracle.
> 
> HTH,
> Ian
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Bind-variables-in-Oracle-backend---how-to-use-them--tp29431038p29449301.html
Sent from the django-users mailing list archive at Nabble.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: project management app

2010-08-17 Thread chris hendrix
yeah i couldn't get it installed either.  I'm wondering if the project 
was abandoned or something.  I don't have time to contribute anything in 
regard to programming at the moment due to starting up a web design 
firm.  However, i'd love to help you flesh out ideas or be a beta tester 
for you... keep me posted!



chris

On 08/17/2010 04:35 PM, tiemonster wrote:

I was unable to get the code working. I'm developing a project
management application for Django if you're interested in
contributing.

On Aug 16, 2:27 pm, Bobby Roberts  wrote:
   

hi all.

I've foundhttp://code.google.com/p/django-project-management/out
there as a project management app but have yet to install it and see
what all it can do.  Has anyone installed this and do you have an
opinion on it?  Is there anything else out there for project
management?
 
   


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: project management app

2010-08-17 Thread tiemonster
I was unable to get the code working. I'm developing a project
management application for Django if you're interested in
contributing.

On Aug 16, 2:27 pm, Bobby Roberts  wrote:
> hi all.
>
> I've foundhttp://code.google.com/p/django-project-management/out
> there as a project management app but have yet to install it and see
> what all it can do.  Has anyone installed this and do you have an
> opinion on it?  Is there anything else out there for project
> management?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can I simply disable the CSRF? crazy

2010-08-17 Thread Rolando Espinoza La Fuente
On Tue, Aug 17, 2010 at 8:01 AM, chenge  wrote:
> I'm new to django. CSRF let me crazy!

Can't use {% csrf_token %} tag inside your 's?

See csrf_exempt decorator:
http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#exceptions

Regards,


Rolando Espinoza La fuente
www.insophia.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: To make a basecamp like - project management site

2010-08-17 Thread tiemonster
Without help, a feature-complete first release would probably be in
January. I might push some code to svn by the end of the month. Like I
said, though, if there is interest in contributing, something can be
worked out. It's a simple GTD type of app, but could certainly be
extended to include other features. I'm going to be fairly stingy on
what features to include, but would welcome forking once the initial
version is released.

On Aug 15, 10:16 am, Baurzhan Ismagulov  wrote:
> On Sun, Aug 15, 2010 at 07:02:58AM -0700, tiemonster wrote:
> > I'm working on a GPL project management application for Django, and
> > would welcome contribution. I have a working codebase that is by no
> > means feature complete. If you're interested in contributing, please
> > contact me directly and I can make arrangements for us to collaborate.
> > I plan on some heavy development on this application in September,
> > with an initial subpoint release at the end of the month. Let me know.
>
> Any possibility to see the code?
>
> With kind regards,
> Baurzhan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



project management app suggestion

2010-08-17 Thread Bobby Roberts
hi all... there have been posts in the past about project management
apps but all of the threads seem dated by quite a bit.  I am wondering
if there is any project management (ie like basecamp) app out there
that can be easily installed in the django /admin.  Please let me know
if you know of anything.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



URL template tags fail in Tests but work in Dev and Production ( Django 1.2.1 )

2010-08-17 Thread Bryan
I've been trying to add the django-lean app to my project.

I have not been able to get the tests to pass. It took me a few days
with a debugger to determine what the problem was.

It seems that all the URL template tags fail in Test mode, but not in
Production nor Developement.

Failure happens is in django.template.defaulttags.URLNode.render()
line 366:
url = reverse(self.view_name, args=args, kwargs=kwargs,
current_app=context.current_app)

The error message is:
NoReverseMatch: Reverse for 'index' with arguments '()' and keyword
arguments '{}' not found.

If I replace the URL template tag with a relative link, the test just
fails the next time a URL node is encountered.

I have confirmed that:
reverse('index') call works in the shell.

What could be going wrong?

I'm running Python 2.7 with Django 1.2.1

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing parameter from view to template

2010-08-17 Thread djnubbio
ok it work, tank to your previous suggestion...

I didn't pay enough attention and was invoking that page from a wrong
URL


tank again for your preciouse time.

On 17 Ago, 21:10, Steve Holden  wrote:
> On 8/17/2010 2:49 PM, djnubbio wrote:
>
> > tank for your response. I try your suggestion, but it wont work!
>
> > I try to output zxc writing:
>
> >        {{ comm.id }}#{{ zxc }}
>
> > and I get the following:
>
> > ...
> > 171#
> > 140#
> > 30#
> > 90#
> > ...
>
> > thus I think zxc was empty, but i may be wrong...
>
> > waiting again for suggestions. tanks.
>
> OK, so what URL are you using to access this page, and what does the
> corresponding entry in your urlconf (urls.py) look like?
>
> regards
>  Steve
>
>
>
> > On 17 Ago, 20:22, Steve Holden  wrote:
> >> On 8/17/2010 1:53 PM, djnubbio wrote:
>
> >>> hi all and tank in advance for wasting your time; i'm very newby in
> >>> django framework
>
> >>> I have the following:
>
> >>> #views.py
> >>> ...
> >>> def lista_diario(request, comm_id):
> >>>     comm_list =
> >>> Commessa.objects.all().annotate(oretot=Sum('diario__ore'))
> >>>     return render_to_response('commesse/lista_diario.html',
> >>> dict(comm_list=comm_list, zxc= comm_id ))
>
> >>> ...
> >>> #lista_diario.html
>
> >>> ...
> >>> {% for comm in comm_list %}
>
> >>> ...
> >>>     {% if comm.id == zxc %}
>
> >>>              do something
>
> >>>      {% endif %}
> >>> ...
> >>> {% endfor %}
>
> >>> the trouble is that the if condition is never TRUE, because comm.id
> >>> has its proper value, but zxc is empty.
>
> >>> any suggestione will be greatly appreciated.
>
> >> Are you *sure* zxc is empty? It's much more likely that it isn't the
> >> same type as comm.id. In Python 1 != "1", so you may find that your code
> >> works if you start the lista_diaro() function with
>
> >>     comm_id = int(comm_id)
>
> >> Remember that if there's any chance that comm_id might not contain an
> >> integer you will need error checking and handling. If it's actually
> >> verified by the urlconf pattern, however, then errors won't occur.
>
> >> regards
> >>  Steve
> >> --
> >> DjangoCon US 2010 September 7-9http://djangocon.us/
>
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing parameter from view to template

2010-08-17 Thread Steve Holden
On 8/17/2010 2:49 PM, djnubbio wrote:
> tank for your response. I try your suggestion, but it wont work!
> 
> I try to output zxc writing:
> 
>{{ comm.id }}#{{ zxc }}
> 
> 
> 
> and I get the following:
> 
> ...
> 171#
> 140#
> 30#
> 90#
> ...
> 
> 
> thus I think zxc was empty, but i may be wrong...
> 
> 
> waiting again for suggestions. tanks.
> 
OK, so what URL are you using to access this page, and what does the
corresponding entry in your urlconf (urls.py) look like?

regards
 Steve

> On 17 Ago, 20:22, Steve Holden  wrote:
>> On 8/17/2010 1:53 PM, djnubbio wrote:
>>
>>> hi all and tank in advance for wasting your time; i'm very newby in
>>> django framework
>>
>>> I have the following:
>>
>>> #views.py
>>> ...
>>> def lista_diario(request, comm_id):
>>> comm_list =
>>> Commessa.objects.all().annotate(oretot=Sum('diario__ore'))
>>> return render_to_response('commesse/lista_diario.html',
>>> dict(comm_list=comm_list, zxc= comm_id ))
>>
>>> ...
>>> #lista_diario.html
>>
>>> ...
>>> {% for comm in comm_list %}
>>
>>> ...
>>> {% if comm.id == zxc %}
>>
>>>  do something
>>
>>>  {% endif %}
>>> ...
>>> {% endfor %}
>>
>>> the trouble is that the if condition is never TRUE, because comm.id
>>> has its proper value, but zxc is empty.
>>
>>> any suggestione will be greatly appreciated.
>>
>> Are you *sure* zxc is empty? It's much more likely that it isn't the
>> same type as comm.id. In Python 1 != "1", so you may find that your code
>> works if you start the lista_diaro() function with
>>
>> comm_id = int(comm_id)
>>
>> Remember that if there's any chance that comm_id might not contain an
>> integer you will need error checking and handling. If it's actually
>> verified by the urlconf pattern, however, then errors won't occur.
>>
>> regards
>>  Steve
>> --
>> DjangoCon US 2010 September 7-9http://djangocon.us/
> 


-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing parameter from view to template

2010-08-17 Thread djnubbio
tank you, too. I did in advance what you suggest, and was for that
reason i said zxc was empty...

On 17 Ago, 20:39, Shawn Milochik  wrote:
> In addition to what Steve said, I'd recommend putting something like
> this in your template as a test:
>
> zxc is: '{{ zxc }}'
> comm.id is: '{{ comm.id }}'
>
> This may save you some time if something you don't expect is happening.
>
> Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing parameter from view to template

2010-08-17 Thread djnubbio
tank for your response. I try your suggestion, but it wont work!

I try to output zxc writing:

   {{ comm.id }}#{{ zxc }}



and I get the following:

...
171#
140#
30#
90#
...


thus I think zxc was empty, but i may be wrong...


waiting again for suggestions. tanks.

On 17 Ago, 20:22, Steve Holden  wrote:
> On 8/17/2010 1:53 PM, djnubbio wrote:
>
> > hi all and tank in advance for wasting your time; i'm very newby in
> > django framework
>
> > I have the following:
>
> > #views.py
> > ...
> > def lista_diario(request, comm_id):
> >     comm_list =
> > Commessa.objects.all().annotate(oretot=Sum('diario__ore'))
> >     return render_to_response('commesse/lista_diario.html',
> > dict(comm_list=comm_list, zxc= comm_id ))
>
> > ...
> > #lista_diario.html
>
> > ...
> > {% for comm in comm_list %}
>
> > ...
> >     {% if comm.id == zxc %}
>
> >              do something
>
> >      {% endif %}
> > ...
> > {% endfor %}
>
> > the trouble is that the if condition is never TRUE, because comm.id
> > has its proper value, but zxc is empty.
>
> > any suggestione will be greatly appreciated.
>
> Are you *sure* zxc is empty? It's much more likely that it isn't the
> same type as comm.id. In Python 1 != "1", so you may find that your code
> works if you start the lista_diaro() function with
>
>     comm_id = int(comm_id)
>
> Remember that if there's any chance that comm_id might not contain an
> integer you will need error checking and handling. If it's actually
> verified by the urlconf pattern, however, then errors won't occur.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing parameter from view to template

2010-08-17 Thread Shawn Milochik
In addition to what Steve said, I'd recommend putting something like
this in your template as a test:

zxc is: '{{ zxc }}'
comm.id is: '{{ comm.id }}'

This may save you some time if something you don't expect is happening.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



disabling session management for certain requests

2010-08-17 Thread dmitry b
Hi,

My application has both stateful and stateless (REST) views.  Stateful
views primarily back  browser-based GUI, while stateless are for
RESTful service requests.  Is there a way to disable session
management for the stateless requests?


Thanks
Dmitry

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



VersionConflict with pip but django updated

2010-08-17 Thread Alexandre González
Hi!

I'm trying to install django-easymode, I get a version conflict, so I remove
my django from /usr/local/lib/python2.6/dist-packages as [1] says. And after
it reinstall my django from sources with python setup.py install.

When I run python -c "import django; print django.VERSION" I get the correct
one: 1.2.1 but with sudo pip install django-easymode I get the same error:

  Downloading django-easymode-0.10.5.tar.gz (292Kb): 292Kb downloaded
  Running setup.py egg_info for package django-easymode
warning: no files found matching '*.png' under directory 'docs/xslt'
warning: no files found matching '*.xslt' under directory 'example'
warning: no files found matching '*.xml' under directory 'easymode'
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
self.run(options, args)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
requirement_set.install_files(finder, force_root_egg_info=self.bundle)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1721, in
install_files
if req_to_install.check_if_exists():
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1583, in
check_if_exists
dist = pkg_resources.get_distribution(self.req)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 292, in
get_distribution
if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 176, in
get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 436, in
find
raise VersionConflict(dist,req) # XXX add more info
VersionConflict: (Django 1.2 (/usr/local/lib/python2.6/dist-packages),
Requirement.parse('Django>=1.2.1'))

Must I update some versions cache or similar?

[1] http://docs.djangoproject.com/en/dev/topics/install/?from=olddocs

-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing parameter from view to template

2010-08-17 Thread Steve Holden
On 8/17/2010 1:53 PM, djnubbio wrote:
> hi all and tank in advance for wasting your time; i'm very newby in
> django framework
> 
> I have the following:
> 
> 
> 
> #views.py
> ...
> def lista_diario(request, comm_id):
> comm_list =
> Commessa.objects.all().annotate(oretot=Sum('diario__ore'))
> return render_to_response('commesse/lista_diario.html',
> dict(comm_list=comm_list, zxc= comm_id ))
> 
> ...
> #lista_diario.html
> 
> ...
> {% for comm in comm_list %}
> 
> ...
> {% if comm.id == zxc %}
> 
> 
>  do something
> 
>  {% endif %}
> ...
> {% endfor %}
> 
> the trouble is that the if condition is never TRUE, because comm.id
> has its proper value, but zxc is empty.
> 
> any suggestione will be greatly appreciated.
> 
> 
Are you *sure* zxc is empty? It's much more likely that it isn't the
same type as comm.id. In Python 1 != "1", so you may find that your code
works if you start the lista_diaro() function with

comm_id = int(comm_id)

Remember that if there's any chance that comm_id might not contain an
integer you will need error checking and handling. If it's actually
verified by the urlconf pattern, however, then errors won't occur.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Passing request.user to FormWizard?

2010-08-17 Thread Asinox
Hi guy's i want to know how pass request.user to my Form Wizard?, any
idea?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Can I simply disable the CSRF? crazy

2010-08-17 Thread chenge
I'm new to django. CSRF let me crazy!

thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



passing parameter from view to template

2010-08-17 Thread djnubbio
hi all and tank in advance for wasting your time; i'm very newby in
django framework

I have the following:



#views.py
...
def lista_diario(request, comm_id):
comm_list =
Commessa.objects.all().annotate(oretot=Sum('diario__ore'))
return render_to_response('commesse/lista_diario.html',
dict(comm_list=comm_list, zxc= comm_id ))

...
#lista_diario.html

...
{% for comm in comm_list %}

...
{% if comm.id == zxc %}


 do something

 {% endif %}
...
{% endfor %}

the trouble is that the if condition is never TRUE, because comm.id
has its proper value, but zxc is empty.

any suggestione will be greatly appreciated.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: select statements with specific fields across multiple tables...

2010-08-17 Thread Cindy
Ah *geez* not the "bug due to typo which you can't see b/c you've been
looking at the code nonstop for way to long" problem
*headdesk*  That's what I get for looking at the django tables
directly in mysql to recall the columns.

Thanks, guys.  Dammit, I hate it when I do that.

So, I'm thinking too much in sql terms, I guess?  I was thinking in
terms of
having a list (or dictionary, rather) of the given items passed along
to the template.   If I understand select_related correctly,
that performs the sql queries upfront so that the queries are not
triggering extra db lookups
when I do the actual pd_list.in_array.* references in my template?

Again, many thanks & apologies for not understanding the first reply.

--Cindy

On Aug 17, 6:33 am, Daniel Roseman  wrote:
> On Aug 17, 1:57 pm, Cindy  wrote:
>
> > But that filter will just give me a list of tuples with
> > RaidPhysicalDrive's values.  I want to understand how I can include
> > in the list I send to my template, the *additional* values for system
> > name, storage name, and array name, so I can display/dump
> > all the info in a table.  I don't want to put in a link to RPD's
> > in_array value and force the user to drill down two layers to get to
> > the system name.
> > I don't want to also pass in lists of array names, storage names, and
> > system names and do nested forloops with if's to check -- that's
> > the whole point of a well crafted select statement, so that you have
> > your info all sorted out and ready to go.
>
> You don't need to get those elements explicitly. They are provided for
> you via the ORM. So if, as Alec suggests, you start with a queryset of
> all the RaidPhysicalDrive objects related (via the other tables) to
> your System, you can access the intermediate items with dot lookups in
> the template - again, as Alec said, your problem is you're accessing
> ``pd.in_array_id`` instead of ``pd.in_array``.
>
> You can make the query more efficient by using `select_related`:
> RaidPhysicalDrive.objects.filter(in_array__in_storage__in_system__id=id).select_related()
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



geodjango: windows installer for geos dependency?

2010-08-17 Thread Reinout van Rees

Hi,

(I also mailed the mapnik user list with this problem, not sure what the 
best place is)


I have to install my geodjango app on a windows server for a specific 
customer.  After one day, I've almost got it working.


Remaining problem: the geo database is oracle, so apparently I need the 
"geos" library. The error I'm getting is:


ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".

Well, I didn't install the geos library yet, so that could be it. But I 
cannot find a windows installer for that. Either I'm blind or nobody 
uses oracle+geo stuff on windows :-)


a) Do I really need that geos library? Or could there be something wrong 
with the oracle installation (like missing geo templates whatever).


b) Where can I grab a windows installer for GEOS? I only see mentions of 
binary packages for osx and linux, none for windows.



Reinout

--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Programmer at http://www.nelen-schuurmans.nl
"Military engineers build missiles. Civil engineers build targets"

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using sqlite :memory: database for development.

2010-08-17 Thread Shawn Milochik
Try --NOINPUT

http://docs.djangoproject.com/en/1.2/ref/django-admin/#syncdb

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Ordering in the admin

2010-08-17 Thread Wendy
Thanks Nick,
I guess I'll be passing that value, that makes sense.
I'm using a generic view to write the list page,  I'll read up more on
the queries, thanks for all your help,
Wendy

On Aug 16, 9:55 pm, Nick Serra  wrote:
> The_film was just sudo code. I was assuming you wanted to show
> filmmakers based on a movie id. I would recommend going through the
> django tutorials if you haven't, they go over all of the queries and
> how the general layout goes when doing stuff like this.
>
> On Aug 16, 7:46 pm, Wendy  wrote:
>
> > It doesn't know what the_film is:
> > name 'the_film' is not defined
>
> > if I put quotes around 'the_film', it's expecting an integer:
> > invalid literal for int() with base 10: 'the_film'
>
> >  I think that what's happening, it's trying to match the id.
>
> > I'm going to read about filtering a little more, feels like it's
> > close...
> > (I also tried to put film_id in the parens after filter and got a "too
> > many values" error.)
> > So much to learn, thanks for all your help,
> > Wendy
>
> > On Aug 16, 4:00 pm, Nick Serra  wrote:
>
> > > In your view do:
>
> > > filmmakeritems =
> > > FilmmakerPosition.objects.filter(film=the_film).order_by('position')
>
> > > Pass that into your template. Then in your template do:
>
> > > {% for item in filmmakeritems %}
> > > Name: {{ item.filmmaker.first_name }}
> > > {% endfor %}
>
> > > Etc...
>
> > > On Aug 16, 6:12 pm, Wendy  wrote:
>
> > > > Sure, it's pretty big, here are the relevant fields pulled out:
> > > > class Filmmaker (models.Model):
> > > >         first_name = models.CharField(max_length=30)
> > > >         last_name = models.CharField(max_length=40)
>
> > > >         def __unicode__(self):
> > > >                 return u'%s %s' % (self.first_name, self.last_name)
>
> > > > class Film(models.Model):
> > > >         title = models.CharField(max_length=180)
> > > >         slug = models.SlugField(unique=True)
> > > >         #filmmakers = models.ManyToManyField(Filmmaker)
> > > >         topics = models.ManyToManyField(Topic, blank=True)
>
> > > >         def __unicode__(self):
> > > >                 return self.title
>
> > > > class FilmmakerPosition(models.Model):
> > > >          filmmaker = models.ForeignKey(Filmmaker)
> > > >          film = models.ForeignKey(Film)
> > > >          position = models.IntegerField()
>
> > > > --
>
> > > > In admin.py:
>
> > > > class FilmmakerPositionInline(admin.TabularInline):
> > > >         model = FilmmakerPosition
>
> > > > class FilmAdmin(admin.ModelAdmin):
> > > >         inlines = [
> > > >                 FilmmakerPositionInline,
> > > >         ]
> > > > ... (there's more)
>
> > > > ---
>
> > > > Anyway, this was what I was using in my template when filmmakers was a
> > > > many to many relationship with film (commented out in the model
> > > > stuff):
> > > > by {% with film.filmmakers.all as filmmakers %}
> > > >                         {% for filmmaker in filmmakers %}
> > > >                            {% if filmmakers|length > 2 and not 
> > > > forloop.first %}, {% endif
> > > > %}
> > > >                            {% if forloop.last and not forloop.first 
> > > > %}and {% endif %}
> > > >                               {{filmmaker.first_name }} 
> > > > {{filmmaker.last_name}}
> > > >                         {% endfor %}
> > > >                   {% endwith %}
>
> > > > Thanks,
> > > > Wendy
>
> > > > On Aug 16, 2:13 pm, Nick Serra  wrote:
>
> > > > > Can you list your models.py for me? What exactly do you want to show
> > > > > in your template? I'm guessing some sort of WHERE clause, like all
> > > > > filmmakers for a film or something.
>
> > > > > On Aug 16, 5:08 pm, Wendy  wrote:
>
> > > > > > OK, I have the inline solution working in the admin, I can see why
> > > > > > it's prettier!
> > > > > > Now I'm trying to figure out how to refer to these filmmakers in my
> > > > > > film list template, as there is no longer a film.filmmakers 
> > > > > > object...
> > > > > > So when I look in mysql, films_filmmakerposition has an id, a
> > > > > > filmmaker id, a film id and a position.
> > > > > > My Filmmaker Object has a first name and last name.
> > > > > > I'm not sure where to start on this one, any help would be greatly
> > > > > > appreciated.
> > > > > > Thanks,
> > > > > > Wendy
>
> > > > > > On Aug 16, 12:45 pm, Wendy  wrote:
>
> > > > > > > Thanks, Nick, I just figured that out, doh!  So I got the first
> > > > > > > example going, I guess I'll try the inline solution as well, if 
> > > > > > > it's
> > > > > > > the pretty way to do it...  It'll be good for me to actually see 
> > > > > > > what
> > > > > > > they both do.
> > > > > > > W
>
> > > > > > > On Aug 16, 12:28 pm, Nick Serra  wrote:
>
> > > > > > > > The inline solution is the pretty way to do it. If you just 
> > > > > > > > want the
> > > > > > > > join to show up in the admin, then simply register the join 
> > > > > > > > model in
> 

transactions in management commands

2010-08-17 Thread dmitry b
Hi,

What's the default transaction mode for django management commands?


Thanks
Dmitry

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Foreignkeys and variables in a view

2010-08-17 Thread Nick
This appears to be working. Thanks a lot Steve, I really appreciate
the help.

On Aug 17, 9:07 am, Nick  wrote:
> Thanks, Steve. I'll implement this today and see what happens.
>
> On Aug 16, 9:46 pm, Steve Holden  wrote:
>
> > On 8/16/2010 10:30 PM, Nick Tankersley wrote:> Thank you again for your 
> > replies. They've been full of usefull
> > > information about how to clean up an otherwise pretty sloppy bit of code.
>
> > No problem. I hope you don't mind me keeping this dialog on the list (I
> > see you didn't copy django-users, perhaps not realizing that a "Reply
> > All" would be required to do so).
>
> > > By the way, type 1 races passed about a month ago so it doesn't come
> > > into play.
>
> > Thanks! That cleared up a mystery.
>
> > > I can see how you misunderstand my goal. After I get the initial query
> > > for the races I want to filter each races candidate_set to include only
> > > those candidates with a specific status. That is where I am getting stuck.
>
> > > What I meant by saying that the template for loop is working properly is
> > > that based on my flawed query logic it is returning exactly what is
> > > should, a list of candidates in the last entry.
>
> > Ah! Penny drops! I wasn't really looking at the templates. So what you
> > are really asking is how can you make the template work for every race,
> > and not just the last one?
>
> > A solution I have used in the past is to add attributes to the top-level
> > objects that I can then use in the template. This would in your case
> > involve doing something like
>
> >     for race in state_races:
> >         race.cands = race.candidate_set.filter(status="runoff")
>
> > in the view. Then the template would look like this:
>
> > {% for race in state_races %}
>
> > {{race.name}} - {{race.type}}
>
> > {% for cand in race.cands %}
> > {{ cand.name }} - {{cand.id }}
> > {% endfor %}
>
> > {% endif %}
>
> > I am pretty sure this isn't the recommended way to proceed, but with
> > luck someone on the list will advise us as to what is ...
>
> > regards
> >  Steve
>
> > > On Aug 16, 2010 9:21 PM, "Steve Holden"  > > > wrote:
> > >> On 8/16/2010 9:30 PM, Nick wrote:
>
> > >>> Thanks for the reply.
>
> > >>> I assume the problem is coming from the views since the template 'for'
> > >>> loop is technically doing what it's supposed to.
>
> > >> I find that hard to believe - you appear to be saying that you only want
> > >> the candidates for the *last* state_race. In which case why bother to
> > >> compute the candidates for the others?
>
> > >> As far as I can see your code
>
> > >> for race in state_races:
> > >> candidates = race.candidate_set.filter(status="runoff")
>
> > >> should give exactly the same result at
>
> > >> candidates = state_races[-1].candidate_set.filter(status="runoff")
>
> > >> but of course I could be mistaken.
>
> > >> Ignoring that for the moment you might want to simplify a little bit -
> > >> it looks as though you were heading along this road but didn't quite go
> > >> all the way.
>
> > >> racetypes = {"2": "runoff",
> > >> "3": "general"} # What happened to "1"?
>
> > >> def races_output(request, rtyp) # type() is a Python built-in!
> > >> r = racetypes(rtyp)
> > >> t = loader.get_template("Government/race_output_%s.html" % rtyp)
> > >> state_races = Race.objects.select_related().filter(type=rtyp)
> > >> # then whatever you decide needs to be done with the races
>
> > >> Hope this helps.
>
> > >> regards
> > >> Steve
>
> > >>> How do I limit the candidate_set(s) for each race to the statuses
> > >>> mentioned above? I have a very duct taped solution in my template but
> > >>> it's very unwieldly and confusing (many many if's). Can I move this
> > >>> filtering to the view to clean up the template?
>
> > >> That's almost certainly the right approach. Whenever your templates get
> > >> clogged up with logic it indicates you need to migrate the logic to
> > >> views. This makes your templates much more readable too!
>
> > >>> On Aug 16, 7:41 pm, Steve Holden  > > > wrote:
> >  On 8/16/2010 5:40 PM, Nick wrote:
>
> > > I have a view that handles elections/races. That view takes a request
> > > object and then based on that object sends the information to a
> > > specific template.
>
> > > For each election/race there is a subset of candidates based on the
> > > initial candidate_set from that race. I would like to know how to
> > > filter that set in a view. Here is what I have so far:
>
> > > Models.py:
>
> > > Candidate
> > > name = charfield
> > > id = integer
> > > race = ForeignKey(Race)
>
> > > Race
> > > name = charfield
> > > type = integerfield
>
> > > Views.py
>
> > > def races_output(request, type): # the type is a number that equates
> > > to general (3), runoff (2) or primary (1)
> > > if type == 2:
> > > r = "runoff"
> > > t = loader.get_template("Government/race_outp

Recently Queried Models

2010-08-17 Thread mike171562
I have a Django App with a list of our Customer's as Models. I'm
trying to find a good way to show a list of links on one of my
templates of the 10 most recently accessed customer's. Is there any
easy django way to do this. I thought about creating a new table in my
DB, but dont really want to do that

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Mathieu Leduc-Hamel
Paul, no it's not exactly the point. When you said some code on the boot up
it means really a piece of code shared by everyone and executed just one
time, by example, for mod_wsgi it would be when apache is starting.

That's exactly what's done in the Pylons world to be able to load some piece
of code like the different middleware initialization. It could be useful
when you need launch some external long running process or anything like
that.

But putting the code anywhere cause it would be evaluated when the code is
loaded is not safe cause you don't if everything was correctly loaded a this
time...

On Tue, Aug 17, 2010 at 5:13 PM, Paul Winkler  wrote:

> Seems to me that "on boot up" doesn't mean anything in a shared-
> nothing architecture like Django's.  For example if you deploy on eg.
> mod_wsgi.
> You have no idea how long any particular thread or process is going to
> live,
> and no idea how often this "boot" code would get run.
>
> But assuming that's OK, one naive strategy would be to just call the
> function(s) at top level in some module that gets imported by your
> app.
> Good enough?
>
> On Aug 17, 9:12 am, Mathieu Leduc-Hamel  wrote:
> > Tang,
> >
> > do you mean :
> >
> > "How to execute some pieces of code when you launch the "runserver"
> command
> > by example" ? If this is what you mean, it's not a easy thing to do right
> > now. Then only way i found it possible is by using: twod.wsgi
> >
> > With twod.wsgi you can use the entry points system of python and do, like
> in
> > Pylons, an entry defined by Paster "app_factory"
> >
> > You can see an example there:
> http://packages.python.org/twod.wsgi/manual/paste-factory.html#using-...
> >
> > mathieu
> >
> > On Tue, Aug 17, 2010 at 2:45 PM, Emily Rodgers <
> emily.kate.rodg...@gmail.com
> >
> > > wrote:
> > > On Aug 17, 2:26 am, Tang Daogang  wrote:
> > > > Dear all,
> >
> > > > Recently, I have developed a plugin system for my app, and I want to
> > > > register those plugins when my app boot up, this need to execute some
> > > > user defined codes (functions) in app boot procedure, I don't know
> > > > where insert my registering codes to, anyone can help?
> >
> > > > Thank you.
> >
> > > Hi,
> >
> > > I don't know how to help you, but I think it is because you haven't
> > > explained what you want to do thoroughly enough.
> >
> > > What do you mean by a plugin system, and what do you mean by
> > > registering them with the app on boot up? Are you talking about
> > > including another python module in your code? Or perhaps including
> > > another django app in your code?
> >
> > > Can you give us a bit more information (and maybe examples) of what
> > > you are trying to do.
> >
> > > Cheers,
> > > Em
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Translate data from Database

2010-08-17 Thread Alexandre González
Hi!

I need a model to complete a combo in my app. The models have only code and
name, but I need to translate this name.

I think about do something similar to this:

class ComboFill(models.Model):
code = models.CharField...
language = models.CharField...
name = models.CharField...

And after this filter by language, but I think that it's not the best way to
do that, or is it?

Anyway I have a model Languages defines as this:

class Language(models.Model):
code = models.CharField(max_length=12, primary_key=True, blank=False,
help_text=_('Example: en, es...'))
name = models.CharField(max_length=64, blank=False, help_text=_('The
real name.'))

Can I accept only codes defined in Language model? Because I can use a
ForeignField as this:

class ComboFill(models.Model):
code = models.CharField...
language = models.ForeignField(Language)
name = models.CharField...

But If I do that I need to retrieve the entire object language to push it in
ComboFill model. I like to wirte only, for example, 'es' as the code and if
it's in the Language model ok, otherway error. I can do it overriding the
save() method but it's a good way?

Thanks! And excuse my english :p

-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Validation and dynamically extending ChoiceField choices

2010-08-17 Thread ringemup
Oh, that sounds like a great way to handle it.  Thank you!

On Aug 17, 10:10 am, Alex Robbins 
wrote:
> Maybe the ChoiceField should just be a CharField that just uses the
> Select widget class? That way it won't have choices hardcoded into the
> field validation. Your clean method could check that the domain is
> valid.
>
> Alex
> On Aug 16, 1:39 pm, ringemup  wrote:
>
> > I have a domain search form with two fields: a Textarea for inputting
> > a list of domains to check, and a ChoiceField for selecting a domain
> > based on suggestions.
>
> > The ChoiceField is required, and on the first submission is auto-
> > populated with suggestions based on the domains listed in the
> > textarea.  Subsequently, the user may either enter a new list of
> > domains to check, or select a domain from the radio buttons.
>
> > However, when they select one of the radio buttons, the form never
> > validates because the selected domain "is not one of the available
> > choices" -- because, of course, the choices are populated only after
> > the form is submitted.
>
> > I'm having trouble working around this because of the messiness that
> > is Django's FormWizard.  Any suggestions?
>
> > Thanks!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using sqlite :memory: database for development.

2010-08-17 Thread Thiago Padilha
 Ok I managed to get that working, when I start the server I get :

Django version 1.1.1, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table books_publisher
Creating table books_author
Creating table books_book

the only problem is that when I make the first request it blocks for
console input with the following message :

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no)

If I create a user with the same name created in the startup
middleware I get unique constraint database violation, if I choose no
everything proceeds smoothly and I can log on with my stub user. I
don't want the first request blocking everytime to ask for a new user,
can I remove that prompt?

 Thanks.

On Mon, Aug 16, 2010 at 11:57 PM, Thiago de Arruda  wrote:
>  Hi,
>
>  I'm coming to django from grails, in which which I used an in-memory
> hsql database for development and in my startup script I initialized
> the in-memory database with some stub values/users that were inserted
> everytime I started the server. This setup was really helpful in early
> stage development, where the database changes a lot(without requiring
> me to update the database schema), and I'm trying to achieve similar
> results with django/sqlite in memory databases.
>  I placed some startup code in a middleware as follows :
>
> from django.core.exceptions import MiddlewareNotUsed
> from django.conf import settings
> from django.core.management import call_command
> from books.models import *
> from django.contrib.auth.models import User
>
> class StartupMiddleware(object):
>
>        def create_publishers(self):
>                p1 = Publisher(name='Apress', address='2855 Telegraph Avenue',
>                        city='Berkeley', state_province='CA', country='U.S.A.',
>                        website='http://www.apress.com/')
>                p1.save()
>                p2 = Publisher(name="O'Reilly", address='10 Fawcett St.',
>                        city='Cambridge', state_province='MA', 
> country='U.S.A.',
>                        website='http://www.oreilly.com/')
>                p2.save()
>
>        def create_users(self):
>                u1 = User(username='thiago', email='thi...@pass.com')
>                u1.set_password('somepass')
>                u1.save()
>
>        def create_stubs(self):
>                self.create_publishers()
>                self.create_users()
>
>        def __init__(self):
>                if settings.DATABASE_NAME == ':memory:':
>                        call_command('syncdb', interactive=False)
>                        self.create_stubs()
>                raise MiddlewareNotUsed('Startup complete')
>
>
>  This is not working(At least I can't logon to the admin site with
> that user). I'm unsure if middleware is the best place to place
> startup code, or If I'm going the right way. Any help is appreciated.
>
>  Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Paul Winkler
Seems to me that "on boot up" doesn't mean anything in a shared-
nothing architecture like Django's.  For example if you deploy on eg.
mod_wsgi.
You have no idea how long any particular thread or process is going to
live,
and no idea how often this "boot" code would get run.

But assuming that's OK, one naive strategy would be to just call the
function(s) at top level in some module that gets imported by your
app.
Good enough?

On Aug 17, 9:12 am, Mathieu Leduc-Hamel  wrote:
> Tang,
>
> do you mean :
>
> "How to execute some pieces of code when you launch the "runserver" command
> by example" ? If this is what you mean, it's not a easy thing to do right
> now. Then only way i found it possible is by using: twod.wsgi
>
> With twod.wsgi you can use the entry points system of python and do, like in
> Pylons, an entry defined by Paster "app_factory"
>
> You can see an example 
> there:http://packages.python.org/twod.wsgi/manual/paste-factory.html#using-...
>
> mathieu
>
> On Tue, Aug 17, 2010 at 2:45 PM, Emily Rodgers 
> > wrote:
> > On Aug 17, 2:26 am, Tang Daogang  wrote:
> > > Dear all,
>
> > > Recently, I have developed a plugin system for my app, and I want to
> > > register those plugins when my app boot up, this need to execute some
> > > user defined codes (functions) in app boot procedure, I don't know
> > > where insert my registering codes to, anyone can help?
>
> > > Thank you.
>
> > Hi,
>
> > I don't know how to help you, but I think it is because you haven't
> > explained what you want to do thoroughly enough.
>
> > What do you mean by a plugin system, and what do you mean by
> > registering them with the app on boot up? Are you talking about
> > including another python module in your code? Or perhaps including
> > another django app in your code?
>
> > Can you give us a bit more information (and maybe examples) of what
> > you are trying to do.
>
> > Cheers,
> > Em
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using sqlite :memory: database for development.

2010-08-17 Thread Shawn Milochik
Middleware executes with each request, so it's probably not the best
place for such a thing.

It seems like it would be a lot easier to use a normal sqlite3
database and just delete it after each run.

Also, if you have test data you'd like to reload regularly, I
recommend using a regular database, creating your test data in the
admin, then using ./manage.py dumpdata to create a fixture. Then, you
could use that fixture for your development and your unit tests.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Chopping Queryset

2010-08-17 Thread Mathieu Leduc-Hamel
If you want the job offer of the current logged user it should be pretty
simple using a filter like that:

jobsfound.filter(userdetail__user=request.user)

But if i was you i would invert the order of these two filter like that:

jobsfound = joblist.objects.filter(userdetail__user=request.user)
jobsfound = jobsfound.filter(name__icontains=cd['jobsearchitem'])



On Tue, Aug 17, 2010 at 4:20 PM, Niall  wrote:

> Hey,
> Given the models below, I want to display all jobs, but mark those of
> the User that is logged in?
>
>
> My Model definition---
> User model is the built in User model.
>
> class joblist(models.Model):
>name=models.CharField(...)
>userdetail = models.ManyToManyField(User,through='userextra')
>
> class userextra(models.Model):
>joblist = models.ForeignKey(joblist)
>user = models.ForeignKey(User)
>comments= models.CharField(max_length=16384, blank=True,
> null=True)
>
>
> Views.py
> jobsfound=joblist.objects.filter(name__icontains=cd['jobsearchitem'])
>
>
> Template
> {% for row in joblist %}{{row.name}}
> {% if user.is_authenticated() %}
> {{row.comments}}
> {%endfor%}
>
>
>
> I don't know if I should be adding more to the filter statement in
> views.py or doing something in the template.
> Note: I want all jobs printed (within the search criteria) but
> displaying the comments of the authenticated user.
>
>
> Any help appreciated,
> N
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Chopping Queryset

2010-08-17 Thread Niall
Hey,
Given the models below, I want to display all jobs, but mark those of
the User that is logged in?


My Model definition---
User model is the built in User model.

class joblist(models.Model):
name=models.CharField(...)
userdetail = models.ManyToManyField(User,through='userextra')

class userextra(models.Model):
joblist = models.ForeignKey(joblist)
user = models.ForeignKey(User)
comments= models.CharField(max_length=16384, blank=True,
null=True)


Views.py
jobsfound=joblist.objects.filter(name__icontains=cd['jobsearchitem'])


Template
{% for row in joblist %}{{row.name}}
{% if user.is_authenticated() %}
{{row.comments}}
{%endfor%}



I don't know if I should be adding more to the filter statement in
views.py or doing something in the template.
Note: I want all jobs printed (within the search criteria) but
displaying the comments of the authenticated user.


Any help appreciated,
N

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Validation and dynamically extending ChoiceField choices

2010-08-17 Thread Alex Robbins
Maybe the ChoiceField should just be a CharField that just uses the
Select widget class? That way it won't have choices hardcoded into the
field validation. Your clean method could check that the domain is
valid.

Alex
On Aug 16, 1:39 pm, ringemup  wrote:
> I have a domain search form with two fields: a Textarea for inputting
> a list of domains to check, and a ChoiceField for selecting a domain
> based on suggestions.
>
> The ChoiceField is required, and on the first submission is auto-
> populated with suggestions based on the domains listed in the
> textarea.  Subsequently, the user may either enter a new list of
> domains to check, or select a domain from the radio buttons.
>
> However, when they select one of the radio buttons, the form never
> validates because the selected domain "is not one of the available
> choices" -- because, of course, the choices are populated only after
> the form is submitted.
>
> I'm having trouble working around this because of the messiness that
> is Django's FormWizard.  Any suggestions?
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Foreignkeys and variables in a view

2010-08-17 Thread Nick
Thanks, Steve. I'll implement this today and see what happens.

On Aug 16, 9:46 pm, Steve Holden  wrote:
> On 8/16/2010 10:30 PM, Nick Tankersley wrote:> Thank you again for your 
> replies. They've been full of usefull
> > information about how to clean up an otherwise pretty sloppy bit of code.
>
> No problem. I hope you don't mind me keeping this dialog on the list (I
> see you didn't copy django-users, perhaps not realizing that a "Reply
> All" would be required to do so).
>
> > By the way, type 1 races passed about a month ago so it doesn't come
> > into play.
>
> Thanks! That cleared up a mystery.
>
> > I can see how you misunderstand my goal. After I get the initial query
> > for the races I want to filter each races candidate_set to include only
> > those candidates with a specific status. That is where I am getting stuck.
>
> > What I meant by saying that the template for loop is working properly is
> > that based on my flawed query logic it is returning exactly what is
> > should, a list of candidates in the last entry.
>
> Ah! Penny drops! I wasn't really looking at the templates. So what you
> are really asking is how can you make the template work for every race,
> and not just the last one?
>
> A solution I have used in the past is to add attributes to the top-level
> objects that I can then use in the template. This would in your case
> involve doing something like
>
>     for race in state_races:
>         race.cands = race.candidate_set.filter(status="runoff")
>
> in the view. Then the template would look like this:
>
> {% for race in state_races %}
>
> {{race.name}} - {{race.type}}
>
> {% for cand in race.cands %}
> {{ cand.name }} - {{cand.id }}
> {% endfor %}
>
> {% endif %}
>
> I am pretty sure this isn't the recommended way to proceed, but with
> luck someone on the list will advise us as to what is ...
>
> regards
>  Steve
>
>
>
> > On Aug 16, 2010 9:21 PM, "Steve Holden"  > > wrote:
> >> On 8/16/2010 9:30 PM, Nick wrote:
>
> >>> Thanks for the reply.
>
> >>> I assume the problem is coming from the views since the template 'for'
> >>> loop is technically doing what it's supposed to.
>
> >> I find that hard to believe - you appear to be saying that you only want
> >> the candidates for the *last* state_race. In which case why bother to
> >> compute the candidates for the others?
>
> >> As far as I can see your code
>
> >> for race in state_races:
> >> candidates = race.candidate_set.filter(status="runoff")
>
> >> should give exactly the same result at
>
> >> candidates = state_races[-1].candidate_set.filter(status="runoff")
>
> >> but of course I could be mistaken.
>
> >> Ignoring that for the moment you might want to simplify a little bit -
> >> it looks as though you were heading along this road but didn't quite go
> >> all the way.
>
> >> racetypes = {"2": "runoff",
> >> "3": "general"} # What happened to "1"?
>
> >> def races_output(request, rtyp) # type() is a Python built-in!
> >> r = racetypes(rtyp)
> >> t = loader.get_template("Government/race_output_%s.html" % rtyp)
> >> state_races = Race.objects.select_related().filter(type=rtyp)
> >> # then whatever you decide needs to be done with the races
>
> >> Hope this helps.
>
> >> regards
> >> Steve
>
> >>> How do I limit the candidate_set(s) for each race to the statuses
> >>> mentioned above? I have a very duct taped solution in my template but
> >>> it's very unwieldly and confusing (many many if's). Can I move this
> >>> filtering to the view to clean up the template?
>
> >> That's almost certainly the right approach. Whenever your templates get
> >> clogged up with logic it indicates you need to migrate the logic to
> >> views. This makes your templates much more readable too!
>
> >>> On Aug 16, 7:41 pm, Steve Holden  > > wrote:
>  On 8/16/2010 5:40 PM, Nick wrote:
>
> > I have a view that handles elections/races. That view takes a request
> > object and then based on that object sends the information to a
> > specific template.
>
> > For each election/race there is a subset of candidates based on the
> > initial candidate_set from that race. I would like to know how to
> > filter that set in a view. Here is what I have so far:
>
> > Models.py:
>
> > Candidate
> > name = charfield
> > id = integer
> > race = ForeignKey(Race)
>
> > Race
> > name = charfield
> > type = integerfield
>
> > Views.py
>
> > def races_output(request, type): # the type is a number that equates
> > to general (3), runoff (2) or primary (1)
> > if type == 2:
> > r = "runoff"
> > t = loader.get_template("Government/race_output_2.html")
> > state_races = Race.objects.select_related().filter(type=type)
> > for race in state_races:
> > candidates = race.candidate_set.filter(status="runoff")
>
> > if type == 3:
> > r = "general"
> > t = loader.get_template("Government/race_output_3.html")
> > s

Re: Long running process and time outs?

2010-08-17 Thread Alex Robbins
This is exactly the sort of issue that celery was created to solve. It
is a task queue management system.

http://celeryproject.org/

Alex

On Aug 14, 1:28 pm, ydjango  wrote:
> I have a online user initiated synchronous process which runs anywhere
> between 1-5 minutes and gives user status message at the end. It is a
> very DB intensive process that reads and updates lots of mysql rows
> and does many calculations. The process is run as part of a view
> method.
>
> It causes nginx to time out after 2-3 minutes with following message -
> "upstream timed out (110: Connection timed out) while reading response
> header from upstream".  User sees  504 gateway error on his browser.
>
> 1) How can I prevent time out. Can I ping the server via ajax or
> something to prevent time out.
> 2) How can I display to user - progress bar or in progress indicator -
> so that user can wait 3 - 5 minutes.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: CSRF verification failures (admin)

2010-08-17 Thread Alex Robbins
Have you done any admin template customization? If you copied a
template from django before 1.2, then upgraded, your admin template
might be missing the csrf_token template tag.

Alex

On Aug 17, 7:55 am, PieterB  wrote:
> For an internal application, I constantly receive CSRF verification
> failed" errors... most of the times when using the admin interface
>
> It doesn't happen with the local dev version (dev http server) but
> happens with the deployment version (custom port, cherokee web server)
>
> I can only use the admin interface (very) temporarily with a Clear
> Recent History command
>
> This is very annoying :-S
>
> I've included
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.middleware.csrf.CsrfResponseMiddleware'
>
> What am I doing wrong? Do I need also some sort of token for Django's
> admin interface?
>
> -- PieterB

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: multiple forms for same model

2010-08-17 Thread Alex Robbins
contract_form.is_valid() looks at the data that was bound to the form.
This is normally the data in request.POST. It doesn't matter what a
form's initial data happened to be. It only matters what data you POST
back to it. If someone doesn't modify the form, then the initial and
the POSTed data are probably the same. However, if your form doesn't
have the read-only fields displayed in the template, they won't be
POSTing their data back.

Alex

On Tue, Aug 17, 2010 at 3:03 AM, Mess  wrote:
> Thx both for helping, I guess there isn't a straight forward solution,
> I'll prob add the missing fields manually.
>
> However I still don't get why contract_form.is_valid() doesn't return
> true since contract_form still contains the correct data when viewing
> in browser.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Proxy models and Meta options

2010-08-17 Thread Mathieu Leduc-Hamel
Hi all,

I've just used a proxy model in my own custom application and i've just
found a small problem. Right now, to be able to create a Proxy model, i'm
force to redefine a Meta options like that:

class NewDiscount(Discount):
class Meta:
proxy = True

The problem i have is that the original discount object defined the
following Meta options:

class Discount(models.Model):
class Meta:
verbose_name = _("Discount")
verbose_name_plural = _("Discounts")
unique_together = ('slug', 'amount')

Since i've overwritten the Meta class I should copy the original Meta
options inside my Proxy model like that:

class NewDiscount(Discount):
class Meta:
proxy = True
verbose_name = _("Discount")
verbose_name_plural = _("Discounts")
unique_together = ('slug', 'amount')

But, when I'm doing that, Django throw me an error saying:

"store.discount: "unique_together" refers to site. This is not in the same
model as the unique_together statement."

It means that i can't add the unique_together clause in the Meta class cause
the fields are not directly the property of my proxy model !!!

How it's possible ? What should I do ?

Mathieu Leduc-Hamel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django, Redirects and htaccess via Static App

2010-08-17 Thread Parthian
A Django Theoritical discussion point. Re-post from Webfaction forum -
more a django question than webfaction specific).

Over the weekend I had a huge number of pages/hits from one IP address
(logged via awstats). Assuming some kind of funny business I decided
to block that IP address. Two approaches:-

Redirect App as per this - http://forum.webfaction.com/viewtopic.php?id=1516
or this snippet here - http://djangosnippets.org/snippets/744/

The Redirect Static App which does nothing except provide access to
the Django site via a route which allows htaccess is a popular
solution mainly for !www to www solutions, and in my case to make
available 'deny 123.123.123.123'.

Given that !www to www or vice versa is commonly required and other
capabilities of htaccess may be useful (e.g. deny) is there a case for
arguing that all Django Apps should be accessed via a Static App? Only
downside being that another operation is required which will take up
some time and resources (potentially negligible).

But one feature I like about Django is that I don't have to deal with
the dreaded complexity of htaccess for tasks like redirects such as -
urlpatterns += patterns('django.views.generic.simple', ('^index.php/
$', 'redirect_to', {'url': '/'}),
(I've got loads of these for the site in question due to a
migration).

So maybe Django should be handling !www to www and deny etc (hence
snippet 744 may be useful)? Thus dropping completely the need for the
Static/htaccess approach.

Summary - either use Static/htaccess with every Django site or find a
way to do all/most htaccess stuff in Django. Any views.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: select statements with specific fields across multiple tables...

2010-08-17 Thread Daniel Roseman
On Aug 17, 1:57 pm, Cindy  wrote:
> But that filter will just give me a list of tuples with
> RaidPhysicalDrive's values.  I want to understand how I can include
> in the list I send to my template, the *additional* values for system
> name, storage name, and array name, so I can display/dump
> all the info in a table.  I don't want to put in a link to RPD's
> in_array value and force the user to drill down two layers to get to
> the system name.
> I don't want to also pass in lists of array names, storage names, and
> system names and do nested forloops with if's to check -- that's
> the whole point of a well crafted select statement, so that you have
> your info all sorted out and ready to go.
>

You don't need to get those elements explicitly. They are provided for
you via the ORM. So if, as Alec suggests, you start with a queryset of
all the RaidPhysicalDrive objects related (via the other tables) to
your System, you can access the intermediate items with dot lookups in
the template - again, as Alec said, your problem is you're accessing
``pd.in_array_id`` instead of ``pd.in_array``.

You can make the query more efficient by using `select_related`:
RaidPhysicalDrive.objects.filter(in_array__in_storage__in_system__id=id).select_related()
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Mathieu Leduc-Hamel
Tang,

do you mean :

"How to execute some pieces of code when you launch the "runserver" command
by example" ? If this is what you mean, it's not a easy thing to do right
now. Then only way i found it possible is by using: twod.wsgi

With twod.wsgi you can use the entry points system of python and do, like in
Pylons, an entry defined by Paster "app_factory"

You can see an example there:
http://packages.python.org/twod.wsgi/manual/paste-factory.html#using-custom-factories

mathieu

On Tue, Aug 17, 2010 at 2:45 PM, Emily Rodgers  wrote:

> On Aug 17, 2:26 am, Tang Daogang  wrote:
> > Dear all,
> >
> > Recently, I have developed a plugin system for my app, and I want to
> > register those plugins when my app boot up, this need to execute some
> > user defined codes (functions) in app boot procedure, I don't know
> > where insert my registering codes to, anyone can help?
> >
> > Thank you.
>
> Hi,
>
> I don't know how to help you, but I think it is because you haven't
> explained what you want to do thoroughly enough.
>
> What do you mean by a plugin system, and what do you mean by
> registering them with the app on boot up? Are you talking about
> including another python module in your code? Or perhaps including
> another django app in your code?
>
> Can you give us a bit more information (and maybe examples) of what
> you are trying to do.
>
> Cheers,
> Em
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Save_model versus model.save() and the order they are called.

2010-08-17 Thread vjimw
I remedied this problem by actually doing all of my work in the
save_model() method. It has all the initial data set on the model
which allowed me to check which values changed (date and/or user) and
set audits as needed.

On Aug 12, 4:06 pm, vjimw  wrote:
> We have a model object (Offer) which has a number of business rules.
> 1) On create, auto populate the created_by field with the request.userdata
> 2) On modify, auto populate the last_edited_by field with the
> request.userdata
> 3) If a date value change on modify, audit with the object, date and
> last_edited_by user
>
> The created_by and last_modified_by values are being populated
> automatically in save_model() in the admin for Offer using class
> OfferAdmin(admin.ModelAdmin)
>
> def save_model(self, request, obj,form, change):
>         # If add, set created_by...
>         # For both add and change, update last_edited_by
>         obj.last_edited_by_id = request.user
>         # A few other code updates
>         obj.save()
>
> This works just fine!
>
> The next set of business rules are based around a date changing when
> an editformis submitted.  If the date entered by the user changes,
> and matches some rules, we want to audit this and tag it with the
> last_edited_by user for that currentformsubmit. For this we are
> overriding thesave() method for the model object class
> Offer(models.Model).
>
> To keep track of the original objectdata(versus theformsubmitteddata) I am 
> using the __init__ method on the model like this:
>
>     def __init__(self, *args, **kwargs):
>         super(Offer, self).__init__(*args, **kwargs)
>         self.__original_end_date = self.end_date
>         self.__original_last_edited_by = self.last_edited_by
>
> For the date, which is always manipulated through theform, this works
> like a charm. We can compare self.end_date with
> self.__original_end_date and see if thedatahas changed. For the
> last_edited_by field, which is not updated in theformbut is set in
> save_model() we actually get the original value and not the value set
> in save_model().
>
> Any idea how I can get my new auto populateddatahere instead of the
> original value?
>
> I looked at the Django admin code and see that save_model() just calls
> obj.save() so I am not sure why I don't see my setdatafrom
> save_model() but the original value for the last_edited_by field.  I
> also noticed that my modelsave() override method is called twice. The
> first time with the original date and the new date, but with
> last_edited_by ONLY being the original value and then AGAIN with the
> dates both set to the new date but with the original last_edited_by
> and new last_edited_by... so I get the change but I just don't get
> both changes in the samesave() call which means I cannot test for
> both conditions.
>
> At the end of the day, the correct user for the last_edited_by field
> ends up in the admin tool and database, but the order in which items
> are called is throwing me.
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: select statements with specific fields across multiple tables...

2010-08-17 Thread Cindy
But that filter will just give me a list of tuples with
RaidPhysicalDrive's values.  I want to understand how I can include
in the list I send to my template, the *additional* values for system
name, storage name, and array name, so I can display/dump
all the info in a table.  I don't want to put in a link to RPD's
in_array value and force the user to drill down two layers to get to
the system name.
I don't want to also pass in lists of array names, storage names, and
system names and do nested forloops with if's to check -- that's
the whole point of a well crafted select statement, so that you have
your info all sorted out and ready to go.

On Aug 16, 6:46 pm, Alec Shaner  wrote:
> 1. What is your code for doing the filters?  If you want to start with
> physical drives it would be something like:
>
> RaidPhysicalDrive.objects.filter(in_array__in_storage__in_system__id=)
>
> 2. In your template you've referenced pd.in_array_id, but don't you just
>want pd.in_array if you're wanting to follow the FK to get RaidArray fields,
> e.g.,
>
> {{ 
> pd.in_array.in_storage.in_system.name}}
>
> On Mon, Aug 16, 2010 at 8:04 PM, Cindy  wrote:
> > I'm having some trouble constructing a filter that's intended to work
> > across multiple tables with selected fields.  Here's a simplified
> > outline of my models:
>
> > class System(models.Model):
> >    name = models.CharField(max_length=16)
> >    domain = models.CharField(max_length=255, default='example.com')
>
> > class RaidStorage(models.Model):
> >    in_system = models.ForeignKey(System)
> >    name = models.CharField(max_length=25)
>
> > class RaidArray(models.Model):
> >    in_storage = models.ForeignKey(RaidStorage)
> >    name = models.CharField(max_length=25)
>
> > class RaidPhysicalDrive(models.Model):
> >    in_array = models.ForeignKey(RaidArray)
> >    name = models.CharField(max_length=25)
> >    size = models.IntegerField(null=True, blank=True)
> >    serial = models.CharField(max_length=25)
> >    model = models.CharField(max_length=25)
>
> > Now, given a system id, I want to list all the physical drives from it
> > along with info from the related tables.  I would like something like
>
> > select System.name, RaidStorage.name, RaidArray.name,
> > RaidPhysicalDrive.name, RaidPhysicalDrive.serial,
> > RaidPhysicalDrive.model from System, RaidStorage, RaidArray,
> > RaidPhysicalDrive where RaidPhysicalDrive.in_array=RaidAarray.id and
> > RaidArray.in_storaage = RaidStorage.id and RaidStorage.in_system=id
> > (etc)
>
> > I'm having a good deal of trouble coming up with the filters for
> > this.  I'm thinking that .values() and possibly .select_related() are
> > key here, but so far I've failed at putting together anything that
> > gives me the results I want (a list of physical drives associated with
> > the selected system).   The filter examples through the tutorials and
> > such seem to all assume select *, and there's very little on dealing
> > with grouping selective fields from multiple tables that I've found.
>
> > Part of the issue might be in the template as well; If I cheat and
> > send it the correct list, I can't access part of the information I
> > want:
>
> > {% for pd in pd_list %}
> > 
> >    {{ pd.in_array_id.storage.in_system.name }}
> >    {{ pd.in_array_id.in_storage.name }}
> >    {{ pd.in_array_id.name }}
> >    {{ pd.name }}
> >    {{ pd.serial }}
> >    {{ pd.model }}
> > 
> > {% endfor %}
>
> > results in the first three columns of the table being empty...
> > templates don't seem to "follow" back the way they do in views.py,
> > etc.  So I'm sure I need to create a dictionary or list from the
> > original views.py def to pass to the template but as I say, I'm not
> > sure of how to use .values or .select_related (or whatever else item
> > I'm overlooking).
>
> > I did search through the group a bit, but didn't find anything
> > directly helpful.
>
> > Thanks!
> > --Cindy
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



CSRF verification failures (admin)

2010-08-17 Thread PieterB
For an internal application, I constantly receive CSRF verification
failed" errors... most of the times when using the admin interface

It doesn't happen with the local dev version (dev http server) but
happens with the deployment version (custom port, cherokee web server)

I can only use the admin interface (very) temporarily with a Clear
Recent History command

This is very annoying :-S

I've included
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware'

What am I doing wrong? Do I need also some sort of token for Django's
admin interface?

-- PieterB

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Emily Rodgers
On Aug 17, 2:26 am, Tang Daogang  wrote:
> Dear all,
>
> Recently, I have developed a plugin system for my app, and I want to
> register those plugins when my app boot up, this need to execute some
> user defined codes (functions) in app boot procedure, I don't know
> where insert my registering codes to, anyone can help?
>
> Thank you.

Hi,

I don't know how to help you, but I think it is because you haven't
explained what you want to do thoroughly enough.

What do you mean by a plugin system, and what do you mean by
registering them with the app on boot up? Are you talking about
including another python module in your code? Or perhaps including
another django app in your code?

Can you give us a bit more information (and maybe examples) of what
you are trying to do.

Cheers,
Em

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Another question: how to apply custom variable into django template automatically?

2010-08-17 Thread Steve Holden
On 8/16/2010 9:36 PM, Tang Daogang wrote:
> Dear all,
> 
> I have developed a CMS, which containing a dynamic menu. Because menu
> should be displayed on every page of my site, I need to write the menu
> variable into every view function against every page template, this is
> very boring...
> 
> So is there some method to implement applying custom variable into
> django template automatically? I find some materials, may be
> RequestContext can handle it, but I don't know how to insert my custom
> variable into it?
> 
> Anyone can help?
> 
> Thank you!
> 
Indeed, James Bennett has already written exactly the blog entry you
need. It shows you how to write a context manager, which will allow you
to inject common material into the context of every request:


http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Another question: how to apply custom variable into django template automatically?

2010-08-17 Thread Daniel Roseman
On Aug 17, 2:36 am, Tang Daogang  wrote:
> Dear all,
>
> I have developed a CMS, which containing a dynamic menu. Because menu
> should be displayed on every page of my site, I need to write the menu
> variable into every view function against every page template, this is
> very boring...
>
> So is there some method to implement applying custom variable into
> django template automatically? I find some materials, may be
> RequestContext can handle it, but I don't know how to insert my custom
> variable into it?
>
> Anyone can help?
>
> Thank you!

Context processors:
http://docs.djangoproject.com/en/1.2/ref/templates/api/#subclassing-context-requestcontext
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ManyToMany Template THROUGH model extra fields

2010-08-17 Thread Niall
Hey,
Ive a problem referencing to my "THROUGH" m2m model extra fields.  I
can reference the linked model (User), but not the extra detail on the
"through-model" (listuser)

My Model definition---
User model is the built in User model.

class joblist(models.Model):
userdetail = models.ManyToManyField(User,through='userextra')

class userextra(models.Model):
joblist = models.ForeignKey(joblist)
user = models.ForeignKey(User)
comments= models.CharField(max_length=16384, blank=True, null=True)

In my Template-
{% for row in joblist %}
html here
{% for item in row.userdetail.all  %}
{{item.username}}  -  {{item.userextra.comments}}  - {{item.comments}}
(ie I want to print comments here)
{% endfor %}
{% endfor %}

What I get---
Job1,Jim--Job2,Mike--

So I am getting the detail from the "User" model but Im not getting
the extra fields on the userextra model

 Any help appreciated
N

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using sqlite :memory: database for development.

2010-08-17 Thread Thiago de Arruda
  Hi,

  I'm coming to django from grails, in which which I used an in-memory
hsql database for development and in my startup script I initialized
the in-memory database with some stub values/users that were inserted
everytime I started the server. This setup was really helpful in early
stage development, where the database changes a lot(without requiring
me to update the database schema), and I'm trying to achieve similar
results with django/sqlite in memory databases.
  I placed some startup code in a middleware as follows :

from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
from django.core.management import call_command
from books.models import *
from django.contrib.auth.models import User

class StartupMiddleware(object):

def create_publishers(self):
p1 = Publisher(name='Apress', address='2855 Telegraph Avenue',
city='Berkeley', state_province='CA', country='U.S.A.',
website='http://www.apress.com/')
p1.save()
p2 = Publisher(name="O'Reilly", address='10 Fawcett St.',
city='Cambridge', state_province='MA', country='U.S.A.',
website='http://www.oreilly.com/')
p2.save()

def create_users(self):
u1 = User(username='thiago', email='thi...@pass.com')
u1.set_password('somepass')
u1.save()

def create_stubs(self):
self.create_publishers()
self.create_users()

def __init__(self):
if settings.DATABASE_NAME == ':memory:':
call_command('syncdb', interactive=False)
self.create_stubs()
raise MiddlewareNotUsed('Startup complete')


  This is not working(At least I can't logon to the admin site with
that user). I'm unsure if middleware is the best place to place
startup code, or If I'm going the right way. Any help is appreciated.

  Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Another question: how to apply custom variable into django template automatically?

2010-08-17 Thread Tang Daogang
Dear all,

I have developed a CMS, which containing a dynamic menu. Because menu
should be displayed on every page of my site, I need to write the menu
variable into every view function against every page template, this is
very boring...

So is there some method to implement applying custom variable into
django template automatically? I find some materials, may be
RequestContext can handle it, but I don't know how to insert my custom
variable into it?

Anyone can help?

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to execute some user defined codes (functions) when Django boot?

2010-08-17 Thread Tang Daogang
Dear all,

Recently, I have developed a plugin system for my app, and I want to
register those plugins when my app boot up, this need to execute some
user defined codes (functions) in app boot procedure, I don't know
where insert my registering codes to, anyone can help?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing a model of place from the admin site

2010-08-17 Thread Mathieu Leduc-Hamel
Thanks Andy,

It might be a solution and maybe the only one as you said. I'll maybe try it
or somebody propose me this other solution:

Create a subclass of the models classes i would like to move by creating
proxy objects. It force you create sometime a large number of object but it
might less dangerous to break something...

On Tue, Aug 17, 2010 at 11:14 AM, AndyB  wrote:

> I did something similar by subclassing AdminSite and overriding the
> index method. Copy the original method from contrib.admin and modify
> app_list before you render the template.
>
> It does break breadcrumbs and intermediate app pages (/admin/someapp/)
> but with some shameless hackery I fixed this too:
>
>def app_index(self, request, app_label, extra_context=None):
>p = request.path.split('/')[-2].replace('_','-')
>if p=='cms':
>p='general-content'
>elif p=='auth':
>p='users'
>return HttpResponseRedirect('/admin/#'+p)
>
> (this basically redirects /admin/auth/ and /admin/cms/ to a named
> anchor on the index page instead)
>
> Andy
>
> On Aug 16, 4:41 pm, Mathieu Leduc-Hamel  wrote:
> > Hi all,
> >
> > I'm currently developing a e-commerce website using satchmo and
> > django. I would like to simplify the admin pannel from the user
> > perspective. This is why i would like to change the different group of
> > models. Right now, these group are organized by application. But when
> > using some external dependencies it some become a big mess to deal
> > with so many different group of options.
> >
> > Is it possible
> >
> > There is a example of what i would like to do. There you have a part
> > of my admin site hierarchy. I would like to move "Categories" and
> > "Discounts" from the "Product" group to the "Store" group.
> >
> > auth
> >   Groups
> >   Users
> > Contact
> >   Persons
> >   Organizations
> > Product
> >   Categories
> >   Discounts
> > Store
> >   Style
> >   Color
> >   Size
> >
> > How can it be done ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing a model of place from the admin site

2010-08-17 Thread AndyB
I did something similar by subclassing AdminSite and overriding the
index method. Copy the original method from contrib.admin and modify
app_list before you render the template.

It does break breadcrumbs and intermediate app pages (/admin/someapp/)
but with some shameless hackery I fixed this too:

def app_index(self, request, app_label, extra_context=None):
p = request.path.split('/')[-2].replace('_','-')
if p=='cms':
p='general-content'
elif p=='auth':
p='users'
return HttpResponseRedirect('/admin/#'+p)

(this basically redirects /admin/auth/ and /admin/cms/ to a named
anchor on the index page instead)

Andy

On Aug 16, 4:41 pm, Mathieu Leduc-Hamel  wrote:
> Hi all,
>
> I'm currently developing a e-commerce website using satchmo and
> django. I would like to simplify the admin pannel from the user
> perspective. This is why i would like to change the different group of
> models. Right now, these group are organized by application. But when
> using some external dependencies it some become a big mess to deal
> with so many different group of options.
>
> Is it possible
>
> There is a example of what i would like to do. There you have a part
> of my admin site hierarchy. I would like to move "Categories" and
> "Discounts" from the "Product" group to the "Store" group.
>
> auth
>   Groups
>   Users
> Contact
>   Persons
>   Organizations
> Product
>   Categories
>   Discounts
> Store
>   Style
>   Color
>   Size
>
> How can it be done ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: multiple forms for same model

2010-08-17 Thread Mess
Thx both for helping, I guess there isn't a straight forward solution,
I'll prob add the missing fields manually.

However I still don't get why contract_form.is_valid() doesn't return
true since contract_form still contains the correct data when viewing
in browser.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL Newbie question

2010-08-17 Thread Xavier Ordoquy
Hi,

On top of the package found on mysql, you have to check that mysql_config is in 
the path (it is provided by the package).
In a shell just run the command.
If you just installed the mysql package for osx, you will want to open a new 
shell to get an updated path.

Regards,
Xavier.

Le 16 août 2010 à 21:21, Bradley Hintze a écrit :

> Hi all,
> 
> I'm trying to install MySQL for Python on Snow Leopard and I get :
> 
> sh: mysql_config: command not found
> Traceback (most recent call last):
>  File "setup.py", line 15, in 
>metadata, options = get_config()
>  File "/Users/bradleyhintze/Desktop/MySQL-python-1.2.3/setup_posix.py",
> line 43, in get_config
>libs = mysql_config("libs_r")
>  File "/Users/bradleyhintze/Desktop/MySQL-python-1.2.3/setup_posix.py",
> line 24, in mysql_config
>raise EnvironmentError("%s not found" % (mysql_config.path,))
> EnvironmentError: mysql_config not found
> 
> 
> There is a lot of supposed help online for this but after a few hors
> of googling I have yet to find mysql_config on my machine. Is there
> another package that I must install first?
> 
> -- 
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.