Django-Mysql

2010-06-22 Thread Eduan
When installing Django-Mysql i get this error. I thought it was
because I didn't have setuptools. But now I downloaded it and
installed it. I am running windows 7 home basic. Here is all the apps
versions:

Django-1.2.1
MySQL-python-1.2.3
Python 2.6
mysql-5.5.3-m3-win32

This is the error I get:

setup_windows.py", line 7, in get_config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
options['registry_key'])
WindowsError: [Error 2] The system cannot find the file specified


Any reply would be appreciated.


Regards
Eduan Bekker

-- 
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: Deploying Django with mod_wsgi

2010-06-22 Thread commonzenpython
thanks, i have read your post and i am beginning to understand this
better, i am also trying mod_python as an alternative my project path
is the same /home/ashtanga/public_html/ash
insdie the ash is my Django project and iside it i have my settings.py
and urls.py, i have added the following script to the httpd.conf
file :


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
PythonOption django.root /ash
PythonDebug On
PythonPath "['/home/ashtanga/public_html/ash'] + sys.path"


but i keep getting this error :


MOD_PYTHON ERROR

ProcessId:  11275
Interpreter:'ashtangayogavideo.com'

ServerName: 'ashtangayogavideo.com'
DocumentRoot:   '/home/ashtanga/public_html'

URI:'/ash/'
Location:   '/ash/'
Directory:  None
Filename:   '/home/ashtanga/public_html/ash/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1128, in _execute_target
result = object(arg)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 228, in handler
return ModPythonHandler()(req)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 201, in __call__
response = self.get_response(request)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 177, in handle_uncaught_exception
if resolver.urlconf_module is None:

  File "/usr/local/lib/python2.4/site-packages/django/core/
urlresolvers.py", line 238, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)

  File "/usr/local/lib/python2.4/site-packages/django/utils/
importlib.py", line 35, in import_module
__import__(name)

ImportError: No module named ash.urls

i have read several posts on the same subject but none of the fixes
provided in them solve the problem

-- 
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: Deploying Django with mod_wsgi

2010-06-22 Thread Kenneth Gonsalves
On Tuesday 22 June 2010 11:08:00 commonzenpython wrote:
> PythonPath "['/home/ashtanga/public_html/ash'] + sys.path"
> 

PythonPath "['/home/ashtanga/public_html/'] + sys.path"

and make sure you have an __init__.py file in your 'ash' directory
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
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: One to many django pagination

2010-06-22 Thread euan.godd...@googlemail.com
If i understand you correctly you've got a couple of solutions. You
can define a "through" relationship between Student and Teacher usinf
Techer_profile as the "through" table (http://docs.djangoproject.com/
en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships).
Then you should be able to do:

teachers = Teacher.objects.filter(student__name="Jonny")

I think the ORM should take care of this query for you and select only
those teachers.

Euan

On Jun 22, 3:39 am, Jx  wrote:
> Hi,
>
> i recently encountered a problem due to inefficient performance of
> django pagination. After researching, i realized that there is a need
> to use django database queries when dealing with django-pagination as
> "LIMIT" will automatically be added. This is useful especially when
> dealing with huge chunk of data.
>
> However, i came across a problem where i could not figure out how to
> use django database query to extract the data.
>
> Lets say i have 3 tables, "Teachers", "Students", and
> "Teachers_profile" with a one-many relationship.
>
> The Teacher table contains teacher_id,.(teacher info)
> The Student table contains student_id,name,...(student info)
> The Teacher_profile table is the link between the 2 tables. It
> contains teacher_id,student_id
>
> How can i use django database query with filters to extract the
> teachers who is managing a student named "Jonny" for example?
>
> i'm not sure if this is an easy question, but i'm having some trouble
> in solving it :(

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: automatic documentation (docutils) does not pull in class methods?

2010-06-22 Thread euan.godd...@googlemail.com
You could try using Spinhx if you don't think docutils gives you
enough flexibility. The autodoc extension is great.

On Jun 22, 5:24 am, pk  wrote:
> Answering my own question -- it is django.contrib.admindocs.view that
> limits the admindocs view to only list methods on a model that has a
> single argument. The lines:
>
>   for func_name, func in model.__dict__.items():
>           if (inspect.isfunction(func) and len(inspect.getargspec(func)
> [0]) == 1):
>
> There is currently an open tickethttp://code.djangoproject.com/ticket/12974
> that patches it to handle
> the case where methods have decorator on them, hence reducing the
> number of args to zero.
>
> My question is why are we limiting the list of methods to single
> argument (self) methods?
> I put business logic in the model and usually the models will have
> many more methods
> that take additional arguments.
>
> P.K.

-- 
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: djapian not working with apach2

2010-06-22 Thread watad
thanks Skylar i have used chmod 777 -R for /index , but it didnt work
maybe because as u said the owner of the web process is different than
the user im using
anyway i used the absolute path as  Graham suggested down and it is
working fine
thank you for your quick response

On Jun 21, 9:59 pm, Skylar Saveland  wrote:
> I would guess that you are trying to access /index with the webserver
> user but that is owned by another user and the user that owns the web
> process has not the sufficient permissions to do the attempted
> operation.  Set the permissions on the directory accordingly, perhaps
> ownership as well.  You could just nuke the permissions with a chmod
> 777 /index (or so) if security is not crucial.  Otherwise you need to
> give permissions to the dir to your webserver user in a less nukular
> way.
>
> You could also run the wsgi process(es) as the user of your choice
> using 
> perhapshttp://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDae...
> hope that helps.
>
> On Jun 21, 10:03 am, watad  wrote:
>
>
>
> > hi all,
>
> > im using djapian for my search , it seems to work fine when i run it
> > in django development server
> > but when i configure my sites to use apach2 im always getting this
> > error when i try to search :
>
> > "Caught OSError while rendering: [Errno 13] Permission denied: '/
> > index'"
> > i am sure it is not a folder permission issue because when i run my
> > sites using ./manage.py runserver   i get the results of my search.
>
> > im using mod_wsgi
>
> > my locasites.conf :
>
> > # ---
>
> > 
> >     ServerName mysite.name
> >     ServerAlias mysitealias
>
> >     WSGIScriptAlias / "/path/to/my/apache/file.wsgi"
> >     
> >         Allow from all
> >     
>
> >     Alias /site_media/ "/path/to/mysite/media/"
> >     
> >         Order allow,deny
> >         Options Indexes FollowSymLinks
> >         Allow from all
> >         IndexOptions FancyIndexing
> >     
>
> >     Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/
> > contrib/admin/media/"
> >      > admin/media/">
> >         Order allow,deny
> >         Options Indexes FollowSymLinks
> >         Allow from all
> >         IndexOptions FancyIndexing
> >     
>
> > 
>
> >  this is repeated for all the sites.
>
> > can anyone help with issue
> > regards

-- 
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: djapian not working with apach2

2010-06-22 Thread watad
thanks a lot Graham!!! :) i used absolute path and it is working fine

On Jun 22, 3:01 am, Graham Dumpleton 
wrote:
> On Jun 22, 12:03 am, watad  wrote:
>
>
>
>
>
> > hi all,
>
> > im using djapian for my search , it seems to work fine when i run it
> > in django development server
> > but when i configure my sites to use apach2 im always getting this
> > error when i try to search :
>
> > "Caught OSError while rendering: [Errno 13] Permission denied: '/
> > index'"
> > i am sure it is not a folder permission issue because when i run my
> > sites using ./manage.py runserver   i get the results of my search.
>
> > im using mod_wsgi
>
> > my locasites.conf :
>
> > # ---
>
> > 
> >     ServerName mysite.name
> >     ServerAlias mysitealias
>
> >     WSGIScriptAlias / "/path/to/my/apache/file.wsgi"
> >     
> >         Allow from all
> >     
>
> >     Alias /site_media/ "/path/to/mysite/media/"
> >     
> >         Order allow,deny
> >         Options Indexes FollowSymLinks
> >         Allow from all
> >         IndexOptions FancyIndexing
> >     
>
> >     Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/
> > contrib/admin/media/"
> >      > admin/media/">
> >         Order allow,deny
> >         Options Indexes FollowSymLinks
> >         Allow from all
> >         IndexOptions FancyIndexing
> >     
>
> > 
>
> >  this is repeated for all the sites.
>
> > can anyone help with issue
>
> Don't use relative path names in your code, you must use absolute path
> names.
>
> As the current working directory under Apache is usually '/', relative
> path names will resolve relative to that and not your site directory
> as with runserver. Thus, if you have simple 'index' in your code as
> relative path name, that will resolve to '/index' and because Apache
> user cannot write to '/' directory you will get an OSError like you
> are seeing.
>
> Graham

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: One to many django pagination

2010-06-22 Thread jx jx
Oh, i guess i didn't define my models using the "through" relationship.
Thanks for the help! :)

On Tue, Jun 22, 2010 at 4:10 PM, euan.godd...@googlemail.com <
euan.godd...@gmail.com> wrote:

> If i understand you correctly you've got a couple of solutions. You
> can define a "through" relationship between Student and Teacher usinf
> Techer_profile as the "through" table (http://docs.djangoproject.com/
> en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships
> ).
> Then you should be able to do:
>
> teachers = Teacher.objects.filter(student__name="Jonny")
>
> I think the ORM should take care of this query for you and select only
> those teachers.
>
> Euan
>
> On Jun 22, 3:39 am, Jx  wrote:
> > Hi,
> >
> > i recently encountered a problem due to inefficient performance of
> > django pagination. After researching, i realized that there is a need
> > to use django database queries when dealing with django-pagination as
> > "LIMIT" will automatically be added. This is useful especially when
> > dealing with huge chunk of data.
> >
> > However, i came across a problem where i could not figure out how to
> > use django database query to extract the data.
> >
> > Lets say i have 3 tables, "Teachers", "Students", and
> > "Teachers_profile" with a one-many relationship.
> >
> > The Teacher table contains teacher_id,.(teacher info)
> > The Student table contains student_id,name,...(student info)
> > The Teacher_profile table is the link between the 2 tables. It
> > contains teacher_id,student_id
> >
> > How can i use django database query with filters to extract the
> > teachers who is managing a student named "Jonny" for example?
> >
> > i'm not sure if this is an easy question, but i'm having some trouble
> > in solving it :(
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-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.



Django c _imaging module not installed

2010-06-22 Thread appel268576
Hi there.

For the last week or so I have been having real issues with getting
Django / python and libjpeg to play nice.
However successfully followed loads of threads and comments and got my
own solution.

Secondly I have applied this solution so that it works successfully on
my production server.

Question I have though is why does it still not pick up the _imaging
module.

Here are the steps I took.

I already had jpeg-7 and Imaging-1.1.7 on my server.

I removed /opt/python2.6/lib/python2.6/site-packages/PIL and the
PIL.pth file

I deleted Imaging-1.1.7 and replaced it with 1.1.6 (as this is
supposedly more stable)

I then cd'd into my src directory where all my source files are.

in jpeg-7 i ran the following statements.

  sudo make clean (this removed all previuses build and all references
to *jpeg*)
  sudo ./configure --enable-shared --enable-static
  sudo make
  sudo make install

then cd'd into my Imaging-1.1.6 directory and ran the following

  sudo rm -Rf build (to remove any previous builds)
  sudo python setup.py build
  sudo python setup.py install
  sudo python selftest.py (57 test passed) no errors.

then i go into my directory where my django app lives and I execute
the following

  python manage.py shell
  import Image (no errors)
  import PIL (no errors)
  import _imaging (no errors)
  i = Image.open("/path/to/my/image.jpeg")
  i.save("/path/to/my/new_image.jpeg")

works without any errors.

However... running the admin through django still causes me "c
_imaging module not installed"

Any help would 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: Force ContentType id

2010-06-22 Thread donato.gr
Thank you,
your explanation was very clear and useful.

> > Or, is there a way to run a syncdb to apply changes without losing
> > data?

Our software product is under development and sometimes we have the
need to change a model definition (e.g. rename a field or change its
definition):
is there a way to make syncdb understand that the model has changed
and then make all necessary 'ALTER TABLE' queries?
I found some topics about tools such as 'django evolution' but I was
wondering if Django itself provides a simpler way to make simple
alterations...


Thanks,
Donato

-- 
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: Force ContentType id

2010-06-22 Thread Simon Brunning
On 22 June 2010 09:58, donato.gr  wrote:
> I found some topics about tools such as 'django evolution' but I was
> wondering if Django itself provides a simpler way to make simple
> alterations...

It's not built in to Django, but it sounds like you want South -
.

-- 
Cheers,
Simon B.

-- 
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-autofixture giving import error (no module named keyczar)

2010-06-22 Thread watad
hi all
did anyone used django-autofixture , i followed the instructions on
this link :
http://pypi.python.org/pypi/django-autofixture/0.2.2
i installed django-autofixture
added the 'autofixture' to my INSTALLED_APPS
 for example my app name is company , my model name is product
i use this command :
django-admin.py loadtestdata company.product:3
it is failing for all models with the same error:

Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
__init__.py", line 438, in execute_manager
utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/
base.py", line 218, in execute
output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/django/db/
transaction.py", line 299, in _commit_on_success
res = func(*args, **kw)
  File "/usr/local/lib/python2.6/dist-packages/autofixture/management/
commands/loadtestdata.py", line 192, in handle
autofixture.autodiscover()
  File "/usr/local/lib/python2.6/dist-packages/autofixture/
__init__.py", line 168, in autodiscover
import_module("%s.tests" % app)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/
importlib.py", line 35, in import_module
__import__(name)
  File "/usr/local/lib/python2.6/dist-packages/django_extensions/tests/
__init__.py", line 3, in 
from django_extensions.tests.encrypted_fields import
EncryptedFieldsTestCase
  File "/usr/local/lib/python2.6/dist-packages/django_extensions/tests/
encrypted_fields.py", line 2, in 
from keyczar import keyczar
ImportError: No module named keyczar

anyone faced the same issue
any help ???

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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 c _imaging module not installed

2010-06-22 Thread euan.godd...@googlemail.com
Are you doing some image related work in Django admin?

We have had lots of trouble with libjpeg and PIL. We use PIL 1.1.6 and
libjpeg 6. Our install process requires using apt to install the
libjpeg62-dev package before installing PIL 1.1.6.

If you're using a Debian based OS, I'd remove your custom compiled
libjpeg and then install the above package via apt and then try again.

Are you installing PIL system-wide with easy_install or is it in a
virtualenv?

Euan

On Jun 22, 9:42 am, appel268576  wrote:
> Hi there.
>
> For the last week or so I have been having real issues with getting
> Django / python and libjpeg to play nice.
> However successfully followed loads of threads and comments and got my
> own solution.
>
> Secondly I have applied this solution so that it works successfully on
> my production server.
>
> Question I have though is why does it still not pick up the _imaging
> module.
>
> Here are the steps I took.
>
> I already had jpeg-7 and Imaging-1.1.7 on my server.
>
> I removed /opt/python2.6/lib/python2.6/site-packages/PIL and the
> PIL.pth file
>
> I deleted Imaging-1.1.7 and replaced it with 1.1.6 (as this is
> supposedly more stable)
>
> I then cd'd into my src directory where all my source files are.
>
> in jpeg-7 i ran the following statements.
>
>   sudo make clean (this removed all previuses build and all references
> to *jpeg*)
>   sudo ./configure --enable-shared --enable-static
>   sudo make
>   sudo make install
>
> then cd'd into my Imaging-1.1.6 directory and ran the following
>
>   sudo rm -Rf build (to remove any previous builds)
>   sudo python setup.py build
>   sudo python setup.py install
>   sudo python selftest.py (57 test passed) no errors.
>
> then i go into my directory where my django app lives and I execute
> the following
>
>   python manage.py shell
>   import Image (no errors)
>   import PIL (no errors)
>   import _imaging (no errors)
>   i = Image.open("/path/to/my/image.jpeg")
>   i.save("/path/to/my/new_image.jpeg")
>
> works without any errors.
>
> However... running the admin through django still causes me "c
> _imaging module not installed"
>
> Any help would 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: Django-Mysql

2010-06-22 Thread euan.godd...@googlemail.com
Do you absolutely need to use MySQL? I've found for development that
sqlite is the most hassle-free. I use OS X for development at home and
it is the easiest option. The only drawback is that if you have
multiple clients accessing the DB you can get locking issues. If it's
just you, then you're sorted.

I once installed Django with MySQL on Windows and know I had to mess
around a fair bit to get it to work, but that was quite a while ago.

Good luck, Euan

On Jun 22, 8:02 am, Eduan  wrote:
> When installing Django-Mysql i get this error. I thought it was
> because I didn't have setuptools. But now I downloaded it and
> installed it. I am running windows 7 home basic. Here is all the apps
> versions:
>
> Django-1.2.1
> MySQL-python-1.2.3
> Python 2.6
> mysql-5.5.3-m3-win32
>
> This is the error I get:
>
> setup_windows.py", line 7, in get_config
> serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
> options['registry_key'])
> WindowsError: [Error 2] The system cannot find the file specified
>
> Any reply would be appreciated.
>
> Regards
> Eduan Bekker

-- 
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: outer join in orm

2010-06-22 Thread euan.godd...@googlemail.com
I concur about the weakness in Django, when it is, as you say, a
relatively simple SQL statement to pull in that data.

I'd go for the list comp idea if you've got a small data set.
Alternatively you could select all the answers and then use
itertools.groupby to group by question. That's also efficient as it
won't use a lot of memory to do the transformation.

Euan

On Jun 22, 2:01 am, JeffH  wrote:
> Doing a nested list comp has to be less efficient than an outer join
> done at the db level. For my issue, it's a relatively small data set,
> so I'd rather be more pythonic than eg running raw sql. Nonetheless, I
> view this as a weakness in Django's ORM, and would plead with TPTB to
> provide a solution, not that it would affect my current problem.
>
> On Jun 21, 11:46 am, "euan.godd...@googlemail.com"
>
>  wrote:
> > AFAIK there is no direct way to do this sort of thing in a single
> > query. select_related will only get foreign key relations into the
> > query so the ORM will always do an SQL query for each row in your many
> > to many. In these types of situations I tend to select everything I
> > need and then run some sort of pre-processing to put the two sets
> > together, thus ensuring only 2 queries rather than n+1 (where n is the
> > number of items in your original queryset).
>
> > Scott Gould's answer is about as good as you'll get I reckon.
>
> > On Jun 21, 3:37 pm, JeffH  wrote:
>
> > > That looks reasonable... but I wonder if the ORM can do it directly
> > > somehow. Anyone?
>
> > > On Jun 21, 10:14 am, Scott Gould  wrote:
>
> > > > There may well be a better way to do this, especially since it's been
> > > > a good year since I was struggling with this myself. (Very similar
> > > > case to yours, different subject matter of course.)
>
> > > > The way I ended up doing it was to use a template tag and some list
> > > > comprehensions to whittle things down. E.g.:
>
> > > > questions = Questions.objects.all()
> > > > answers = Answers.objects.filter(candidate=my_candidate)
>
> > > > questions_and_answers = [(q, [a for a in answers if a.question = q])
> > > > for q in questions]
>
> > > > ...which should give you a list of (question, )
> > > > tuples.
>
> > > > On Jun 21, 10:00 am, JeffH  wrote:
>
> > > > > To clarify: Each race has a set of questions. The candidate may have
> > > > > responded to none, some, or all. The answers are linked to the
> > > > > candidate (and to the question). For each candidate, I want to display
> > > > > all the questions, with or without answer. The way it works currently,
> > > > > only the questions with answers get displayed.
>
> > > > > On Jun 21, 8:41 am, Daniel Roseman  wrote:
>
> > > > > > On Jun 21, 12:51 pm, JeffH  wrote:
>
> > > > > > > I have some models that (simplified) look like the following.
>
> > > > > > > class Answer(models.Model):
> > > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > > >     text = models.TextField(blank=False)
> > > > > > >     question = models.ForeignKey(Question)
> > > > > > >     candidate = models.ForeignKey(Candidate)
>
> > > > > > > class Question(models.Model):
> > > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > > >     text = models.TextField(blank=False)
>
> > > > > > > class Candidate(models.Model):
> > > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > > >     name = models.CharField(max_length=32, blank=False)
>
> > > > > > > class Race(models.Model):
> > > > > > >     id = models.CharField(max_length=32, primary_key=True)
> > > > > > >     name = models.CharField(max_length=128, blank=False)
> > > > > > >     questions = models.ManyToManyField(Question)
> > > > > > >     candidates = models.ManyToManyField(Candidate)
>
> > > > > > > So, a Race has Candidates and Questions, and a Candidate has 
> > > > > > > Answers.
> > > > > > > Each answer is associated with a Question and a Candidate. 
> > > > > > > Displaying
> > > > > > > the question associated with an answer is easy:
>
> > > > > > > # context variable in view
> > > > > > >     answers = Answer.objects.filter(candidate=candidate)
>
> > > > > > > # template code
> > > > > > >     
> > > > > > >     {% for answer in answers %}
> > > > > > >     
> > > > > > >         {{answer.question.text}}
> > > > > > >         {{answer.text}}
> > > > > > >     
> > > > > > >     {% endfor %}
> > > > > > >     
>
> > > > > > > From the point of view of the Candidate, I need to display all the
> > > > > > > questions, including the ones without Answers. I know how to to do
> > > > > > > this using raw sql and an outer join. How to do it in the orm?
>
> > > > > > > Thanks in advance for any ideas.
>
> > > > > > > --Jeff
>
> > > > > > Not quite enough information here to answer. What are you wanting to
> > > > > > join? If you just want to display all the questions, why do you 
> > > > > > need a
> > > > > > join at all?
> > > > > > --
> > > > > > DR.

-- 
You received this message because 

Re: escapejs inside {% trans %}

2010-06-22 Thread donato.gr
Thanks,
I'll try it!

On 21 Giu, 15:19, Tom Evans  wrote:
> On Mon, Jun 21, 2010 at 2:17 PM, donato.gr  wrote:
> > Hi,
> > I had this code in a template file:
> > alert('{% trans "a string" %}')
>
> > It gave error when translated bacause the translated string had a '
> > inside. So, I replaced " with ' in the template line and all worked
> > fine.
>
> > To avoid any problem with 'escape chars', is there a way to escape
> > translated strings, like the 'escapejs' filter tag does?
> > Something like "{% trans "a string" | escapejs %}"
>
> > Thank you
>
> Yes, instead of using {% trans "foo" %}, you can use this alternative
> form, for use inside an output tag:
>
> {{ _("foo")|escapejs }}
>
> Cheers
>
> Tom

-- 
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: Force ContentType id

2010-06-22 Thread donato.gr
Thanks,
I'll have a look

On 22 Giu, 11:01, Simon Brunning  wrote:
> On 22 June 2010 09:58, donato.gr  wrote:
>
> > I found some topics about tools such as 'django evolution' but I was
> > wondering if Django itself provides a simpler way to make simple
> > alterations...
>
> It's not built in to Django, but it sounds like you want South -
> .
>
> --
> Cheers,
> Simon B.

-- 
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-Mysql

2010-06-22 Thread Sells, Fred
I had no problem configuring it under CentOs, have not tried Windows (yet) but 
here's my settings file

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mds30', 
'USER': '',  # Not used 
'PASSWORD': '',  # Not used 
'HOST': '',  # Set to empty string for localhost. 
Not used with sqlite3.
'PORT': '',  # Set to empty string for default. Not 
used with sqlite3.
}
}

I did create the database manually; no big deal.

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On 
Behalf Of euan.godd...@googlemail.com
Sent: Tuesday, June 22, 2010 5:43 AM
To: Django users
Subject: Re: Django-Mysql

Do you absolutely need to use MySQL? I've found for development that
sqlite is the most hassle-free. I use OS X for development at home and
it is the easiest option. The only drawback is that if you have
multiple clients accessing the DB you can get locking issues. If it's
just you, then you're sorted.

I once installed Django with MySQL on Windows and know I had to mess
around a fair bit to get it to work, but that was quite a while ago.

Good luck, Euan

On Jun 22, 8:02 am, Eduan  wrote:
> When installing Django-Mysql i get this error. I thought it was
> because I didn't have setuptools. But now I downloaded it and
> installed it. I am running windows 7 home basic. Here is all the apps
> versions:
>
> Django-1.2.1
> MySQL-python-1.2.3
> Python 2.6
> mysql-5.5.3-m3-win32
>
> This is the error I get:
>
> setup_windows.py", line 7, in get_config
> serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
> options['registry_key'])
> WindowsError: [Error 2] The system cannot find the file specified
>
> Any reply would be appreciated.
>
> Regards
> Eduan Bekker

-- 
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.



Django-registration and backend

2010-06-22 Thread Pep
Hi everybody !

I'm installing django-registration but I have a problem in my server
while it works with the runserver.

When I want to go to the register view, the debug mode tell me that :
register() got an unexpected keyword argument 'backend'

Anybody have an idea ?

Thanks !

PEP

-- 
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 need to hire at programmer

2010-06-22 Thread Martino
I need a programmer expert in web python Django and know how to
integrate with front end CSS3


Please send me an email or call me

Martin,

310.592.8152 mvinc...@sgprollc.com http://sgprollc.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.



not able to install django development version

2010-06-22 Thread samie
sir i am not able to install django development version on my machine
i am using vista 32 basic..

problem is occurring during svn checkout command,,

plz help me out..




""
C:\Python26\development\python>svn co http://code.djangoproject.com/svn/django/t
runk/ django-trunk
svn: OPTIONS of 'http://code.djangoproject.com/svn/django/trunk':
could not conn
ect to server (http://code.djangoproject.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: not able to install django development version

2010-06-22 Thread Simon Brunning
On 22 June 2010 12:33, samie  wrote:
> sir i am not able to install django development version on my machine
> i am using vista 32 basic..
>
> problem is occurring during svn checkout command,,

And the problem is?

-- 
Cheers,
Simon B.

-- 
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: not able to install django development version

2010-06-22 Thread Horst Gutmann
The checkout works for me. Are you perhaps behind some HTTP proxy or
firewall that blocks certain HTTP commands? You could also try one of
the project mirrors on github or bitbucket. Perhaps you have more luck
downloading one of these:

http://github.com/django/django
http://bitbucket.org/mirror/django-trunk


On Tue, Jun 22, 2010 at 1:33 PM, samie  wrote:
> sir i am not able to install django development version on my machine
> i am using vista 32 basic..
>
> problem is occurring during svn checkout command,,
>
> plz help me out..
>
>
>
>
> ""
> C:\Python26\development\python>svn co 
> http://code.djangoproject.com/svn/django/t
> runk/ django-trunk
> svn: OPTIONS of 'http://code.djangoproject.com/svn/django/trunk':
> could not conn
> ect to server (http://code.djangoproject.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.
>
>

-- 
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: Deploying Django with mod_wsgi

2010-06-22 Thread commonzenpython
thanks, but what should be inside the __init__.py file ?

-- 
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: Deploying Django with mod_wsgi

2010-06-22 Thread backdoc
nothing.  it's empty

On Tue, Jun 22, 2010 at 8:41 AM, commonzenpython
wrote:

> thanks, but what should be inside the __init__.py file ?
>
> --
> 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.



Sorting objects according to a field from a foreign field

2010-06-22 Thread Benedict Verheyen
I have an issue sorting objects.
First, let me explain the models i'm using:

class Call(models.Model):
...
priority = models.ForeignKey(Priority)

class Priority(models.Model):
title=models.CharField(max_length=30)
description=models.CharField(max_length=255)
weight=models.IntegerField()


I want to sort the calls according to their priority and more exactly the 
weight assigned
to priority.

I haven't found a way to do that.
I would need something like this:
  c=Call.objects.all().order_by('-priority.weight')

Or can i specify the way the Priority class should be sorted?

Thanks,
Benedict

-- 
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.



Question regarding subdomains of a single project

2010-06-22 Thread M Rotch
I'm setting up a website with multiple subdomains, and one thing I
notice right away (and is expected) is that each subdomain has access
to all of the URLs of the website (of course some will require logins
still).


If I have:

http://fooaccount.projectmanagersoftware.com

I wouldn't want them to have access to:

http://fooaccount.projectmanagersoftware.com/accounts/signup/
or http://fooaccount.projectmanagersoftware.com/site/

If they're at www, that's one thing, but it's weird to have all pages
accessible from all subdomains.

If you look at what this company does,

http://demo.bigcartel.com/admin/login is a login page
http://www.bigcartel.com/admin/login is a 404


What's your thoughts?

-- 
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: Sorting objects according to a field from a foreign field

2010-06-22 Thread Daniel Roseman
On Jun 22, 3:34 pm, Benedict Verheyen 
wrote:
> I have an issue sorting objects.
> First, let me explain the models i'm using:
>
> class Call(models.Model):
>     ...
>     priority = models.ForeignKey(Priority)
>
> class Priority(models.Model):
>     title=models.CharField(max_length=30)
>     description=models.CharField(max_length=255)
>     weight=models.IntegerField()
>
> I want to sort the calls according to their priority and more exactly the 
> weight assigned
> to priority.
>
> I haven't found a way to do that.
> I would need something like this:
>   c=Call.objects.all().order_by('-priority.weight')
>
> Or can i specify the way the Priority class should be sorted?
>
> Thanks,
> Benedict

As described in the documentation [1], you use the double-underscore
syntax for sorting across relationships.
Call.objects.all().order_by('-priority__weight')

[1]:http://docs.djangoproject.com/en/1.2/ref/models/querysets/#order-
by-fields
--
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: Sorting objects according to a field from a foreign field

2010-06-22 Thread Benedict Verheyen
On 22/06/2010 16:42, Daniel Roseman wrote:
> 
> As described in the documentation [1], you use the double-underscore
> syntax for sorting across relationships.
> Call.objects.all().order_by('-priority__weight')
> 
> [1]:http://docs.djangoproject.com/en/1.2/ref/models/querysets/#order-
> by-fields
> --
> DR.
> 

Thanks for the quick response.
Hhhm, i searched the docs and didn't see it.

Anyway, i'll try your solution.

In the mean time i found another solution:

- Change the model by adding a default ordering via the Meta class

class Priority:
class Meta:
ordering = ('weight',)

Then this works:
Call.objects.all().order_by('-priority')

Regards,
Benedict


-- 
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: Question regarding subdomains of a single project

2010-06-22 Thread Venkatraman S
On Tue, Jun 22, 2010 at 8:06 PM, M Rotch  wrote:

> I'm setting up a website with multiple subdomains, and one thing I
> notice right away (and is expected) is that each subdomain has access
> to all of the URLs of the website (of course some will require logins
> still).
>
>
hmmm. I think its the way you setup your apache?

-V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Question regarding subdomains of a single project

2010-06-22 Thread Dan Harris
Check out this from djangosnippets: http://djangosnippets.org/snippets/1509/

It allows you to specify multiple URLconfs and then choose which you
are going to use based on the domain name. This would mean that each
of your subdomain gets a different URLconf which sounds like what you
may be looking for.

Cheers,

Dan Harris
dih0...@gmail.com

On Jun 22, 10:59 am, Venkatraman S  wrote:
> On Tue, Jun 22, 2010 at 8:06 PM, M Rotch  wrote:
> > I'm setting up a website with multiple subdomains, and one thing I
> > notice right away (and is expected) is that each subdomain has access
> > to all of the URLs of the website (of course some will require logins
> > still).
>
> hmmm. I think its the way you setup your apache?
>
> -V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Deploying Django with mod_wsgi

2010-06-22 Thread commonzenpython
it turns out i have the __init__.py , so i changed the path as you
suggested but now i get this error :

MOD_PYTHON ERROR

ProcessId:  12182
Interpreter:'ashtangayogavideo.com'

ServerName: 'ashtangayogavideo.com'
DocumentRoot:   '/home/ashtanga/public_html'

URI:'/ash/'
Location:   '/ash/'
Directory:  None
Filename:   '/home/ashtanga/public_html/ash/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "/usr/local/lib/python2.4/site-packages/mod_python/
importer.py", line 1128, in _execute_target
result = object(arg)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 228, in handler
return ModPythonHandler()(req)

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 191, in __call__
self.load_middleware()

  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 33, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/usr/local/lib/python2.4/site-packages/django/utils/
functional.py", line 276, in __getattr__
self._setup()

  File "/usr/local/lib/python2.4/site-packages/django/conf/
__init__.py", line 40, in _setup
self._wrapped = Settings(settings_module)

  File "/usr/local/lib/python2.4/site-packages/django/conf/
__init__.py", line 75, in __init__
raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e))

ImportError: Could not import settings 'settings' (Is it on sys.path?
Does it have syntax errors?): No module named settings

-- 
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: Question regarding subdomains of a single project

2010-06-22 Thread orokusaki
Oh my god! Thanks Dan. I didn't know you could do this. That is
absolutely perfect.

Mark

On Jun 22, 9:38 am, Dan Harris  wrote:
> Check out this from djangosnippets:http://djangosnippets.org/snippets/1509/
>
> It allows you to specify multiple URLconfs and then choose which you
> are going to use based on the domain name. This would mean that each
> of your subdomain gets a different URLconf which sounds like what you
> may be looking for.
>
> Cheers,
>
> Dan Harris
> dih0...@gmail.com
>
> On Jun 22, 10:59 am, Venkatraman S  wrote:
>
> > On Tue, Jun 22, 2010 at 8:06 PM, M Rotch  wrote:
> > > I'm setting up a website with multiple subdomains, and one thing I
> > > notice right away (and is expected) is that each subdomain has access
> > > to all of the URLs of the website (of course some will require logins
> > > still).
>
> > hmmm. I think its the way you setup your apache?
>
> > -V

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



Random

2010-06-22 Thread Waleria
Hello Guys,

I have a system that generate graphs and files .dat. However,  i'm
having a problem, when two people access the system simultaneously may
happen that the graph of a person to replace the second person, what
can I do to make it not happen?

-- 
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: Random

2010-06-22 Thread Javier Guerra Giraldez
On Tue, Jun 22, 2010 at 12:11 PM, Waleria  wrote:
> I have a system that generate graphs and files .dat. However,  i'm
> having a problem, when two people access the system simultaneously may
> happen that the graph of a person to replace the second person, what
> can I do to make it not happen?


you have to get some way to keep both users separate.  one approach
would be to create DB records for each task, and use the record ID as
part of the file name.  another would be to use the session ID.


-- 
Javier

-- 
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: Random

2010-06-22 Thread Waleria
my application doesn't use DBnot able to do this without using the
Random? ... without DB?

On 22 jun, 14:22, Javier Guerra Giraldez  wrote:
> On Tue, Jun 22, 2010 at 12:11 PM, Waleria  wrote:
> > I have a system that generate graphs and files .dat. However,  i'm
> > having a problem, when two people access the system simultaneously may
> > happen that the graph of a person to replace the second person, what
> > can I do to make it not happen?
>
> you have to get some way to keep both users separate.  one approach
> would be to create DB records for each task, and use the record ID as
> part of the file name.  another would be to use the session ID.
>
> --
> Javier

-- 
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: Random

2010-06-22 Thread orokusaki
Name each person's files using:

import uuid
filename = uuid.uuid4()


On Jun 22, 11:30 am, Waleria  wrote:
> my application doesn't use DBnot able to do this without using the
> Random? ... without DB?
>
> On 22 jun, 14:22, Javier Guerra Giraldez  wrote:
>
> > On Tue, Jun 22, 2010 at 12:11 PM, Waleria  wrote:
> > > I have a system that generate graphs and files .dat. However,  i'm
> > > having a problem, when two people access the system simultaneously may
> > > happen that the graph of a person to replace the second person, what
> > > can I do to make it not happen?
>
> > you have to get some way to keep both users separate.  one approach
> > would be to create DB records for each task, and use the record ID as
> > part of the file name.  another would be to use the session ID.
>
> > --
> > Javier

-- 
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: Random

2010-06-22 Thread Waléria Antunes David
i don't understand...

On Tue, Jun 22, 2010 at 3:01 PM, orokusaki  wrote:

> Name each person's files using:
>
> import uuid
> filename = uuid.uuid4()
>
>
> On Jun 22, 11:30 am, Waleria  wrote:
> > my application doesn't use DBnot able to do this without using the
> > Random? ... without DB?
> >
> > On 22 jun, 14:22, Javier Guerra Giraldez  wrote:
> >
> > > On Tue, Jun 22, 2010 at 12:11 PM, Waleria 
> wrote:
> > > > I have a system that generate graphs and files .dat. However,  i'm
> > > > having a problem, when two people access the system simultaneously
> may
> > > > happen that the graph of a person to replace the second person, what
> > > > can I do to make it not happen?
> >
> > > you have to get some way to keep both users separate.  one approach
> > > would be to create DB records for each task, and use the record ID as
> > > part of the file name.  another would be to use the session ID.
> >
> > > --
> > > Javier
>
> --
> 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: Random

2010-06-22 Thread Waléria Antunes David
in my application the file .dat and the image...i save in a directory in my
computer.so i'm having problem when two people access the same time.

On Tue, Jun 22, 2010 at 3:01 PM, orokusaki  wrote:

> Name each person's files using:
>
> import uuid
> filename = uuid.uuid4()
>
>
> On Jun 22, 11:30 am, Waleria  wrote:
> > my application doesn't use DBnot able to do this without using the
> > Random? ... without DB?
> >
> > On 22 jun, 14:22, Javier Guerra Giraldez  wrote:
> >
> > > On Tue, Jun 22, 2010 at 12:11 PM, Waleria 
> wrote:
> > > > I have a system that generate graphs and files .dat. However,  i'm
> > > > having a problem, when two people access the system simultaneously
> may
> > > > happen that the graph of a person to replace the second person, what
> > > > can I do to make it not happen?
> >
> > > you have to get some way to keep both users separate.  one approach
> > > would be to create DB records for each task, and use the record ID as
> > > part of the file name.  another would be to use the session ID.
> >
> > > --
> > > Javier
>
> --
> 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: Random

2010-06-22 Thread Javier Guerra Giraldez
On Tue, Jun 22, 2010 at 12:30 PM, Waleria  wrote:
> my application doesn't use DBnot able to do this without using the
> Random? ... without DB?

you only need some unique identifier.  it can be random, or an UUID,
if you can track it, maybe in a cookie, or passed on URL parameters,
or if you're using sessions, try the session ID.  or the IP/port of
the client. anything that can be different but consistent.

-- 
Javier

-- 
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.



Fields validating as optional

2010-06-22 Thread Jonathan Hayward
What is the preferred way to make e.g. a TextField that will pass validation
if it is left empty? I've seen two approaches apparently referenced in the
documentation:

additional_comments = models.TextField(required = False)

additional_comments = models.TextField(blank = True)

and run into errors with the first. Does this mean that I should go with the
second, or is there another way that is preferred?

I'm using 1.2.

-- 
→ Jonathan Hayward, christos.jonathan.hayw...@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.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: Fields validating as optional

2010-06-22 Thread Dan Harris
Jonathan,

I think what you are running into is the differences between how
models are declared vs how forms are declared. In models you declare
the fields as blank=True and/or null=True to specify that the data
stored in the database can be left blank. Something like this:

class MyModel(models.Model):
additional_comments = models.TextField(blank=True)

When declaring a form, nothing is directly stored in the database so
the keyword 'required' is used. For example:

class MyForm(forms.Form):
   additional_comments = forms.TextField(required=False)

If you are creating a form from a model, blank=True inside the models
is transformed into required=False for the form.

class MyModelForm(forms.ModelForm):
class Meta:
model = MyModel

Hope this helps!

Dan Harris
dih0...@gmail.com


On Jun 22, 4:11 pm, Jonathan Hayward
 wrote:
> What is the preferred way to make e.g. a TextField that will pass validation
> if it is left empty? I've seen two approaches apparently referenced in the
> documentation:
>
>     additional_comments = models.TextField(required = False)
>
>     additional_comments = models.TextField(blank = True)
>
> and run into errors with the first. Does this mean that I should go with the
> second, or is there another way that is preferred?
>
> I'm using 1.2.
>
> --
> → Jonathan Hayward, christos.jonathan.hayw...@gmail.com
> → An Orthodox Christian author: theology, literature, et cetera.
> → My award-winning collection is available for free reading online:
> ☩ I invite you to visit my main site athttp://JonathansCorner.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: Fields validating as optional

2010-06-22 Thread Daniel Roseman
On Jun 22, 9:11 pm, Jonathan Hayward
 wrote:
> What is the preferred way to make e.g. a TextField that will pass validation
> if it is left empty? I've seen two approaches apparently referenced in the
> documentation:
>
>     additional_comments = models.TextField(required = False)
>
>     additional_comments = models.TextField(blank = True)
>
> and run into errors with the first. Does this mean that I should go with the
> second, or is there another way that is preferred?
>
> I'm using 1.2.

The first is just wrong, and certainly isn't documented in that form.
You seem to have wrongly conflated some of the syntax from the forms
documentation with the models docs.

Model fields take blank=True/False. Form fields take
'required=False' (or True) as a parameter. However, the field in that
case would be forms.CharField, not models.TextField.
--
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.



Search near people with geoposition or charfield

2010-06-22 Thread Alexandre González
Hi!

I like to user something as django-people have to search people near to me.
I have a charfield in my model that could be a address as "Salamanca, Spain"
or a GPS position sended by the mobile app.

Where can I start to read about that? And please, don't say me that read the
django-people code because it's huge! and I'm beginner :p

Bye & thanks,
Álex González

-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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.



virtual currency / check-in apps

2010-06-22 Thread Greg Pelly
Can anyone recommend any apps/tools for implementing either virtual currency
or "check-ins" in Django?

Thanks,

Greg

-- 
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 options by limited_choices_to ?

2010-06-22 Thread cat in a tub
Hi All,

I want to built a django application for hardware compatibility
testing
Some hardwares are compatible with certain mother board. And
attributes of each hardware are different (I use a ugly table to store
attributes), which are compatible with Hardware types, such as MEM as
SIZE, HDD has Firmware ver...

class HardwareType
...

class Hardware
type=models.ForeighKey('HardwareType')
hardware_type=models.ForeignKey('HardwareType',
limited_choice_to{'compatible_type':self.type})
attribute=ManyToManyField('hardwareAttribute')

class HardwareAttribute
compatible_type=models.ForeighKey('HardwareType')

I use limited_choice_to to limit the available options in the admin
(show compatible ones only)
But it doesn't work. The error is 'self is undefined ...'

Any one here has any idea how to to this ?

Thanking you in advance.

Homer

-- 
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.



Forms - Widget - Radioselect - how to set initial value on a static form

2010-06-22 Thread Roboto
I can't seem to find documentation on this anywhere, so I imagine
someone must have run into this.

if I had a radioselect Yes / No and I wanted the default value to be
'No', but I'm not loading this data from a database or anything, is
there a method to just insert an initial value so that the html comes
out as No

?

Any ideas? This is so basic it's killing me.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Fields validating as optional

2010-06-22 Thread Jonathan Hayward
Thanks, Dan and Daniel.

On Tue, Jun 22, 2010 at 3:45 PM, Daniel Roseman wrote:

> On Jun 22, 9:11 pm, Jonathan Hayward
>  wrote:
> > What is the preferred way to make e.g. a TextField that will pass
> validation
> > if it is left empty? I've seen two approaches apparently referenced in
> the
> > documentation:
> >
> > additional_comments = models.TextField(required = False)
> >
> > additional_comments = models.TextField(blank = True)
> >
> > and run into errors with the first. Does this mean that I should go with
> the
> > second, or is there another way that is preferred?
> >
> > I'm using 1.2.
>
> The first is just wrong, and certainly isn't documented in that form.
> You seem to have wrongly conflated some of the syntax from the forms
> documentation with the models docs.
>
> Model fields take blank=True/False. Form fields take
> 'required=False' (or True) as a parameter. However, the field in that
> case would be forms.CharField, not models.TextField.
> --
> 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.
>
>


-- 
→ Jonathan Hayward, christos.jonathan.hayw...@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.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: Deploying Django with mod_wsgi

2010-06-22 Thread Graham Dumpleton


On Jun 23, 2:35 am, commonzenpython  wrote:
> it turns out i have the __init__.py , so i changed the path as you
> suggested but now i get this error :
>
> MOD_PYTHON ERROR
>
> ProcessId:      12182
> Interpreter:    'ashtangayogavideo.com'
>
> ServerName:     'ashtangayogavideo.com'
> DocumentRoot:   '/home/ashtanga/public_html'
>
> URI:            '/ash/'
> Location:       '/ash/'
> Directory:      None
> Filename:       '/home/ashtanga/public_html/ash/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/
> importer.py", line 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/
> importer.py", line 1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/
> importer.py", line 1128, in _execute_target
>     result = object(arg)
>
>   File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 228, in handler
>     return ModPythonHandler()(req)
>
>   File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 191, in __call__
>     self.load_middleware()
>
>   File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 33, in load_middleware
>     for middleware_path in settings.MIDDLEWARE_CLASSES:
>
>   File "/usr/local/lib/python2.4/site-packages/django/utils/
> functional.py", line 276, in __getattr__
>     self._setup()
>
>   File "/usr/local/lib/python2.4/site-packages/django/conf/
> __init__.py", line 40, in _setup
>     self._wrapped = Settings(settings_module)
>
>   File "/usr/local/lib/python2.4/site-packages/django/conf/
> __init__.py", line 75, in __init__
>     raise ImportError("Could not import settings '%s' (Is it on
> sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
> e))
>
> ImportError: Could not import settings 'settings' (Is it on sys.path?
> Does it have syntax errors?): No module named settings

The advice is the same as for mod_wsgi, add both paths:

  PythonPath "['/home/ashtanga/public_html/', '/home/ashtanga/
public_html/ash'] + sys.path"

Also remove the trailing slash from Location URL and you may as well
put prefix back on settings module.

Thus use:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE ash.settings
PythonOption django.root /ash
PythonDebug On
PythonPath PythonPath "['/home/ashtanga/public_html/', '/home/
ashtanga/public_html/ash'] + sys.path"


Graham

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Forms - Widget - Radioselect - how to set initial value on a static form

2010-06-22 Thread Karen Tracey
On Tue, Jun 22, 2010 at 9:46 PM, Roboto  wrote:

> I can't seem to find documentation on this anywhere, so I imagine
> someone must have run into this.
>
> if I had a radioselect Yes / No and I wanted the default value to be
> 'No', but I'm not loading this data from a database or anything, is
> there a method to just insert an initial value so that the html comes
> out as No
>
> ?
>
> Any ideas? This is so basic it's killing me.
>

You say RadioSelect widget but you mention HTML that doesn't go with a radio
input type -- option goes with a  construct? If you showed some
code for what you are trying it might help people help you. The way to
specify the initially-selection option for a RadioSelect is to specify it as
the initial value for the associated form field. For example:

class F1(forms.Form):
rs_field = forms.ChoiceField(choices=(('Y','Yes'), ('N','No')),
initial='N', widget=forms.RadioSelect)

which would render (unbound) as:

Rs field:
 Yes
 No<
/label>


...with the "No" radio input initially selected, since it specified the
checked attribute.

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: not able to install django development version

2010-06-22 Thread samie


On Jun 22, 5:32 pm, Simon Brunning  wrote:
> On 22 June 2010 12:33, samie  wrote:
>
> > sir i am not able to install django development version on my machine
> > i am using vista 32 basic..
>
> > problem is occurring during svn checkout command,,
>
> And the problem is?
>
> --
> Cheers,
> Simon B.




dis is my problem  i get dis message when i enter svn check out
command on my prompt...



C:\Python26\development\python>svn co http://code.djangoproject.com/svn/django/t
runk/ django-trunk
svn: OPTIONS of 'http://code.djangoproject.com/svn/django/trunk':
could not conn
ect to server (http://code.djangoproject.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: not able to install django development version

2010-06-22 Thread samie


On Jun 22, 6:41 pm, Horst Gutmann  wrote:
> The checkout works for me. Are you perhaps behind some HTTP proxy or
> firewall that blocks certain HTTP commands? You could also try one of
> the project mirrors on github or bitbucket. Perhaps you have more luck
> downloading one of these:
>
> http://github.com/django/djangohttp://bitbucket.org/mirror/django-trunk
>
>
>
> On Tue, Jun 22, 2010 at 1:33 PM, samie  wrote:
> > sir i am not able to install django development version on my machine
> > i am using vista 32 basic..
>
> > problem is occurring during svn checkout command,,
>
> > plz help me out..
>
> > ""
> > C:\Python26\development\python>svn 
> > cohttp://code.djangoproject.com/svn/django/t
> > runk/ django-trunk
> > svn: OPTIONS of 'http://code.djangoproject.com/svn/django/trunk':
> > could not conn
> > ect to server (http://code.djangoproject.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 
> > athttp://groups.google.com/group/django-users?hl=en.



thank u sir for ur valuable reply...

-- 
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: not able to install django development version

2010-06-22 Thread Kenneth Gonsalves
On Wednesday 23 June 2010 10:07:48 samie wrote:
> could not conn
> ect to server (http://code.djangoproject.com)""
> 

check your internet connection
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
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.



Newbie Question about django-admin.py startproject

2010-06-22 Thread Jacob Shiach
Ok, I am trying to start a project with Django and failing miserably.

I open Python IDLE, Type "import django" then  type "django-admin.py
startproject testsite" and get a SyntaxError:invalid syntax.

Does anyone know where I am going wrong here?

Note: I installed both Python 2.6.5 and Djang 1.1.1 with the Ubuntu
package manager.

-- 
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: Newbie Question about django-admin.py startproject

2010-06-22 Thread Sam Lai
'import django' is a command for the Python interpreter.

'django-admin.py startproject testsite' is a standard shell command.

Just open up a console window, and type the latter into it. If it
doesn't work, it means your PATH variable doesn't contain the Django
sources.

On 23 June 2010 15:27, Jacob Shiach  wrote:
> Ok, I am trying to start a project with Django and failing miserably.
>
> I open Python IDLE, Type "import django" then  type "django-admin.py
> startproject testsite" and get a SyntaxError:invalid syntax.
>
> Does anyone know where I am going wrong here?
>
> Note: I installed both Python 2.6.5 and Djang 1.1.1 with the Ubuntu
> package manager.
>
> --
> 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.