Re: App Name in Admin

2008-11-25 Thread Daniel Roseman

On Nov 26, 6:57 am, "Steve Phillips" <[EMAIL PROTECTED]> wrote:
> Hi All
>
> I have been searching through the list and IRC archives all day and
> haven't found anything recent about changing the name that's displayed
> for a app on the admin page?  Before I go and just 'write my way
> around it', does anyone know of a shortcut to do it?
>
> Thanks in advance,
> Steve

I think you want to add a verbose_name setting in the model's inner
Meta class.

http://docs.djangoproject.com/en/dev/ref/models/options/#verbose-name

--
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin form

2008-11-25 Thread Daniel Roseman

On Nov 25, 12:16 pm, Praveen <[EMAIL PROTECTED]> wrote:
> Hi All, i am very new bie of Django, i have started work on before 3
> days.
> I am following DJango book. I am playing with 6 chapter "Using the
> admin interface"
> In my urls.py file i set the url for admin
>
> from django.conf.urls.defaults import *
> urlpatterns = patterns('',
>     # Example:
>     # (r'^blog/', include('blog.foo.urls')),
>     (r"^admin/", include("django.contrib.admin.urls")),
>     (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> )
>
> but when i am running in browserhttp://127.0.0.1:8000/adminits
> giving me error
> File "/usr/lib/python2.4/site-packages/django/core/servers/
> basehttp.py", line 277, in run
>     self.result = application(self.environ, self.start_response)
>
>   File "/usr/lib/python2.4/site-packages/django/core/servers/
> basehttp.py", line 634, in __call__
>     return self.application(environ, start_response)
>
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> wsgi.py", line 239, in __call__
>     response = self.get_response(request)
>
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 67, in get_response
>     response = middleware_method(request)
>
>   File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> line 72, in process_request
>     urlresolvers.resolve("%s/" % request.path_info)
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 244, in resolve
>     return get_resolver(urlconf).resolve(path)
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 180, in resolve
>     sub_match = pattern.resolve(new_path)
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 178, in resolve
>     for pattern in self.urlconf_module.urlpatterns:
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 197, in _get_urlconf_module
>     self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> ImportError: No module named urls
>
> and when i checked manually in that directory there were no urls.py
> file
> in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> how may i resolve that problem. i followed each and every steps of
> Django book
>
> Thanks

The Django book is out of date. Are you running version 1.0? If so
you'll need to follow the online documentation, instead of the book.

See http://docs.djangoproject.com/en/dev/ref/contrib/admin/--
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



image resizing

2008-11-25 Thread please smile
  Hi All,

Can Any one help me to resize all types of (like jpeg,gif ect)
images.
This code only useful to upload Jpeg images only. When I upload a
image 'thumbnail' folder has two images   and when I delete the image only
one image is deleted from folder(Resized image or thumbnail image ).I need
to delete both the images .
Please advise me.
thanks.

models.py
`

from __future__ import division
import os
import tempfile
import Image
from django.core.files import File



class Picture(models.Model):
name = models.CharField(max_length=200)
thumbnail = models.ImageField(upload_to='thumbnail')

def save(self, force_update=False, force_insert=False):
   orig = Image.open(self.thumbnail.path)
   name = os.path.basename(self.thumbnail.name)
   width = 100
   height = 100
   thumb = orig.resize((width, height), Image.ANTIALIAS)
   thumb_file = tempfile.NamedTemporaryFile('w+b')
   thumb.save(thumb_file,'JPEG')
   self.thumbnail.save(name, File(thumb_file), False)
   thumb_file.close() #tempfile is deleted upon close:)
   super(Picture, self).save(force_update, force_insert)

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



Re: mark_safe() not working for me

2008-11-25 Thread Lars Stavholm

Right you are Daniel, works like a charm, thank you!
/L

Daniel Roseman wrote:
> On Nov 25, 4:50 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> I'm trying to influence one of the admin interface change list
>> fields by using the below get_progress() method in list_display,
>> and using mark_safe().
>>
>> However, I can't get this to work:
>>
>> class Job(models.Model):
>>  progress = models.PositiveSmallIntegerField()
>>
>>  def get_progress(self):
>>  snippet = u"Progress is %d" % self.progress
>>  return mark_safe(snippet)
>>
>> What happens is that the "" and "" gets translated into
>> "

" and "

" in the output. I thought mark_safe() >> would help me to avoid that. Obviously not right. >> >> Is there another way to tell django not to escape the output? >> >> Any ideas appreciated >> /Lars > > To get HTML into the change_list view, you need to use allow_tags: > > def get_progress(self): > snippet = u"Progress is %d" % self.progress > return mark_safe(snippet) > get_progress.allow_tags=True > > -- > 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

App Name in Admin

2008-11-25 Thread Steve Phillips

Hi All

I have been searching through the list and IRC archives all day and
haven't found anything recent about changing the name that's displayed
for a app on the admin page?  Before I go and just 'write my way
around it', does anyone know of a shortcut to do it?

Thanks in advance,
Steve

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



Re: pythonpath problem

2008-11-25 Thread Graham Dumpleton



On Nov 26, 5:38 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
> Right. And the PythonPath directive ought to do the trick, but it
> clearly isn't. The server belongs to a friend who gave me permission
> to everything under the redfenceproject.com directory (one above
> redfence), and I created the apps folder, so I'm not sure what the
> problem is.

Where else in main Apache configuration files or .htaccess files is
PythonPath directive mentioned?

Can you better describe the directory hierarchy and not say '...'.
Actual directory listings (ls -las) of each of the directories you
have already added to PythonPath would help.

This would be so much more predictable if using mod_wsgi. Python path
stuff in mod_python is a PITA and causes so many problems, although
documentation for mod_python setup doesn't help much. :-(

BTW, what version of mod_python are you using?

Graham

> On Nov 25, 10:29 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 26, 5:13 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> > > I have a handful of apps in that folder. I can add it to sys.path
> > > using sys.path.insert(0, path) and they import fine after, but that
> > > only lasts one session. How do I make it stick?
>
> > That is what PythonPath directive is for.
>
> > Graham
>
> > > On Nov 25, 5:28 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > On Tue, 2008-11-25 at 14:55 -0800, Chris Amico wrote:
> > > > > Hi folks,
>
> > > > > I'm having some trouble getting a directory onto my pythonpath. I'm
> > > > > sure I'm missing something obvious here.
>
> > > > > On my server, I have a directory with my django work called redfence.
> > > > > Inside is my project, along with a folder called 'apps' holding all my
> > > > > personal and third party apps. It's the apps folder I can't seem to
> > > > > get python to recognize.
>
> > > > > Redfence shows up, and the main project folder, redfenceproject,
> > > > > imports fine. But apps doesn't and I need to be able to put modules
> > > > > there.
>
> > > > > Here's what I have in a vhost.conf file:
>
> > > > > 
> > > > >     SetHandler python-program
> > > > >     PythonHandler django.core.handlers.modpython
> > > > >     SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
> > > > >     PythonOption django.root /
> > > > >     PythonDebug On
> > > > >     PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
> > > > >     SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
> > > > > redfenceproject.com/.python-eggs
> > > > > 
>
> > > > > Any help is much appreciated.
>
> > > > Nothing look immediately wrong to me.
>
> > > > So, the first question here is whether you've checked the permissions on
> > > > apps/? Apache will need execute permissions for the "other" section in
> > > > order to traverse into that directory. Since you suggest that things
> > > > inside redfence/ are imported fine, it sounds like the permissions are
> > > > okay at least down to that level, so I'd have a look at the
> > > > redfence/apps/ permissions.
>
> > > > How are you verifying that nothing imports from apps/? For example, I
> > > > would try putting a really simple file in there that, when imported,
> > > > prints a message to sys.stderr (and then calls sys.stderr.flush()
> > > > because modpython buffers stderr) and check the Apache error log for
> > > > your virtual host. Essentially, take Django out of the equation for the
> > > > time being. You could even put the little test function from the
> > > > modpython documentation into that directory and use that as the handler
> > > > to check the python path is set up correctly.
>
> > > > (As an aside: I doubt that you need to specify django.root in that
> > > > config. That option is only need if you SCRIPT_NAME is *not* going to be
> > > > '/'.)
>
> > > > Regards,
> > > > Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pythonpath problem

2008-11-25 Thread Chris Amico

Right. And the PythonPath directive ought to do the trick, but it
clearly isn't. The server belongs to a friend who gave me permission
to everything under the redfenceproject.com directory (one above
redfence), and I created the apps folder, so I'm not sure what the
problem is.

On Nov 25, 10:29 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 26, 5:13 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
>
> > I have a handful of apps in that folder. I can add it to sys.path
> > using sys.path.insert(0, path) and they import fine after, but that
> > only lasts one session. How do I make it stick?
>
> That is what PythonPath directive is for.
>
> Graham
>
> > On Nov 25, 5:28 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Tue, 2008-11-25 at 14:55 -0800, Chris Amico wrote:
> > > > Hi folks,
>
> > > > I'm having some trouble getting a directory onto my pythonpath. I'm
> > > > sure I'm missing something obvious here.
>
> > > > On my server, I have a directory with my django work called redfence.
> > > > Inside is my project, along with a folder called 'apps' holding all my
> > > > personal and third party apps. It's the apps folder I can't seem to
> > > > get python to recognize.
>
> > > > Redfence shows up, and the main project folder, redfenceproject,
> > > > imports fine. But apps doesn't and I need to be able to put modules
> > > > there.
>
> > > > Here's what I have in a vhost.conf file:
>
> > > > 
> > > >     SetHandler python-program
> > > >     PythonHandler django.core.handlers.modpython
> > > >     SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
> > > >     PythonOption django.root /
> > > >     PythonDebug On
> > > >     PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
> > > >     SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
> > > > redfenceproject.com/.python-eggs
> > > > 
>
> > > > Any help is much appreciated.
>
> > > Nothing look immediately wrong to me.
>
> > > So, the first question here is whether you've checked the permissions on
> > > apps/? Apache will need execute permissions for the "other" section in
> > > order to traverse into that directory. Since you suggest that things
> > > inside redfence/ are imported fine, it sounds like the permissions are
> > > okay at least down to that level, so I'd have a look at the
> > > redfence/apps/ permissions.
>
> > > How are you verifying that nothing imports from apps/? For example, I
> > > would try putting a really simple file in there that, when imported,
> > > prints a message to sys.stderr (and then calls sys.stderr.flush()
> > > because modpython buffers stderr) and check the Apache error log for
> > > your virtual host. Essentially, take Django out of the equation for the
> > > time being. You could even put the little test function from the
> > > modpython documentation into that directory and use that as the handler
> > > to check the python path is set up correctly.
>
> > > (As an aside: I doubt that you need to specify django.root in that
> > > config. That option is only need if you SCRIPT_NAME is *not* going to be
> > > '/'.)
>
> > > Regards,
> > > Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pythonpath problem

2008-11-25 Thread Graham Dumpleton



On Nov 26, 5:13 pm, Chris Amico <[EMAIL PROTECTED]> wrote:
> I have a handful of apps in that folder. I can add it to sys.path
> using sys.path.insert(0, path) and they import fine after, but that
> only lasts one session. How do I make it stick?

That is what PythonPath directive is for.

Graham

> On Nov 25, 5:28 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Tue, 2008-11-25 at 14:55 -0800, Chris Amico wrote:
> > > Hi folks,
>
> > > I'm having some trouble getting a directory onto my pythonpath. I'm
> > > sure I'm missing something obvious here.
>
> > > On my server, I have a directory with my django work called redfence.
> > > Inside is my project, along with a folder called 'apps' holding all my
> > > personal and third party apps. It's the apps folder I can't seem to
> > > get python to recognize.
>
> > > Redfence shows up, and the main project folder, redfenceproject,
> > > imports fine. But apps doesn't and I need to be able to put modules
> > > there.
>
> > > Here's what I have in a vhost.conf file:
>
> > > 
> > >     SetHandler python-program
> > >     PythonHandler django.core.handlers.modpython
> > >     SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
> > >     PythonOption django.root /
> > >     PythonDebug On
> > >     PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
> > >     SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
> > > redfenceproject.com/.python-eggs
> > > 
>
> > > Any help is much appreciated.
>
> > Nothing look immediately wrong to me.
>
> > So, the first question here is whether you've checked the permissions on
> > apps/? Apache will need execute permissions for the "other" section in
> > order to traverse into that directory. Since you suggest that things
> > inside redfence/ are imported fine, it sounds like the permissions are
> > okay at least down to that level, so I'd have a look at the
> > redfence/apps/ permissions.
>
> > How are you verifying that nothing imports from apps/? For example, I
> > would try putting a really simple file in there that, when imported,
> > prints a message to sys.stderr (and then calls sys.stderr.flush()
> > because modpython buffers stderr) and check the Apache error log for
> > your virtual host. Essentially, take Django out of the equation for the
> > time being. You could even put the little test function from the
> > modpython documentation into that directory and use that as the handler
> > to check the python path is set up correctly.
>
> > (As an aside: I doubt that you need to specify django.root in that
> > config. That option is only need if you SCRIPT_NAME is *not* going to be
> > '/'.)
>
> > Regards,
> > Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pythonpath problem

2008-11-25 Thread Chris Amico

I have a handful of apps in that folder. I can add it to sys.path
using sys.path.insert(0, path) and they import fine after, but that
only lasts one session. How do I make it stick?


On Nov 25, 5:28 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-11-25 at 14:55 -0800, Chris Amico wrote:
> > Hi folks,
>
> > I'm having some trouble getting a directory onto my pythonpath. I'm
> > sure I'm missing something obvious here.
>
> > On my server, I have a directory with my django work called redfence.
> > Inside is my project, along with a folder called 'apps' holding all my
> > personal and third party apps. It's the apps folder I can't seem to
> > get python to recognize.
>
> > Redfence shows up, and the main project folder, redfenceproject,
> > imports fine. But apps doesn't and I need to be able to put modules
> > there.
>
> > Here's what I have in a vhost.conf file:
>
> > 
> >     SetHandler python-program
> >     PythonHandler django.core.handlers.modpython
> >     SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
> >     PythonOption django.root /
> >     PythonDebug On
> >     PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
> >     SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
> > redfenceproject.com/.python-eggs
> > 
>
> > Any help is much appreciated.
>
> Nothing look immediately wrong to me.
>
> So, the first question here is whether you've checked the permissions on
> apps/? Apache will need execute permissions for the "other" section in
> order to traverse into that directory. Since you suggest that things
> inside redfence/ are imported fine, it sounds like the permissions are
> okay at least down to that level, so I'd have a look at the
> redfence/apps/ permissions.
>
> How are you verifying that nothing imports from apps/? For example, I
> would try putting a really simple file in there that, when imported,
> prints a message to sys.stderr (and then calls sys.stderr.flush()
> because modpython buffers stderr) and check the Apache error log for
> your virtual host. Essentially, take Django out of the equation for the
> time being. You could even put the little test function from the
> modpython documentation into that directory and use that as the handler
> to check the python path is set up correctly.
>
> (As an aside: I doubt that you need to specify django.root in that
> config. That option is only need if you SCRIPT_NAME is *not* going to be
> '/'.)
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin form

2008-11-25 Thread Praveen

Thanks Suganthi.
Yeah i added that line too and synchronize too but same error
occured...
Could not import admin.site. Error was: No module named admin.site

On Nov 26, 10:38 am, "suganthi saravanan"
<[EMAIL PROTECTED]> wrote:
> Hi Praveen,
>
> Check it!
>
> Have you added the following line  in settings.py under the INSTALLED_APPS
>
> 'django.contrib.admin'
>
> and synchronize the table . you can view the admin login 
> fromhttp://127.0.0.1:8000/admin/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin form

2008-11-25 Thread suganthi saravanan
Hi Praveen,


Check it!

Have you added the following line  in settings.py under the INSTALLED_APPS

'django.contrib.admin'

and synchronize the table . you can view the admin login from
http://127.0.0.1:8000/admin/

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



Re: Admin in Django

2008-11-25 Thread Praveen

Thanks Sadeesh, this is what i wanted..ok let me go to your refered
site and follow each step and get back to you..

On Nov 26, 10:19 am, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> On Wed, Nov 26, 2008 at 10:00 AM, Praveen <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
>
>
> > Hi All, i am very new bie of Django, i have started work on before 3
> > days.
> > I am following DJango book. I am playing with 6 chapter "Using the
> > admin interface"
> > In my urls.py file i set the url for admin
>
> > from django.conf.urls.defaults import *
> > urlpatterns = patterns('',
> >   # Example:
> >   # (r'^blog/', include('blog.foo.urls')),
> >   (r"^admin/", include("django.contrib.admin.urls")),
> >   (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> > )
>
> > but when i am running in browserhttp://127.0.0.1:8000/adminits
> > giving me error
> > File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 277, in run
> >   self.result = application(self.environ, self.start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 634, in __call__
> >   return self.application(environ, start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > wsgi.py", line 239, in __call__
> >   response = self.get_response(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > base.py", line 67, in get_response
> >   response = middleware_method(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> > line 72, in process_request
> >   urlresolvers.resolve("%s/" % request.path_info)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 244, in resolve
> >   return get_resolver(urlconf).resolve(path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 180, in resolve
> >   sub_match = pattern.resolve(new_path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 178, in resolve
> >   for pattern in self.urlconf_module.urlpatterns:
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 197, in _get_urlconf_module
> >   self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> > ImportError: No module named urls
>
> > and when i checked manually in that directory there were no urls.py
> > file
> > in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> > how may i resolve that problem. i followed each and every steps of
> > Django book
>
> > Thanks
>
> > The Django Book is outdated (at-least the admin part, I have not looked at
>
> others). There was a major refactor of the admin code before Django 1.0 was
> released (this was after the book was written). To get the latest
> documentation on how to use the admin site, 
> seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-a
>
> --
>
> Best,
>
> R
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Copy data from 1 model to another

2008-11-25 Thread issya

It looks like I partly answered my own question. I just do something
like the below to get the field names of the empty model B and I will
iterate through the fields until 1 matches and then assign the
information.

This only prints out the field names.

property_field = FeaturedProperties()._meta.fields
for field_name in property_field:
print field_name.name

On Nov 25, 11:12 am, issya <[EMAIL PROTECTED]> wrote:
> Model A has 50 fields. Model B has 20 of model A's 50 fields. I am
> trying to make a nightly cron job that will make a queryset of model A
> based on a filter and copy that information into model B. I also don't
> want it to copy the information if it already exists in model B. Does
> anyone know a good way to do this?
>
> I thought I might be able to make an empty instance of model B and
> somehow get the field names, but that isn't working. If I could do
> something like that, I could iterate through the values of model A's
> queryset and compare them to model B. If one of the fields match I
> could copy the data in and save the instance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin in Django

2008-11-25 Thread Rishabh Manocha
On Wed, Nov 26, 2008 at 10:00 AM, Praveen <[EMAIL PROTECTED]>wrote:

>
> Hi All, i am very new bie of Django, i have started work on before 3
> days.
> I am following DJango book. I am playing with 6 chapter "Using the
> admin interface"
> In my urls.py file i set the url for admin
>
> from django.conf.urls.defaults import *
> urlpatterns = patterns('',
>   # Example:
>   # (r'^blog/', include('blog.foo.urls')),
>   (r"^admin/", include("django.contrib.admin.urls")),
>   (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> )
>
> but when i am running in browser http://127.0.0.1:8000/admin its
> giving me error
> File "/usr/lib/python2.4/site-packages/django/core/servers/
> basehttp.py", line 277, in run
>   self.result = application(self.environ, self.start_response)
>
>  File "/usr/lib/python2.4/site-packages/django/core/servers/
> basehttp.py", line 634, in __call__
>   return self.application(environ, start_response)
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> wsgi.py", line 239, in __call__
>   response = self.get_response(request)
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 67, in get_response
>   response = middleware_method(request)
>
>  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> line 72, in process_request
>   urlresolvers.resolve("%s/" % request.path_info)
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 244, in resolve
>   return get_resolver(urlconf).resolve(path)
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 180, in resolve
>   sub_match = pattern.resolve(new_path)
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 178, in resolve
>   for pattern in self.urlconf_module.urlpatterns:
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 197, in _get_urlconf_module
>   self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> ImportError: No module named urls
>
> and when i checked manually in that directory there were no urls.py
> file
> in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> how may i resolve that problem. i followed each and every steps of
> Django book
>
> Thanks
> >
> The Django Book is outdated (at-least the admin part, I have not looked at
others). There was a major refactor of the admin code before Django 1.0 was
released (this was after the book was written). To get the latest
documentation on how to use the admin site, see
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin.

-- 

Best,

R

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



Re: How to show only 2 decimal places in my view?

2008-11-25 Thread Rishabh Manocha
On Wed, Nov 26, 2008 at 9:59 AM, Greg <[EMAIL PROTECTED]> wrote:

>
> Hello,
> I have the following code:
>
> ///
>
> b = Choice.objects.filter(choice=a.collection.id)
>for cb in b:
>discount_price = cb.price.name * Decimal(str(.75))
>cb.price.name = discount_price
>assert False, cb.price.name
>
> ///
>
> Basically I'm just decreasing my price by 25%.  However, when I do
> this my new value contains 4 decimal places.  37.5000 or 135..
> What do I need to do to only show 2 decimal places.  I know how to do
> it in my template.  But I need to be able to do this in my view.
>
> Thanks
>
>
> >
>
This is more of a Python question, than a Django question. I do the
following to print out only 2 decimal places from a float:
>>> x = 35.
>>> print "%.2f" % x
35.00

You can use float() instead of print to get a float type back, but that is
probably not the most efficient way to do things.

-- 

Best,

R

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



Re: Admin form

2008-11-25 Thread Praveen

Hi Sadeesh,
first of all i thank you for reply me..
Sadeesh i tried your code but again i am getting module error
Traceback erro:
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 132, in _get_callback
raise ViewDoesNotExist, "Could not import %s. Error was: %s" %
(mod_name, str(e))

ViewDoesNotExist: Could not import admin.site. Error was: No module
named admin.site
when i manually checked again then there i get one folder named admin
within contrib and that is folder so we can import the folder itself
so i saw that file inside sites folder then i tried to import like
from django.contrib.sites import admin but again same error..
Thanks

On Nov 25, 5:35 pm, "sadeesh Arumugam" <[EMAIL PROTECTED]>
wrote:
> Hi Praveen,
>
> You add these lines you can get the admin interface...
>
> Coding:
> ***
>
>   from django.conf.urls.defaults import *
>
>  # Uncomment the next two lines to enable the admin:
>
> from django.contrib import admin
>
> admin.autodiscover()
>
>  urlpatterns = patterns('',
>
>  (r'^admin/(.*)', admin.site.root),
>
> )
>
> On Tue, Nov 25, 2008 at 5:46 PM, Praveen <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > Hi All, i am very new bie of Django, i have started work on before 3
> > days.
> > I am following DJango book. I am playing with 6 chapter "Using the
> > admin interface"
> > In my urls.py file i set the url for admin
>
> > from django.conf.urls.defaults import *
> > urlpatterns = patterns('',
> >    # Example:
> >    # (r'^blog/', include('blog.foo.urls')),
> >    (r"^admin/", include("django.contrib.admin.urls")),
> >    (r"^pro/book/$", "blog.blogapp.views.bookentry"),
> > )
>
> > but when i am running in browserhttp://127.0.0.1:8000/adminits
> > giving me error
> > File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 277, in run
> >    self.result = application(self.environ, self.start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/servers/
> > basehttp.py", line 634, in __call__
> >    return self.application(environ, start_response)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > wsgi.py", line 239, in __call__
> >    response = self.get_response(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> > base.py", line 67, in get_response
> >    response = middleware_method(request)
>
> >  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> > line 72, in process_request
> >    urlresolvers.resolve("%s/" % request.path_info)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 244, in resolve
> >    return get_resolver(urlconf).resolve(path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 180, in resolve
> >    sub_match = pattern.resolve(new_path)
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 178, in resolve
> >    for pattern in self.urlconf_module.urlpatterns:
>
> >  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> > line 197, in _get_urlconf_module
> >    self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> > ImportError: No module named urls
>
> > and when i checked manually in that directory there were no urls.py
> > file
> > in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> > how may i resolve that problem. i followed each and every steps of
> > Django book
>
> > 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Apache Setup

2008-11-25 Thread Graham Dumpleton



On Nov 26, 3:32 pm, Django Newbie <[EMAIL PROTECTED]> wrote:
> Hi Everybody,
>
> Django newbie here.  I'm trying to get it to work under apache with
> mod_python on a freebsd server but running into problems.  I searched
> the archives and found similar things, but I tried all the suggestions
> and still no luck.
>
> The error:
>
> MOD_PYTHON ERROR
>
> ProcessId:      11226
> Interpreter:    'dinnertools'
>
> ServerName:     'gidget.cws-web.com'
> DocumentRoot:   '/home/dave/www/gidget.cws-web.com'
>
> URI:            '/dinnertools/'
> Location:       '/dinnertools/'
> Directory:      None
> Filename:       '/home/dave/www/gidget.cws-web.com/dinnertools'
> PathInfo:       '/'
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
> line 1537, in HandlerDispatch
>    default=default_handler, arg=req, silent=hlist.silent)
>
>  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
> line 1229, in _process_target
>    result = _execute_target(config, req, object, arg)
>
>  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
> line 1128, in _execute_target
>    result = object(arg)
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/core/handlers/modpython.py",
> line 228, in handler
>    return ModPythonHandler()(req)
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/core/handlers/modpython.py",
> line 201, in __call__
>    response = self.get_response(request)
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py",
> line 67, in get_response
>    response = middleware_method(request)
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/middleware. 
> py",
> line 9, in process_request
>    engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/db 
> .py",
> line 2, in 
>    from django.contrib.sessions.models import Session
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/models.py",
> line 4, in 
>    from django.db import models
>
>  File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py",
> line 16, in 
>    backend = __import__('%s%s.base' % (_import_path,
> settings.DATABASE_ENGINE), {}, {}, [''])
>
>  File
> "/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/base.py",
> line 13, in 
>    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
>
> My apache setup:
> PythonImport /home/dave/dinnertools/egg.py dinnertools
>
>    
>      SetHandler python-program
>      PythonHandler django.core.handlers.modpython
>      SetEnv DJANGO_SETTINGS_MODULE settings
>      PythonInterpreter dinnertools
>      PythonOption django.root /dinnertools
>      PythonDebug On
>      PythonPath "['/home/dave/dinnertools'] + sys.path"
>    
>
> ImproperlyConfigured: Error loading MySQLdb module: Shared object
> "libmysqlclient_r.so.15" not found, required by "_mysql.so"
>
> The egg.py file:
>
> import os
> os.environ['PYTHON_EGG_CACHE'] = '/www/htdocs/egg_cache'
>
> my project directory:
> # ll
> total 9
> -rw-r--r--  1 dave  dave     0 Nov 21 11:00 __init__.py
> -rw-r--r--  1 dave  dave   145 Nov 21 11:01 __init__.pyc
> -rw-r--r--  1 dave  dave    67 Nov 25 15:03 egg.py
> -rw-r--r--  1 dave  dave   546 Nov 21 11:00 manage.py
> drwxr-xr-x  2 dave  dave   512 Nov 21 11:23 recipes
> -rw-r--r--  1 dave  dave  2862 Nov 25 21:14 settings.py
> -rw-r--r--  1 dave  dave  1817 Nov 25 10:26 settings.pyc
> -rw-r--r--  1 dave  dave   541 Nov 25 10:30 urls.py
> #
>
> DB connections of course work outside of the apache/mod_python
> environment.  Also I would expect some temporary file to be unpacked in
> the /www/htdocs/egg_cache directory, but I don't see any.  The
> permissions on the egg_cache directory are such that apache should be
> able to write to it.
>
> Any ideas?  I assume I need the extra setup related to egg file since
> the MySQLdb module has some egg files related to it.  Please let me know
> what I'm missing.
>
> Thanks,
>
> Yours truly, django newbie.

Your libmysqlclient_r.so.15 file can't be installed in a standard
location. Where is it installed? Do you have anything set in your user
environment so it can be found when you run it as you? Apache runs as
a different user and will not have your environment.

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



Apache Setup

2008-11-25 Thread Django Newbie

Hi Everybody,

Django newbie here.  I'm trying to get it to work under apache with 
mod_python on a freebsd server but running into problems.  I searched 
the archives and found similar things, but I tried all the suggestions 
and still no luck.

The error:

MOD_PYTHON ERROR

ProcessId:  11226
Interpreter:'dinnertools'

ServerName: 'gidget.cws-web.com'
DocumentRoot:   '/home/dave/www/gidget.cws-web.com'

URI:'/dinnertools/'
Location:   '/dinnertools/'
Directory:  None
Filename:   '/home/dave/www/gidget.cws-web.com/dinnertools'
PathInfo:   '/'

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

Traceback (most recent call last):

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

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

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

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

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

 File 
"/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py", 
line 67, in get_response
   response = middleware_method(request)

 File 
"/usr/local/lib/python2.5/site-packages/django/contrib/sessions/middleware.py", 
line 9, in process_request
   engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])

 File 
"/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py",
 
line 2, in 
   from django.contrib.sessions.models import Session

 File 
"/usr/local/lib/python2.5/site-packages/django/contrib/sessions/models.py", 
line 4, in 
   from django.db import models

 File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py", 
line 16, in 
   backend = __import__('%s%s.base' % (_import_path, 
settings.DATABASE_ENGINE), {}, {}, [''])

 File 
"/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/base.py", 
line 13, in 
   raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)


My apache setup:
PythonImport /home/dave/dinnertools/egg.py dinnertools

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

ImproperlyConfigured: Error loading MySQLdb module: Shared object 
"libmysqlclient_r.so.15" not found, required by "_mysql.so"

The egg.py file:

import os
os.environ['PYTHON_EGG_CACHE'] = '/www/htdocs/egg_cache'

my project directory:
# ll
total 9
-rw-r--r--  1 dave  dave 0 Nov 21 11:00 __init__.py
-rw-r--r--  1 dave  dave   145 Nov 21 11:01 __init__.pyc
-rw-r--r--  1 dave  dave67 Nov 25 15:03 egg.py
-rw-r--r--  1 dave  dave   546 Nov 21 11:00 manage.py
drwxr-xr-x  2 dave  dave   512 Nov 21 11:23 recipes
-rw-r--r--  1 dave  dave  2862 Nov 25 21:14 settings.py
-rw-r--r--  1 dave  dave  1817 Nov 25 10:26 settings.pyc
-rw-r--r--  1 dave  dave   541 Nov 25 10:30 urls.py
#

DB connections of course work outside of the apache/mod_python 
environment.  Also I would expect some temporary file to be unpacked in 
the /www/htdocs/egg_cache directory, but I don't see any.  The 
permissions on the egg_cache directory are such that apache should be 
able to write to it.

Any ideas?  I assume I need the extra setup related to egg file since 
the MySQLdb module has some egg files related to it.  Please let me know 
what I'm missing.

Thanks,

Yours truly, django newbie.

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



Apache Setup

2008-11-25 Thread D$

Hi Everybody,

Django newbie here.  I'm trying to get it to work under apache with 
mod_python on a freebsd server but running into problems.  I searched 
the archives and found similar things, but I tried all the suggestions 
and still no luck.

The error:

MOD_PYTHON ERROR

ProcessId:  11226
Interpreter:'dinnertools'

ServerName: 'gidget.cws-web.com'
DocumentRoot:   '/home/dave/www/gidget.cws-web.com'

URI:'/dinnertools/'
Location:   '/dinnertools/'
Directory:  None
Filename:   '/home/dave/www/gidget.cws-web.com/dinnertools'
PathInfo:   '/'

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

Traceback (most recent call last):

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

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

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

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

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

 File 
"/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py", 
line 67, in get_response
   response = middleware_method(request)

 File 
"/usr/local/lib/python2.5/site-packages/django/contrib/sessions/middleware.py", 
line 9, in process_request
   engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])

 File 
"/usr/local/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py",
 
line 2, in 
   from django.contrib.sessions.models import Session

 File 
"/usr/local/lib/python2.5/site-packages/django/contrib/sessions/models.py", 
line 4, in 
   from django.db import models

 File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py", 
line 16, in 
   backend = __import__('%s%s.base' % (_import_path, 
settings.DATABASE_ENGINE), {}, {}, [''])

 File 
"/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/base.py", 
line 13, in 
   raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)


My apache setup:
PythonImport /home/dave/dinnertools/egg.py dinnertools

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

ImproperlyConfigured: Error loading MySQLdb module: Shared object 
"libmysqlclient_r.so.15" not found, required by "_mysql.so"

The egg.py file:

import os
os.environ['PYTHON_EGG_CACHE'] = '/www/htdocs/egg_cache'

my project directory:
# ll
total 9
-rw-r--r--  1 dave  dave 0 Nov 21 11:00 __init__.py
-rw-r--r--  1 dave  dave   145 Nov 21 11:01 __init__.pyc
-rw-r--r--  1 dave  dave67 Nov 25 15:03 egg.py
-rw-r--r--  1 dave  dave   546 Nov 21 11:00 manage.py
drwxr-xr-x  2 dave  dave   512 Nov 21 11:23 recipes
-rw-r--r--  1 dave  dave  2862 Nov 25 21:14 settings.py
-rw-r--r--  1 dave  dave  1817 Nov 25 10:26 settings.pyc
-rw-r--r--  1 dave  dave   541 Nov 25 10:30 urls.py
#

DB connections of course work outside of the apache/mod_python 
environment.  Also I would expect some temporary file to be unpacked in 
the /www/htdocs/egg_cache directory, but I don't see any.  The 
permissions on the egg_cache directory are such that apache should be 
able to write to it.

Any ideas?  I assume I need the extra setup related to egg file since 
the MySQLdb module has some egg files related to it.  Please let me know 
what I'm missing.

Thanks,

Yours truly, django newbie.

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



Admin in Django

2008-11-25 Thread Praveen

Hi All, i am very new bie of Django, i have started work on before 3
days.
I am following DJango book. I am playing with 6 chapter "Using the
admin interface"
In my urls.py file i set the url for admin

from django.conf.urls.defaults import *
urlpatterns = patterns('',
   # Example:
   # (r'^blog/', include('blog.foo.urls')),
   (r"^admin/", include("django.contrib.admin.urls")),
   (r"^pro/book/$", "blog.blogapp.views.bookentry"),
)

but when i am running in browser http://127.0.0.1:8000/admin its
giving me error
File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 277, in run
   self.result = application(self.environ, self.start_response)

 File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 634, in __call__
   return self.application(environ, start_response)

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

 File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 67, in get_response
   response = middleware_method(request)

 File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
line 72, in process_request
   urlresolvers.resolve("%s/" % request.path_info)

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 244, in resolve
   return get_resolver(urlconf).resolve(path)

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 180, in resolve
   sub_match = pattern.resolve(new_path)

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 178, in resolve
   for pattern in self.urlconf_module.urlpatterns:

 File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 197, in _get_urlconf_module
   self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])

ImportError: No module named urls

and when i checked manually in that directory there were no urls.py
file
in usr/lib/python2.4/site-packages/django/contrib/admin/

how may i resolve that problem. i followed each and every steps of
Django book

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to show only 2 decimal places in my view?

2008-11-25 Thread Greg

Hello,
I have the following code:

///

b = Choice.objects.filter(choice=a.collection.id)
for cb in b:
discount_price = cb.price.name * Decimal(str(.75))
cb.price.name = discount_price
assert False, cb.price.name

///

Basically I'm just decreasing my price by 25%.  However, when I do
this my new value contains 4 decimal places.  37.5000 or 135..
What do I need to do to only show 2 decimal places.  I know how to do
it in my template.  But I need to be able to do this in my view.

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Develop in windows, serve in linux

2008-11-25 Thread Kenneth Gonsalves

On Tuesday 25 November 2008 11:28:10 pm TheIvIaxx wrote:
> Is there a common set of tools for this type of thing?

putty or develop using svn

-- 
regards
KG
http://lawgon.livejournal.com

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



Re: hidden fields in forms

2008-11-25 Thread Malcolm Tredinnick


On Tue, 2008-11-25 at 18:03 -0800, ChrisK wrote:
> OK, thanks for your suggestions (and yes, I meant "POST").
> 
> The problem now appears to be how I initialize the form's value of
> auth_id! 

Oh, right. I missed that error initially. Yes, you're doing it
incorrectly. The first positional argument to a form (which is what you
are passing in) is the data from the form submission. Passing in that
data means the form is treated as a "bound" form, so the data is
validated as part of displaying the form, so that errors can be
displayed. Since you only passed in one of the many required values, you
get all those errors.

What you really want to pass in is initial data. This is done with the
"initial" parameter to the form constructor. So your GET branch would
look like

form = newFenceForm(initial={'auth_id' : auth_id})

I thought "initial" was documented in the forms documentation, but I
cannot find it right now, so maybe that's been missed. In any case,
that's the way to do it.

Regards,
Malcolm

> If I use just
> 
> {{form.as_p}}
> 
> in my template, I get the following html:
> 
> (Hidden field auth_id) This field is
> required.
> This field is required.
> Teaser:  type="text" name="teaser" maxlength="40" />
> This field is required.
> Url:  id="id_url" />
> This field is required.
> Address:  name="address" id="id_address" />
> 
> This field is required.
> Range:  name="range" id="id_range" /> id="id_auth_id" />
> 
> No value is initialized for auth_id ... so perhaps the problem is in
> how I'm calling the constructor for newFenceForm?
> > 
> 


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



Re: hidden fields in forms

2008-11-25 Thread ChrisK

OK, thanks for your suggestions (and yes, I meant "POST").

The problem now appears to be how I initialize the form's value of
auth_id! If I use just

{{form.as_p}}

in my template, I get the following html:

(Hidden field auth_id) This field is
required.
This field is required.
Teaser: 
This field is required.
Url: 
This field is required.
Address: 

This field is required.
Range: 

No value is initialized for auth_id ... so perhaps the problem is in
how I'm calling the constructor for newFenceForm?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: hidden fields in forms

2008-11-25 Thread Malcolm Tredinnick


On Tue, 2008-11-25 at 15:06 -0800, ChrisK wrote:
> I'm just not getting this. I've looked at many examples and can't seem
> to pass a hidden value into a form.
> 
> The problem is that I initially get to the form with GET, and then
> instantiate the form with PUT. The key that I need is part of the
> original URL, and I'm trying to push it down into the PUT data as
> well, but failing.

You mean POST, not PUT. :-)

[...]
>  id="id_auth_id" />
> 
> the string between curlies is always empty.

Your template doesn't know anything about a variable call auth_id. All
it knows about is a variable called "form". The "form" variable has an
attribute called auth_id, however. Thus;



Regards,
Malcolm



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



Re: pythonpath problem

2008-11-25 Thread Malcolm Tredinnick


On Tue, 2008-11-25 at 14:55 -0800, Chris Amico wrote:
> Hi folks,
> 
> I'm having some trouble getting a directory onto my pythonpath. I'm
> sure I'm missing something obvious here.
> 
> On my server, I have a directory with my django work called redfence.
> Inside is my project, along with a folder called 'apps' holding all my
> personal and third party apps. It's the apps folder I can't seem to
> get python to recognize.
> 
> Redfence shows up, and the main project folder, redfenceproject,
> imports fine. But apps doesn't and I need to be able to put modules
> there.
> 
> Here's what I have in a vhost.conf file:
> 
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
> PythonOption django.root /
> PythonDebug On
> PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
> SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
> redfenceproject.com/.python-eggs
> 
> 
> Any help is much appreciated.

Nothing look immediately wrong to me.

So, the first question here is whether you've checked the permissions on
apps/? Apache will need execute permissions for the "other" section in
order to traverse into that directory. Since you suggest that things
inside redfence/ are imported fine, it sounds like the permissions are
okay at least down to that level, so I'd have a look at the
redfence/apps/ permissions.

How are you verifying that nothing imports from apps/? For example, I
would try putting a really simple file in there that, when imported,
prints a message to sys.stderr (and then calls sys.stderr.flush()
because modpython buffers stderr) and check the Apache error log for
your virtual host. Essentially, take Django out of the equation for the
time being. You could even put the little test function from the
modpython documentation into that directory and use that as the handler
to check the python path is set up correctly.

(As an aside: I doubt that you need to specify django.root in that
config. That option is only need if you SCRIPT_NAME is *not* going to be
'/'.)

Regards,
Malcolm



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



Re: hidden fields in forms

2008-11-25 Thread Brian Neal

On Nov 25, 6:24 pm, ChrisK <[EMAIL PROTECTED]> wrote:
> > Well..you aren't passing auth_id to the template, you are passing
> > form. auth_id is a field inside your template. Can you post your
> > template?
>
> Oh, sorry - my oversight. Template is
>
> 
>  id="id_auth_id" />
> Reminder String:
>      p>
> URL of document:
>     
> Address of interest:
>     
> Range (in meters):
>     
> 
> 
>
> I guess I'm not clear how to access stuff from inside the form!

Check this out: 
http://docs.djangoproject.com/en/dev/topics/forms/#displaying-a-form-using-a-template

Try using the form.as_p or form.as_table methods. If that doesn't work
for you, you can render each field yourself.

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



Re: No module named urls

2008-11-25 Thread TheIvIaxx

Its going to be running on apache, but right now im getting this error
on the development server for django.  The PYTHONPATH in the error has
the project dir in it.  I verified that PYTHONPATH has the project dir
from putty.  Not sure what else to try.  Oh and starting the shell
from a temp dir, importing urls went fine.


On Nov 25, 11:32 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I just moved my site to a production environment and i get
> > this error when trying to view the admin stuff.  I want to say
> > its a path issue? If i use manage.py shell, i can import urls
> > just fine.  Any ideas on why this error is popping up?
>
> My first thought concurs with your path issue.  What's your
> server setup (Apache?  lighttpd?) and within that config, what's
> your $PYTHONPATH set to?  My guess is that it doesn't include the
> directory containing your urls.py which, for mod_python would be
> a line like
>
>    PythonPath "['/path/to/project'] + sys.path"
>
> Since it's working from your manage.py shell, are you either
> running manage.py from within that directory (if so, try running
> it from another directory such as
>
>    cd ~/tmp
>    ~/dev/proj/manage.py shell
>
> to see if it still works), or do you set your $PYTHONPATH in your
> current shell (such as your .bashrc)?
>
> -tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: hidden fields in forms

2008-11-25 Thread ChrisK

> Well..you aren't passing auth_id to the template, you are passing
> form. auth_id is a field inside your template. Can you post your
> template?

Oh, sorry - my oversight. Template is



Reminder String:

URL of document:

Address of interest:

Range (in meters):




I guess I'm not clear how to access stuff from inside the form!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: hidden fields in forms

2008-11-25 Thread Brian Neal

On Nov 25, 5:06 pm, ChrisK <[EMAIL PROTECTED]> wrote:
> I'm just not getting this. I've looked at many examples and can't seem
> to pass a hidden value into a form.
>
> The problem is that I initially get to the form with GET, and then
> instantiate the form with PUT. The key that I need is part of the
> original URL, and I'm trying to push it down into the PUT data as
> well, but failing.
>
> I have
>
>  (r'^fences/newFence/(?P.*)$', 'newFence'),
>
> class newFenceForm(forms.Form):
>     teaser = forms.CharField(max_length=40)
>     url = forms.CharField()
>     address = forms.CharField()
>     range = forms.IntegerField()
>     auth_id = forms.CharField(widget=forms.HiddenInput)
>
> def newFence(request, auth_id):
>     if request.method == 'POST':        # if the form has been submitted
>         form = newFenceForm(request.POST)
>         if form.is_valid():
>             # do the geocoding
>             print form.cleaned_data['auth_id']
>             print form.cleaned_data['teaser']
>             print form.cleaned_data['url']
>             print form.cleaned_data['address']
>             print form.cleaned_data['range']
>             # save the object
>             u = User.objects.filter(auth_id = id)
>             # show them the new map
>             return HttpResponseRedirect('../../fences/fenceMap/
> %s'%auth_id)
>     else:
>         print auth_id
>         form = newFenceForm({'auth_id' : auth_id})
>
>     return render_to_response("map/newfence.html", {'form': form, })
>
> I call this with, say, '.../newFence/chris' and the first time through
> it prints 'chris' and instantiates the empty form. But where my
> template says
>
>  id="id_auth_id" />
>
> the string between curlies is always empty.

Well..you aren't passing auth_id to the template, you are passing
form. auth_id is a field inside your template. Can you post your
template?


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



Re: cpu load

2008-11-25 Thread Joe Murphy

On Nov 25, 2:16 pm, "Jirka Vejrazka" <[EMAIL PROTECTED]> wrote:
>   do you do any pickling or serializing of QuerySets? I do remember
> reading a blog (someone may be able to find the URL) where the author
> mentioned the same problem. He managed to find out that it was caused
> by changes queryset-refactor, especially the way QuerySets behaved
> during pickling.
>
>   Sorry I can't give you the exact link :(
>

That rings a bell -- think that was Ned Batchelder's "A server memory
leak" article?

http://nedbatchelder.com/blog/200809/a_server_memory_leak.html

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



hidden fields in forms

2008-11-25 Thread ChrisK

I'm just not getting this. I've looked at many examples and can't seem
to pass a hidden value into a form.

The problem is that I initially get to the form with GET, and then
instantiate the form with PUT. The key that I need is part of the
original URL, and I'm trying to push it down into the PUT data as
well, but failing.

I have

 (r'^fences/newFence/(?P.*)$', 'newFence'),

class newFenceForm(forms.Form):
teaser = forms.CharField(max_length=40)
url = forms.CharField()
address = forms.CharField()
range = forms.IntegerField()
auth_id = forms.CharField(widget=forms.HiddenInput)

def newFence(request, auth_id):
if request.method == 'POST':# if the form has been submitted
form = newFenceForm(request.POST)
if form.is_valid():
# do the geocoding
print form.cleaned_data['auth_id']
print form.cleaned_data['teaser']
print form.cleaned_data['url']
print form.cleaned_data['address']
print form.cleaned_data['range']
# save the object
u = User.objects.filter(auth_id = id)
# show them the new map
return HttpResponseRedirect('../../fences/fenceMap/
%s'%auth_id)
else:
print auth_id
form = newFenceForm({'auth_id' : auth_id})

return render_to_response("map/newfence.html", {'form': form, })

I call this with, say, '.../newFence/chris' and the first time through
it prints 'chris' and instantiates the empty form. But where my
template says



the string between curlies is always empty.

What trick am I missing to get that data initiated? Should a
HiddenInput widget be rendered differently in the template?

(I'm happy to take suggestions for a different way to crack this, too
- the problem is that I have to do some post processing on the input
data before creating the object, or I'd use a generic view.)

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



pythonpath problem

2008-11-25 Thread Chris Amico

Hi folks,

I'm having some trouble getting a directory onto my pythonpath. I'm
sure I'm missing something obvious here.

On my server, I have a directory with my django work called redfence.
Inside is my project, along with a folder called 'apps' holding all my
personal and third party apps. It's the apps folder I can't seem to
get python to recognize.

Redfence shows up, and the main project folder, redfenceproject,
imports fine. But apps doesn't and I need to be able to put modules
there.

Here's what I have in a vhost.conf file:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE redfenceproject.settings
PythonOption django.root /
PythonDebug On
PythonPath "['/.../redfence/apps', '/.../redfence'] + sys.path"
SetEnv PYTHON_EGG_CACHE /var/www/vhosts/
redfenceproject.com/.python-eggs


Any help is much appreciated.

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



Re: admin can't update: AttributeError 'parse_file_upload' for a model with no file field

2008-11-25 Thread Malcolm Tredinnick


On Tue, 2008-11-25 at 06:50 -0800, omat wrote:
> Hi,
> 
> I am trying to update a object via admin interface. Nothing fancy, and
> it all goes well on my local environment, as it does many times
> before.
> 
> But in the production site, I get an AttributeError:
> 
> 'module' object has no attribute 'parse_file_upload'
> 
> 
> The traceback (which dpaste refused to save) is as follows:
> 
> 
> Environment:
> 
> Request Method: POST
> Request URL: http:///pws/admin/encounter/standardcomment/10/
> Django Version: 1.0.2 final
> Python Version: 2.5.1
> Installed Applications:
> ['registration',
>  'django.contrib.auth',
>  'django.contrib.admin',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'django.contrib.humanize',
>  'thumbnail',
>  'userprofile',
>  'nhsdata',
>  'encounter']
> Installed Middleware:
> ('django.middleware.cache.CacheMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware',
>  'debugfooter.DebugFooter')
> 
> 
> Traceback:
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\core
> \handlers\base.py" in get_response
>   86. response = callback(request, *callback_args,
> **callback_kwargs)
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
> \admin\sites.py" in root
>   157. return self.model_page(request, *url.split('/',
> 2))
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\views
> \decorators\cache.py" in _wrapped_view_func
>   44. response = view_func(request, *args, **kwargs)
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
> \admin\sites.py" in model_page
>   176. return admin_obj(request, rest_of_url)
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
> \admin\options.py" in __call__
>   197. return self.change_view(request, unquote(url))
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\db
> \transaction.py" in _commit_on_success
>   238. res = func(*args, **kw)
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
> \admin\options.py" in change_view
>   561. if request.method == 'POST' and request.POST.has_key
> ("_saveasnew"):
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\core
> \handlers\pyisapie.py" in _get_post
>   51. This._load_post_and_files()
> File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\core
> \handlers\pyisapie.py" in _load_post_and_files
>   32.   This._post, This._files = http.parse_file_upload
> (This._headers_in, This.raw_post_data)
> 
> Exception Type: AttributeError at /pathwaysolutions/validation/admin/
> encounter/standardcomment/10/
> Exception Value: 'module' object has no attribute 'parse_file_upload'
> 
> 
> This happens for every model and every add / edit operation.
> 
> 
> The model in example does not have a file or image field. Where does
> this 'parse_file_upload' thing come from?

Sounds like there might be a bug in the third-party handler (pyisapie)
that you're using. parse_file_upload is a member of the
django.http.HttpRequest class, not a module-level member.

While you're over filing a bug about that portion of pyisapie, you could
maybe file a bug suggesting very strongly that they don't recommend
putting it in django/core/handlers/ (I'm assuming their documentation
told you to put it there; if you did it on your own, then that's still
bad practice). That isn't necessary (since it can be imported from
anywhere on your Python path) and makes it look like, in the traceback,
that there's a problem in django/core/ somewhere. But the problem is
with this third-party module and entirely beyond our control. There's no
need for third-party modules to change Django's source distribution like
this.

Regards,
Malcolm



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



Sort Table Headers after data has been rendered via a POST request

2008-11-25 Thread SnappyDjangoUser

I am hoping someone from this list may have some ideas on a solution
to a problem I am facing...

I am using a SortHeaders class to perform ascending and descending
filtering on table column headers.  (The SortHeaders is found on
Django Snippets, http://www.djangosnippets.org/snippets/308/, and
works well!)  This works great when performing simple queries based on
GET parameters.

My Question: how to implement the same table header sorting after a
POST request?

In my case I am submitting a form to search for items and then
rendered the queried data with table headers which are intended for
clickable sorting.  The problem is that when I click on the table
headers the data is sent as a GET request and thus the POST query
never takes place.  Any suggestions on solutions?

The only idea I have is create a form around the column headers with
the search filters embedded as hidden inputs.  Then when a user sorts
the table columns by clicking on a column header, the same search
request would be submitted and the data would be ordered by the
desired column.  My biggest problem with this approach is that I can't
get the data to be submitted as a post request it always seems to
be submitted as a GET request.

Hopefully all of this makes sense... if not, let me know and I'll shed
some light with examples.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Compare Lists for Unique Items

2008-11-25 Thread Alex Jillard
Thanks for the replies Jeff and Rajesh.  I'll look int both of those options
and see what I can come up with.  My model is set to have the name of the
project to be unique, so it was throwing an error if a duplicate was added.

Jeff, unfortunatly the initial list of CVS projects is just a string that
I'm splitting, so I can't do it as I build that list.

Thanks again

On Tue, Nov 25, 2008 at 4:38 PM, Rajesh Dhawan <[EMAIL PROTECTED]>wrote:

>
> Hi Alex,
>
> > Here is the code that I use.  Output_list is from CVS and
> current_projects
> > is from the database.  Is there a faster way to do this, or a built in
> > method in Python?  This code works fine now, but I can see it getting
> slow.
> >
> > for b in output_list:
> > found = False
> > for i in current_projects:
> > if i.name == b:
> > found = True
> > if not found:
> > new_projects.append(b)
>
> Try converting the two project name lists into Python sets and take a
> difference:
>
> full_list = set(output_list)
> db_list = set([i.name for i in current_projects])
> new_projects = full_list - db_list
>
> You should also add a unique=True attribute to your project.name
> field.
>
> -Rajesh D
> >
>

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



Re: Compare Lists for Unique Items

2008-11-25 Thread Rajesh Dhawan

Hi Alex,

> Here is the code that I use.  Output_list is from CVS and current_projects
> is from the database.  Is there a faster way to do this, or a built in
> method in Python?  This code works fine now, but I can see it getting slow.
>
> for b in output_list:
> found = False
> for i in current_projects:
> if i.name == b:
> found = True
> if not found:
> new_projects.append(b)

Try converting the two project name lists into Python sets and take a
difference:

full_list = set(output_list)
db_list = set([i.name for i in current_projects])
new_projects = full_list - db_list

You should also add a unique=True attribute to your project.name
field.

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



Re: Compare Lists for Unique Items

2008-11-25 Thread Jeff Anderson
Alex Jillard wrote:
> I've been working with Python and Django for the past week or so and thus
> far it's been great.  My question is more of a general Python question than
> it is a Django question, but hopefully I can get some help or a link to an
> appropriate doc/website.  So far I've not been able to dig up much useful
> information up on Google.
>
> The application that I'm working on checks a CVS repository for all active
> projects and returns a list of the corresponding project names.  I'd then
> like to put these names into a database.  We start a few new projects every
> week, so our CVS repo grows fairly quickly and I'd like to be able to have
> the database stay current, either with a cron job or by a user starting the
> processes.
>
> So far all that works, but since CVS will always return a full list of
> projects, and I only want one entry in the database per project, I need to
> filter out the new projects.  Right now I'm just comparing what the CVS
> return list contains with what is in the database.
>
> Here is the code that I use.  Output_list is from CVS and current_projects
> is from the database.  Is there a faster way to do this, or a built in
> method in Python?  This code works fine now, but I can see it getting slow.
>   
I'm not sure of a pre-built way of doing this, but if your data is
guaranteed to be sorted, you can take advantage of that, and improve the
performance of the algorithm. Use a binary search rather than iterating
through the whole current_projects list.

You can also use the Python keyword 'in' instead of comparing each term:

for b in output_list:
if b not in current_projects:
new_projects.append(b)

Even this will give you a bit of a performance boost, because 'in'
doesn't (shouldn't?) iterate through the whole list in every case. I
don't believe that 'in' will take advantage of a sorted List, so if it
really matters to you, you could implement your own function that does.

Another thing that may speed things up: right now you are building the
output_list up, and then building the current_projects list up, and then
comparing them one by one.

You could build the current_projects list, and then instead of putting
the items in 'output_list' into a list, do the comparison there:

if item not in current_projects:
new_projects.append(item)

Of course, this won't work if you are getting a list as input, and not
the individual items.

Cheers!


Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Re: cpu load

2008-11-25 Thread Jirka Vejrazka

> I recently upgraded Django from 0.96 to 1.0.2 but noticed that the CPU
> load for the same site traffic jumped by 50%.  Has anyone else noticed
> anything similar or might have any clue as to why this might happen?

Hi there,

  do you do any pickling or serializing of QuerySets? I do remember
reading a blog (someone may be able to find the URL) where the author
mentioned the same problem. He managed to find out that it was caused
by changes queryset-refactor, especially the way QuerySets behaved
during pickling.

  Sorry I can't give you the exact link :(

  Cheers

 Jirka

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



Function-based objects in admin "Change..." page.

2008-11-25 Thread borntonetwork

Hello.

I'm using Django v1.

When I want to add a column in an admin list page, I just create a
function in the associated model class and add it to the
"list_display" tuple in the same model class.  For instance, if I
wanted to create a link to a reference id that would show up as a
column, I would do something like this:

def link_to_reference(self):
try:
id = Reference.objects.get(id=self.referenced_by_id).id
except Reference.DoesNotExist:
return 'Does not exist.'
return ''+str(id)+''
link_to_reference.short_description = 'Referral ID'
link_to_reference.allow_tags = True

Then do this:

list_display = ('somefield1', 'somefield2' ... 'link_to_referrer')

This always works well for me. Now I am trying to do something similar
on an admin change form. Instead of using the "list_display" tuple, I
try the "fields" tuple like this:

fields = (('Section 1', {'fields': ('field1', 'field2' ...
'link_to_reference'})))

I get a "FieldDoesNotExist" exception.

Does anyone know a (simple) way perform this type of function-based
sudo-field creation on the admin change form?

Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic image creation

2008-11-25 Thread Jeff Anderson
Aneurin Price wrote:
> Hello,
>
> I'd like to be able to generate images dynamically for a Django-based
> website, and I'm wondering how best to go about it.
>
> The idea is to do certain things to existing images, such as
> superimpose them on a background. The set of base images will be
> more-or-less static; it's just the operation performed on it which
> might change, so I don't really want to create an image model and have
> to instantiate it for each image. Rather I'd like to be able to simply
> put them in a directory, so I can make a request for
> 'imagename-operation.png', and have my application check to see if it
> exists in a cache, and if not, look for 'imagename.png' in the base
> images directory and apply the given operation to it. I'm fine with
> the image operations, but I can't decide where I should be doing this
> work.
>
> I'm tempted to do it all in a view, so 'imagename' and 'operation' are
> parsed from the request name and passed to the appropriate function,
> which returns the image. Doing it in the view however doesn't really
> feel right, and I wondered if perhaps I would be better with some
> custom middleware, or something else entirely.
>   
A view is the right place to do this. A view takes a request, parses it,
and returns the response. This process holds true for html, an image,
pdf, or office document. You'll likely want to use PIL for the actual
manipulation/operation, but as long as you can get the binary content of
the image into Python, you're fine. Simply set the mime type and content
of the response, and you're good to go. There are examples in the Django
documentation on how to do this with a PDF, but the response object
instance creation will be basically the same for an image as well.

Take care!


Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Compare Lists for Unique Items

2008-11-25 Thread Alex Jillard
I've been working with Python and Django for the past week or so and thus
far it's been great.  My question is more of a general Python question than
it is a Django question, but hopefully I can get some help or a link to an
appropriate doc/website.  So far I've not been able to dig up much useful
information up on Google.

The application that I'm working on checks a CVS repository for all active
projects and returns a list of the corresponding project names.  I'd then
like to put these names into a database.  We start a few new projects every
week, so our CVS repo grows fairly quickly and I'd like to be able to have
the database stay current, either with a cron job or by a user starting the
processes.

So far all that works, but since CVS will always return a full list of
projects, and I only want one entry in the database per project, I need to
filter out the new projects.  Right now I'm just comparing what the CVS
return list contains with what is in the database.

Here is the code that I use.  Output_list is from CVS and current_projects
is from the database.  Is there a faster way to do this, or a built in
method in Python?  This code works fine now, but I can see it getting slow.

for b in output_list:
found = False
for i in current_projects:
if i.name == b:
found = True
if not found:
new_projects.append(b)

Thanks for the help,
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Copy data from 1 model to another

2008-11-25 Thread issya

Model A has 50 fields. Model B has 20 of model A's 50 fields. I am
trying to make a nightly cron job that will make a queryset of model A
based on a filter and copy that information into model B. I also don't
want it to copy the information if it already exists in model B. Does
anyone know a good way to do this?

I thought I might be able to make an empty instance of model B and
somehow get the field names, but that isn't working. If I could do
something like that, I could iterate through the values of model A's
queryset and compare them to model B. If one of the fields match I
could copy the data in and save the instance.

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



Combine 2 querysets from 2 different models

2008-11-25 Thread issya

Hello, I have a few different projects in which I need to combine the
data from 2 querysets from 2 different models. In one project I am
just trying to combine this information to export into a CSV file and
in another project I want to make a graph with the information. Is
there any easy way to do this if there is a relationship between the 2
models?

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



Dynamic image creation

2008-11-25 Thread Aneurin Price

Hello,

I'd like to be able to generate images dynamically for a Django-based
website, and I'm wondering how best to go about it.

The idea is to do certain things to existing images, such as
superimpose them on a background. The set of base images will be
more-or-less static; it's just the operation performed on it which
might change, so I don't really want to create an image model and have
to instantiate it for each image. Rather I'd like to be able to simply
put them in a directory, so I can make a request for
'imagename-operation.png', and have my application check to see if it
exists in a cache, and if not, look for 'imagename.png' in the base
images directory and apply the given operation to it. I'm fine with
the image operations, but I can't decide where I should be doing this
work.

I'm tempted to do it all in a view, so 'imagename' and 'operation' are
parsed from the request name and passed to the appropriate function,
which returns the image. Doing it in the view however doesn't really
feel right, and I wondered if perhaps I would be better with some
custom middleware, or something else entirely.

Does anybody have any advice?

Thanks,
Nye

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



Jinja2 i18n problem: UndefinedError: 'gettext' is undefined

2008-11-25 Thread Honghai

Hi there,

I tried a very simple test to check the Jinja2 i18n, here is the code
(it is pretty much the same as the translate.py from jinja2):

from jinja2 import Environment

print Environment(extensions=['jinja2.ext.i18n']).from_string("""\
{% trans %}Hello {{ user }}!{% endtrans %}
{% trans count=users|count %}{{ count }} user{% pluralize %}
{{ count }} users{% endtrans %}
""").render(user="someone")

but I got the following error:


Traceback (most recent call last):
  File "D:\Tools\jinja2\examples\basic\translate.py", line 6, in

""").render(user="someone")
  File "", line 1, in top-level template code
  File "c:\python25\lib\site-packages\Jinja2-2.1dev_20081117-py2.5.egg
\jinja2\runtime.py", line 132, in call
return __obj(*args, **kwargs)
  File "c:\python25\lib\site-packages\Jinja2-2.1dev_20081117-py2.5.egg
\jinja2\runtime.py", line 403, in _fail_with_undefined_error
raise self._undefined_exception(hint)
jinja2.exceptions.UndefinedError: 'gettext' is undefined

Can someone help me out? Thanks a lot!

cheers,

Honghai

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



Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-11-25 Thread Justin Bronn

> I reran my tests with the latest version of Apache on my 8.10 test
> machine.  I am no longer getting the Segfaults with either worker or
> prefork.  I am now getting an Invalid SRS type "wkt" error (that I
> assume you are now running into).

Yup that's the error I got: http://code.djangoproject.com/ticket/9694.
I've also got a patch on there that fixes the SRS exception on 8.10 --
I have a vague notion as to why it works, but no definitive answer.
My only guess as to your non-reproducible segfault is that worker was
being used when you thought you had prefork going.

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



Re: No module named urls

2008-11-25 Thread Tim Chase

> I just moved my site to a production environment and i get
> this error when trying to view the admin stuff.  I want to say
> its a path issue? If i use manage.py shell, i can import urls
> just fine.  Any ideas on why this error is popping up?

My first thought concurs with your path issue.  What's your 
server setup (Apache?  lighttpd?) and within that config, what's 
your $PYTHONPATH set to?  My guess is that it doesn't include the 
directory containing your urls.py which, for mod_python would be 
a line like

   PythonPath "['/path/to/project'] + sys.path"

Since it's working from your manage.py shell, are you either 
running manage.py from within that directory (if so, try running 
it from another directory such as

   cd ~/tmp
   ~/dev/proj/manage.py shell

to see if it still works), or do you set your $PYTHONPATH in your 
current shell (such as your .bashrc)?

-tim








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



Re: Best IDE for Django and python?

2008-11-25 Thread bedros

I personally like Komodo Edit

after trying komodo, I switched  from pydev and eclipse to komodo;









On Nov 25, 10:56 am, "Antoni Aloy" <[EMAIL PROTECTED]> wrote:
> 2008/11/25 Kurczak <[EMAIL PROTECTED]>:
>
>
>
> > I wonder why no one mentioned Komodo IDE or Komodo Edit.
> > They're my personal favorites for bigger projects. Both are well
> > suited for dynamic languages and really lightweight compared to
> > Bloatclipse with pydev (or aptana).
>
> I have tested Komodo Edit and personally I like best vim + extensions,
> Eric4, Eclipse + pyDev or actually Netbeans.
> I you haven't tested yet give Netbeans a look. In my opinion this is
> the way to go on Python development.
>
> Eclipse+pyDev and Eric4 actually have more Python options, specially
> on refactoring, but Netbeans interface is much clearer and the
> combination of auto completion and documentation is really good. I
> also like very much the svn diff tool with syntax highlight.
>
> Eclipse and Eric4 have a more svn interface. From Netbeans I don't
> like that the auto completion shows all the packages that are in the
> project even if they aren't related to it, and that it shows the pyc.
> But I have been testing it during the last days and even with this
> lacks it's one of the best IDEs.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-11-25 Thread GRoby

Justin,

I reran my tests with the latest version of Apache on my 8.10 test
machine.  I am no longer getting the Segfaults with either worker or
prefork.  I am now getting an Invalid SRS type "wkt" error (that I
assume you are now running into).

I have tried several things (including downgrading PostGreSQL to 8.3.4
from 8.3.5 and switching my GDAL directory to an invalid location  but
have not been able to duplicate the Segfault problem.  (I had an
invalid GDAL directory specified when I was testing last week, but
switching it back now gives me the expected OGR failure exception).

Let me know whether any further testing that I can do would be useful
(maybe seeing whether compiling GEOS and GDAL works with the newest
Apache version?)?

Thanks, for now the downgraded Apache version is working without any
problems.

Greg



On Nov 25, 12:07 pm, Justin Bronn <[EMAIL PROTECTED]> wrote:
> > Based on comments in a separate thread, GeoDango may have issues with
> > multithreaded configuration. Which Apache MPM was being used for each
> > Apache version, prefork or worker? The worker MPM uses threads and so
> > that could be the culprit.
>
> Yes -- the libraries GeoDjango uses, GEOS and GDAL, are not thread
> safe.  Thus, it is highly recommended to use the prefork version of
> Apache.
>
> > In a Python Shell, I am able to perform queries on my spatial models
> > successfully.  In a web browser, I get a plain white screen if any
> > code is executed that works with spatially enabled models.
>
> I created an Ubuntu 8.10 VM to try and test out this problem.
> However, the only way that I could reproduce your exact problem
> (segfault upon HTTP request) is when using the mpm-worker (threaded)
> Apache.  When using the prefork, however, I was able to get both
> mod_python and mod_wsgi to work with a simple demonstration app [1].
> I think mpm-worker is the default when you do `apt-get install
> apache2`, so make sure you have it removed, e.g., `apt-get remove
> apache2-mpm-worker; apt-get install apache2-mpm-prefork`.
>
> BUT, I found another issue -- while I could login to and browse the
> admin interface, whenever I tried to view a geographic model an
> exception would get raised (but no segfault) deep in the admin widgets
> [2], crashing the app.  While this crash occurs in 8.10 it does _not_
> happen in my 8.04 VM.  Thus, this leads me to believe that it may be a
> manifestation of the same troubles you're experiencing.  Moreover,
> this admin crash happens with _both_ mod_python and mod_wsgi in 8.10
> (mod_wsgi configured with `threads=1`).
>
> Needless to say, this behavior has me perplexed at the moment, and due
> to my finals I'm not going to have a lot of time to dig in deeper
> until next month.  Perhaps there's a clash of the libraries that are
> linked to Apache and the ones used by the packaged versions of GEOS/
> GDAL, or maybe it's caused by Ubuntu's AppArmor (confined to just CUPS
> in 8.04) -- but these are just potential possibilities.
>
> > Justin was good enough to run a test case I created and was unable to
> > duplicate the error.  I'm wondering now about the exact versions of
> > Apache and other components that might be causing the problem.
>
> I still have the CentOS 5.2 VM, and I'll test it out again, but I'm
> not sure yet that this could be the same issue as you reported in
> October.  It's a different distribution that used significantly older
> versions (that also worked in my tests).
>
> [1]http://geodjango.org/hg/world
> [2]http://code.djangoproject.com/browser/django/trunk/django/contrib/gis...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



No module named urls

2008-11-25 Thread TheIvIaxx

I just moved my site to a production environment and i get this error
when trying to view the admin stuff.  I want to say its a path issue?
If i use manage.py shell, i can import urls just fine.  Any ideas on
why this error is popping up?

Request Method: GET
Request URL:http://X.X.X.X:8000/admin/
Exception Type: TemplateSyntaxError
Exception Value:
Caught an exception while rendering: No module named urls

Original Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.4/site-packages/django/template/
defaulttags.py", line 373, in render
url = reverse(self.view_name, args=args, kwargs=kwargs)
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 253, in reverse
return iri_to_uri(u'%s%s' % (prefix, get_resolver(urlconf).reverse
(viewname,
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 161, in _get_reverse_dict
for name in pattern.reverse_dict:
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 154, in _get_reverse_dict
if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 198, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
ImportError: No module named urls

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Injecting stuff to an existing list?

2008-11-25 Thread Steve Holden

David Zhou wrote:
> On Tue, Nov 25, 2008 at 9:05 AM, Steve Holden <[EMAIL PROTECTED]> wrote:
>   
>> David Zhou wrote:
>> 
>>> On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote:
>>>   
>> [...]
>> 
>>> Personally, if the current age of a person is something you'll be
>>> using often, I'd add it to the model.
>>>
>>>   
>> That's not very good advice, as the current age of a person changes with
>> time, and you are introducing unnecessary redundancy into the data
>> model. When do you suggest the current age columns should be updated?
>> 
>
> Yeah, I meant what Thomas said.  Add a method to the model that
> calculates age.  I thought that'd be obvious in context given the
> three numbered points, but sorry for the confusion.
>   
As much my fault as yours. Thanks for clarifying.

regards
 Steve


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



Re: access current model id, for custom widget

2008-11-25 Thread yves_s

I want that only dogs (no other animals from other groups) are listed
in the foreignkey drop down box for the representative_animal (which
would be all animals without modification) when I'm editing the
AnimalGroup dogs.

I finally hacked something together with the threadlocals middleware,
which is I found here:
http://stackoverflow.com/questions/160009/django-model-limitchoicestouser-user
see cookbook link on the bottom

Perhaps the patch at 2445 ( http://code.djangoproject.com/ticket/2445
) would also work but I don't wanted to
patch django.

yves

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



Re: Best IDE for Django and python?

2008-11-25 Thread Antoni Aloy

2008/11/25 Kurczak <[EMAIL PROTECTED]>:
>
> I wonder why no one mentioned Komodo IDE or Komodo Edit.
> They're my personal favorites for bigger projects. Both are well
> suited for dynamic languages and really lightweight compared to
> Bloatclipse with pydev (or aptana).

I have tested Komodo Edit and personally I like best vim + extensions,
Eric4, Eclipse + pyDev or actually Netbeans.
I you haven't tested yet give Netbeans a look. In my opinion this is
the way to go on Python development.

Eclipse+pyDev and Eric4 actually have more Python options, specially
on refactoring, but Netbeans interface is much clearer and the
combination of auto completion and documentation is really good. I
also like very much the svn diff tool with syntax highlight.

Eclipse and Eric4 have a more svn interface. From Netbeans I don't
like that the auto completion shows all the packages that are in the
project even if they aren't related to it, and that it shows the pyc.
But I have been testing it during the last days and even with this
lacks it's one of the best IDEs.

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



Re: Running Django on a shared-hosting provider with Apache in fcgi mode

2008-11-25 Thread Oleg Oltar
Aha, the 500 Error was template missconfiguredNow I am getting my
homeage printed in console when running command, but still need to ser WSGI
PARAMS


Please help

On Tue, Nov 25, 2008 at 8:43 PM, Oleg Oltar <[EMAIL PROTECTED]> wrote:

> Also
> [EMAIL PROTECTED] ~/TECHNOBUD $ python manage.py runfcgi >
> text.txt
> WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
> WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
> WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
> WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
>
>
>
> On Tue, Nov 25, 2008 at 8:42 PM, Oleg Oltar <[EMAIL PROTECTED]> wrote:
>
>> Well, when I am trying to do it, I am getting 500 Error (shown in console)
>> Status: 500 INTERNAL SERVER ERROR
>> Content-Type: text/html
>>
>>
>> > http://www.w3.org/TR/html
>> 4/loose.dtd">
>> 
>>   
>>   
>>   TemplateDoesNotExist at /
>>   

Re: Running Django on a shared-hosting provider with Apache in fcgi mode

2008-11-25 Thread Oleg Oltar
Also
[EMAIL PROTECTED] ~/TECHNOBUD $ python manage.py runfcgi >
text.txt
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!


On Tue, Nov 25, 2008 at 8:42 PM, Oleg Oltar <[EMAIL PROTECTED]> wrote:

> Well, when I am trying to do it, I am getting 500 Error (shown in console)
> Status: 500 INTERNAL SERVER ERROR
> Content-Type: text/html
>
>
>  http://www.w3.org/TR/html
> 4/loose.dtd">
> 
>   
>   
>   TemplateDoesNotExist at /
>   

Re: Best IDE for Django and python?

2008-11-25 Thread Kurczak

I wonder why no one mentioned Komodo IDE or Komodo Edit.
They're my personal favorites for bigger projects. Both are well
suited for dynamic languages and really lightweight compared to
Bloatclipse with pydev (or aptana).

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



Re: Running Django on a shared-hosting provider with Apache in fcgi mode

2008-11-25 Thread Oleg Oltar
Well, when I am trying to do it, I am getting 500 Error (shown in console)
Status: 500 INTERNAL SERVER ERROR
Content-Type: text/html


http://www.w3.org/TR/html
4/loose.dtd">

  
  
  TemplateDoesNotExist at /
  

Re: mark_safe() not working for me

2008-11-25 Thread Daniel Roseman

On Nov 25, 4:50 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> I'm trying to influence one of the admin interface change list
> fields by using the below get_progress() method in list_display,
> and using mark_safe().
>
> However, I can't get this to work:
>
> class Job(models.Model):
>      progress = models.PositiveSmallIntegerField()
>
>      def get_progress(self):
>          snippet = u"Progress is %d" % self.progress
>          return mark_safe(snippet)
>
> What happens is that the "" and "" gets translated into
> "

" and "

" in the output. I thought mark_safe() > would help me to avoid that. Obviously not right. > > Is there another way to tell django not to escape the output? > > Any ideas appreciated > /Lars To get HTML into the change_list view, you need to use allow_tags: def get_progress(self): snippet = u"Progress is %d" % self.progress return mark_safe(snippet) get_progress.allow_tags=True -- 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

Re: Caching and I18n

2008-11-25 Thread Antoni Aloy

2008/11/25 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hello Aloy,
>
> I saw the great work you did on ticket #5691. Thanks a lot, I highly
> appreciate that! We have to offer our first release with the bug, but
> I hope to be able to include your patch or a workaround for the next
> one and will give feedback once that's been done.
>
It's nice to help!

But you have to consider this is my first patch on Django core, and I
just be really sure that everything is ok when one of django main
developers double check the tests :)

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cpu load

2008-11-25 Thread Zagor

Hi all,

I recently upgraded Django from 0.96 to 1.0.2 but noticed that the CPU
load for the same site traffic jumped by 50%.  Has anyone else noticed
anything similar or might have any clue as to why this might happen?

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Develop in windows, serve in linux

2008-11-25 Thread Colin Bean

On Tue, Nov 25, 2008 at 10:13 AM, Jeff Anderson
<[EMAIL PROTECTED]> wrote:
> TheIvIaxx wrote:
>> This isnt really a django specific question, but i figured some folks
>> have a similar setup and might be able to offer advice.  I'm
>> developing my django site on vista and i have a server running linux/
>> apache.  Im not sure how to get all my files from the windows box onto
>> the server.  The linux box doesnt have X installed so no remoting :(
>>
>> Is there a common set of tools for this type of thing?
>>
> Absolutely-- ssh, scp, sftp.
>
> Use putty for ssh shell access. There is also winscp, and several gui
> ftp clients can handle sftp. All the tools mentioned use an ssh
> connection to provide their various services. There's plenty of info
> "out there" about using the terminal.
>
>
> Take care!
>
> Jeff Anderson
>
>

To add one more suggestion to what Jeff said, if you're using revision
control you can commit your files in Windows, then check out the
latest version of your code onto your remote server when you deploy (I
usually write a script to do this).  Of course, you'll still need an
SCP client to transfer anything that you don't want in version
control.

Colin

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



Newtonian solution required to fire off a data processing script on the server (REST or SOAP)

2008-11-25 Thread shi shaozhong

I am very much interested in Newtonian solution of using a function to
fire off a data
processing script to run over the internet.

I will be very grateful if you can advise me on passing parameters
from an HTML form to button associated with a script and fire an
external script off to carry out
full execution, monitor its progress and return an innerHTML with link
(a name string of) the file generated back to allow user to download
the result.

The script run over a period of 2 to 3 minutes.


Necessary are  the following steps:
* user submits data to the server from a web page using an HTML form;
server redirects the browser to a status page that says "script is
running";
* in the background, the server fires off a worker script that does
the job; the server monitors the script to see when it's done (this
monitoring can be tied to the status page: when the user reloads the
status page, the server looks at the script to check if it's done);
* user refreshes the page (or the page refreshes itself) until script
is finished, and the page says "script finished; here are the results"
* some kind of cleanup of data, either with a cron job or manually by
the user

Regards.

Shao

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



Re: Template engine reads OS locale (?) and expects comma instead of decimal point in floatformat

2008-11-25 Thread Ulf Kronman

Thanks Karen and Malcolm,
I'll get back with a more thorough answer when I find more time.

I just wanted to leave a short note that I have verified that the
problem actually *is* somewhere in my view code.

I have been able to run another view containing floatformat and get
floats with decimal points though the template.

I'll get back with a report when/if I find the real problem.

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



Re: Develop in windows, serve in linux

2008-11-25 Thread Jeff Anderson
TheIvIaxx wrote:
> This isnt really a django specific question, but i figured some folks
> have a similar setup and might be able to offer advice.  I'm
> developing my django site on vista and i have a server running linux/
> apache.  Im not sure how to get all my files from the windows box onto
> the server.  The linux box doesnt have X installed so no remoting :(
>
> Is there a common set of tools for this type of thing?
>   
Absolutely-- ssh, scp, sftp.

Use putty for ssh shell access. There is also winscp, and several gui
ftp clients can handle sftp. All the tools mentioned use an ssh
connection to provide their various services. There's plenty of info
"out there" about using the terminal.


Take care!

Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Re: Running Django on a shared-hosting provider with Apache in fcgi mode

2008-11-25 Thread Alex Koshelev
You have to start FastCGI demon that will handle request. For example by
using `./manage.py runfcgi`
command

On Tue, Nov 25, 2008 at 20:47, Oleg Oltar <[EMAIL PROTECTED]> wrote:

> Hi!
>
> I have a shared hosting. Need to place there my django application. I
> created ./.htaccess in my root directory which contains following
> [EMAIL PROTECTED] ~ $ cat ./http/.htaccess
> AddHandler fastcgi-script .fcgi
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
>
> Also created file: mysite.fcgi
> #!/usr/bin/python
> import sys, os
>
> # Add a custom Python path.
> # sys.path.insert(0, "/home/virtwww/w_technobud-com-ua_94216229/TECHNOBUD")
>
> # Switch to the directory of your project. (Optional.)
> # os.chdir("/home/user/myproject")
>
> # Set the DJANGO_SETTINGS_MODULE environment variable.
> os.environ['DJANGO_SETTINGS_MODULE'] = "TECHNOBUD.settings"
>
> from django.core.servers.fastcgi import runfastcgi
> runfastcgi(method="threaded", daemonize="false")
>
>
> But when I am trying to access my web server using browser, I am getting
> contents of mysite.fsgi instead of site
> The django project (TECHNOBUD is located in my home directory)
>
> Please help  me... Need to host it urgently
>
> Thanks,
> Oleg
>
>
>
> >
>

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



Develop in windows, serve in linux

2008-11-25 Thread TheIvIaxx

This isnt really a django specific question, but i figured some folks
have a similar setup and might be able to offer advice.  I'm
developing my django site on vista and i have a server running linux/
apache.  Im not sure how to get all my files from the windows box onto
the server.  The linux box doesnt have X installed so no remoting :(

Is there a common set of tools for this type of thing?

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Reusable forms!

2008-11-25 Thread Alex Koshelev
You have to pass form instance to all pages context where it is used. You
can do it explicitly or write custom context processor or (the better
solution) write custom inclusion tag.

On Tue, Nov 25, 2008 at 20:13, Alfonso <[EMAIL PROTECTED]> wrote:

>
> Hey,
>
> I've put together a simple search form that works perfectly when
> navigating to the corresponding url - '/search.html'.  However I want
> to reuse that form on multiple pages so where relevant I use {%
> include 'search.html' %} to inject the form where I need it.
>
> Problem is this form is devoid of any fields when I do that??
>
> The search.html form:
> 
> 
> {{ form.as_p }}
>
> 
> 
>
> Thanks
>
> Alfonso
> >
>

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



Running Django on a shared-hosting provider with Apache in fcgi mode

2008-11-25 Thread Oleg Oltar
Hi!

I have a shared hosting. Need to place there my django application. I
created ./.htaccess in my root directory which contains following
[EMAIL PROTECTED] ~ $ cat ./http/.htaccess
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]

Also created file: mysite.fcgi
#!/usr/bin/python
import sys, os

# Add a custom Python path.
# sys.path.insert(0, "/home/virtwww/w_technobud-com-ua_94216229/TECHNOBUD")

# Switch to the directory of your project. (Optional.)
# os.chdir("/home/user/myproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "TECHNOBUD.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")


But when I am trying to access my web server using browser, I am getting
contents of mysite.fsgi instead of site
The django project (TECHNOBUD is located in my home directory)

Please help  me... Need to host it urgently

Thanks,
Oleg

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



Re: Caching and I18n

2008-11-25 Thread [EMAIL PROTECTED]

Hello Aloy,

I saw the great work you did on ticket #5691. Thanks a lot, I highly
appreciate that! We have to offer our first release with the bug, but
I hope to be able to include your patch or a workaround for the next
one and will give feedback once that's been done.

With regards,
Maik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



filter field choices after selecting another field with javascript in django admin

2008-11-25 Thread Alessandro Ronchi
It should be very useful to filter a select field in django admin when
selecting another field.

Somethin like:
fieldA = foreignKey(Country)
fieldB = foreignKey(State)

when user selects fieldA it should be shown only its states and not
all countries' states.

Is it possible? Someone wrote some similar tasks or snippets?


-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Reusable forms!

2008-11-25 Thread Alfonso

Hey,

I've put together a simple search form that works perfectly when
navigating to the corresponding url - '/search.html'.  However I want
to reuse that form on multiple pages so where relevant I use {%
include 'search.html' %} to inject the form where I need it.

Problem is this form is devoid of any fields when I do that??

The search.html form:


{{ form.as_p }}




Thanks

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



Re: GeoDjango in Ubuntu 8.10, Segmentation Fault

2008-11-25 Thread Justin Bronn

> Based on comments in a separate thread, GeoDango may have issues with
> multithreaded configuration. Which Apache MPM was being used for each
> Apache version, prefork or worker? The worker MPM uses threads and so
> that could be the culprit.

Yes -- the libraries GeoDjango uses, GEOS and GDAL, are not thread
safe.  Thus, it is highly recommended to use the prefork version of
Apache.

> In a Python Shell, I am able to perform queries on my spatial models
> successfully.  In a web browser, I get a plain white screen if any
> code is executed that works with spatially enabled models.

I created an Ubuntu 8.10 VM to try and test out this problem.
However, the only way that I could reproduce your exact problem
(segfault upon HTTP request) is when using the mpm-worker (threaded)
Apache.  When using the prefork, however, I was able to get both
mod_python and mod_wsgi to work with a simple demonstration app [1].
I think mpm-worker is the default when you do `apt-get install
apache2`, so make sure you have it removed, e.g., `apt-get remove
apache2-mpm-worker; apt-get install apache2-mpm-prefork`.

BUT, I found another issue -- while I could login to and browse the
admin interface, whenever I tried to view a geographic model an
exception would get raised (but no segfault) deep in the admin widgets
[2], crashing the app.  While this crash occurs in 8.10 it does _not_
happen in my 8.04 VM.  Thus, this leads me to believe that it may be a
manifestation of the same troubles you're experiencing.  Moreover,
this admin crash happens with _both_ mod_python and mod_wsgi in 8.10
(mod_wsgi configured with `threads=1`).

Needless to say, this behavior has me perplexed at the moment, and due
to my finals I'm not going to have a lot of time to dig in deeper
until next month.  Perhaps there's a clash of the libraries that are
linked to Apache and the ones used by the packaged versions of GEOS/
GDAL, or maybe it's caused by Ubuntu's AppArmor (confined to just CUPS
in 8.04) -- but these are just potential possibilities.

> Justin was good enough to run a test case I created and was unable to
> duplicate the error.  I'm wondering now about the exact versions of
> Apache and other components that might be causing the problem.

I still have the CentOS 5.2 VM, and I'll test it out again, but I'm
not sure yet that this could be the same issue as you reported in
October.  It's a different distribution that used significantly older
versions (that also worked in my tests).

[1] http://geodjango.org/hg/world
[2] 
http://code.djangoproject.com/browser/django/trunk/django/contrib/gis/admin/widgets.py#L43
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



mark_safe() not working for me

2008-11-25 Thread Lars Stavholm

I'm trying to influence one of the admin interface change list
fields by using the below get_progress() method in list_display,
and using mark_safe().

However, I can't get this to work:

class Job(models.Model):
 progress = models.PositiveSmallIntegerField()

 def get_progress(self):
 snippet = u"Progress is %d" % self.progress
 return mark_safe(snippet)

What happens is that the "" and "" gets translated into
"

" and "

" in the output. I thought mark_safe() would help me to avoid that. Obviously not right. Is there another way to tell django not to escape the output? Any ideas appreciated /Lars --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

Re: Usage opinion wanted

2008-11-25 Thread Saurabh Agrawal
Hi,

Thanks for the wonderful inputs.

All right, I will give you the actual scenario and maybe you  guys can help
me further:

I think the application should have 4 modules, interconnected with each
other and accessible via proper user perms:

1. The front office: This will have all student records, their results,
records of staff etc. + Fee/Donation collection, salary distribution modules
etc.

2. The academic administrator: This will have all academic records of
students +  managing academic calender + this might also have certain
modules for *building up* question/activity bank for students etc.

3. Manager: This will have financial records + inventory + bus management
system etc.

4. Teacher: This will have all basic info + academic records of students +
*viewing* question/activity bank.
(This module might be accessed via 2-3 PCs kept in staff room)

I want to have good UI for creating & viewing question + activity bank and
also managing academic calender, as that will be used by people who are not
much computer savvy. Rest I guess, would be mostly data manipulation.

I think not much networking is involved here, right, apart of course from
accessing the database server?

I guess, now that I have read your emails and have noted down my
requirements, I would rather go with django, right?

Thanks once again!

Regards,
Saurabh.







On Tue, Nov 25, 2008 at 9:40 PM, Jeff FW <[EMAIL PROTECTED]> wrote:

>
> Saurabh,
>
> I have spent the past year developing a GUI application (using
> wxPython) that communicates with a server (using Twisted), which
> connects to a PostgresQL database (using SQLAlchemy.)  It has been a
> very rewarding experience learning and using all of these tools.
> However, the learning curve was quite steep--especially getting all of
> the libraries to work with each other.
>
> I've also worked on a number of Django web applications in the same
> time.  Having written web sites/applications since the early days of
> the web, I can safely say that Django is the best tool for doing so.
> Period.  It makes me regret the years I spent working with PHP.
>
> You obviously have serious programming experience--C++ (especially
> graphics work) is much harder than anything you'll be dealing with for
> this application.  So really, it depends on what set of tools you
> *want* to learn.  HTML, CSS and (basic) Javascript are very easy to
> pick up--almost negligible when compared with learning a GUI toolkit
> and networking library (or dealing with connections manually, which is
> very painful.)
>
> Another thing to consider are deploying the application.  With a GUI
> app, you'd need a way of deploying and updating for every machine it
> runs on.  With a web app--make your change on the server and you're
> done.  How many people would be using the app?
>
> Then there's the matter of how complicated of an interface you really
> need.  What does the application need to *do*? For most things, a web
> app would suffice.  I went with a desktop app because (eventually) the
> app will need to incorporate a very UI-intensive scheduling module.
> If most of your app will be simple forms, and displaying lists of
> data--go with Django.
>
> I started writing this e-mail with the intent of giving a balanced
> opinion, but it seems that I think you should go with Django.  If you
> can tell me more about your app and what it will need to do, I can try
> to give you some better advice, but really, it boils down to this:
> writing a GUI app will take *much* longer than writing the equivalent
> with Django.  However, you may have to sacrifice some usability.
>
> -Jeff
>
> On Nov 24, 8:24 pm, "Saurabh Agrawal" <[EMAIL PROTECTED]> wrote:
> > Hi group:
> >
> > I hope that you good people here could help me with a decision I am
> finding
> > hard to make.
> >
> > I am about to develop a MIS type application for a Non for profit
> > organization teaching young children in India.
> >
> > I am trying to use this opportunity to make myself learn python, and if
> > required the whole web based development paradigm using django.
> >
> > I have experience of c++ graphical algorithms development.
> >
> > Now obviously this application would be database based and database
> > manipulation would be the major part. It would be mostly used across
> desktop
> > computers in the organization running Windows XP. The decision which I am
> > unable to make is that should I use django for this project? My issues
> are:
> >
> > 1. This application would be run on desktops, so GUI toolkits such as
> PyQT
> > might suffice.
> > 2. Making good interfaces for web would require additional learning on my
> > part such as HTML, CSS and Javascript, an area  in which I have
> absolutely
> > no expertise, just a very basic idea.
> >
> > So what do you guys suggest? If learning the above things would still
> give
> > me an edge( in terms of time required for development) over PyQt based
> > interfaces, in terms of automated databse manipulation t

Re: multi field validation

2008-11-25 Thread Alessandro Ronchi
2008/11/25 Jeff FW <[EMAIL PROTECTED]>:
>
> Alessandro,
>
> I'm not exactly sure what you're asking, but I think you want to know
> how to check multiple fields (possibly against each other) when
> submitting a form in the admin.  Let me know if I'm off-base here.
>
> Take a look at:
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin
>
> You can do multi-field validation by adding a clean() method that will
> run after every clean_FIELDNAME() method, and can do any checking you
> need, and raise a ValidationError if it fails.

It's perfect.
I've used that and this:
http://www.pointy-stick.com/blog/2008/10/15/django-tip-poor-mans-model-validation/

to combine the model and form validation. So I can do all type of
multi field validations.

it should be simpler if someday will be added the possibility to
refers to fields directly (self.fieldname), instead of
self.cleaned_data.get(fieldname)
but it's near to perfection, so thanks!



-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

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



Re: parameter not getting passed to view function

2008-11-25 Thread Mahesh Vaidya

Thank You all for your help; yes there was error in RegEx.

On Tue, Nov 25, 2008 at 10:01 AM, jai_python <[EMAIL PROTECTED]> wrote:
>
> modify ur url as
>  (r'^hello/(?P[^/]+\w*)/?', 'swamiji.poll.views.hello')
>
> http://localhost:8000/hello/TEST
> then "print who" in ur view file.
>
> Lemme know, if it fails to work.
> >
>



-- 
--Mahesh
Bangalore

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



Re: multi field validation

2008-11-25 Thread Jeff FW

Alessandro,

I'm not exactly sure what you're asking, but I think you want to know
how to check multiple fields (possibly against each other) when
submitting a form in the admin.  Let me know if I'm off-base here.

Take a look at:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin

You can do multi-field validation by adding a clean() method that will
run after every clean_FIELDNAME() method, and can do any checking you
need, and raise a ValidationError if it fails.

-Jeff

On Nov 25, 4:29 am, "Alessandro Ronchi" <[EMAIL PROTECTED]>
wrote:
> It's not possible to validate a model in admin checking multiple forms
> conditions?
>
> is there any example or code snippet ?
>
> --
> Alessandro Ronchi
> Skype: aronchihttp://www.alessandroronchi.net
>
> SOASI Soc.Coop. -www.soasi.com
> Sviluppo Software e Sistemi Open Source
> Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
> Tel.: +39 0543 798985 - Fax: +39 0543 579928
>
> Rispetta l'ambiente: se non ti è necessario, non stampare questa mail
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Usage opinion wanted

2008-11-25 Thread Jeff FW

Saurabh,

I have spent the past year developing a GUI application (using
wxPython) that communicates with a server (using Twisted), which
connects to a PostgresQL database (using SQLAlchemy.)  It has been a
very rewarding experience learning and using all of these tools.
However, the learning curve was quite steep--especially getting all of
the libraries to work with each other.

I've also worked on a number of Django web applications in the same
time.  Having written web sites/applications since the early days of
the web, I can safely say that Django is the best tool for doing so.
Period.  It makes me regret the years I spent working with PHP.

You obviously have serious programming experience--C++ (especially
graphics work) is much harder than anything you'll be dealing with for
this application.  So really, it depends on what set of tools you
*want* to learn.  HTML, CSS and (basic) Javascript are very easy to
pick up--almost negligible when compared with learning a GUI toolkit
and networking library (or dealing with connections manually, which is
very painful.)

Another thing to consider are deploying the application.  With a GUI
app, you'd need a way of deploying and updating for every machine it
runs on.  With a web app--make your change on the server and you're
done.  How many people would be using the app?

Then there's the matter of how complicated of an interface you really
need.  What does the application need to *do*? For most things, a web
app would suffice.  I went with a desktop app because (eventually) the
app will need to incorporate a very UI-intensive scheduling module.
If most of your app will be simple forms, and displaying lists of
data--go with Django.

I started writing this e-mail with the intent of giving a balanced
opinion, but it seems that I think you should go with Django.  If you
can tell me more about your app and what it will need to do, I can try
to give you some better advice, but really, it boils down to this:
writing a GUI app will take *much* longer than writing the equivalent
with Django.  However, you may have to sacrifice some usability.

-Jeff

On Nov 24, 8:24 pm, "Saurabh Agrawal" <[EMAIL PROTECTED]> wrote:
> Hi group:
>
> I hope that you good people here could help me with a decision I am finding
> hard to make.
>
> I am about to develop a MIS type application for a Non for profit
> organization teaching young children in India.
>
> I am trying to use this opportunity to make myself learn python, and if
> required the whole web based development paradigm using django.
>
> I have experience of c++ graphical algorithms development.
>
> Now obviously this application would be database based and database
> manipulation would be the major part. It would be mostly used across desktop
> computers in the organization running Windows XP. The decision which I am
> unable to make is that should I use django for this project? My issues are:
>
> 1. This application would be run on desktops, so GUI toolkits such as PyQT
> might suffice.
> 2. Making good interfaces for web would require additional learning on my
> part such as HTML, CSS and Javascript, an area  in which I have absolutely
> no expertise, just a very basic idea.
>
> So what do you guys suggest? If learning the above things would still give
> me an edge( in terms of time required for development) over PyQt based
> interfaces, in terms of automated databse manipulation tools such as the
> admin interface, I would go for it and it might be a good experience for me.
>
> Thanks for reading this slightly incoherent and maybe off-topic mail.
>
> All suggestions are welcome and I would be grateful for them.
>
> Regards,
> Saurabh Agrawal.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Injecting stuff to an existing list?

2008-11-25 Thread bruno desthuilliers



On 25 nov, 10:17, sajal <[EMAIL PROTECTED]> wrote:
> David/Daniel,
>
> Thanks a lot for the prompt responses, ill use the method as specified
> by Daniel.
>
> I had use methods earlier for get_absolute_url and stuff, but didnt
> realize i could use methods to do anything I wanted...

Well... This is the whole point of a model layer : centralizing model-
related stuff where it belongs. Also note that Python being highly
dynamic, you can add new methods at runtime to an existing class,
which is very handy when using third-part applications:

# mymodel.py
from thirdpart.model import Person

def get_age(self):
return calculate_age(self.birth_date)

Person.get_age = get_age


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



Re: Injecting stuff to an existing list?

2008-11-25 Thread David Zhou

On Tue, Nov 25, 2008 at 9:05 AM, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> David Zhou wrote:
>> On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote:
> [...]
>>
>> Personally, if the current age of a person is something you'll be
>> using often, I'd add it to the model.
>>
> That's not very good advice, as the current age of a person changes with
> time, and you are introducing unnecessary redundancy into the data
> model. When do you suggest the current age columns should be updated?

Yeah, I meant what Thomas said.  Add a method to the model that
calculates age.  I thought that'd be obvious in context given the
three numbered points, but sorry for the confusion.

-- 
---
David Zhou
[EMAIL PROTECTED]

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



Re: Injecting stuff to an existing list?

2008-11-25 Thread bruno desthuilliers

On 25 nov, 10:04, "David Zhou" <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote:
> > Now Id like to show age of the people along with their names.
>
> > I have a function which can calculate age callable via calculateAge
> > (p.date_of_birth)  but how do I make pass this along with the person
> > object?
>
> There's several ways you could approach this:
>
> 1. Create a new template tag
(snip)
> 2. Add a current_age method to the Person model,
(snip)
>
> 3. Return a list of tuples in your context processor:
>
(snip)

You forgot one: write a custom filter:

@register.filter
def calculate_age(date):
   return some_calculation(date)


{% load myfilters %}
{% for person in borntoday %}
{{ person }} - {{ person.date_of_birth|calculate_age }}
{% endfor %}


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



Re: Best IDE for Django and python?

2008-11-25 Thread Ovnicraft
2008/11/25 Russell Keith-Magee <[EMAIL PROTECTED]>

>
> On Tue, Nov 25, 2008 at 5:27 PM, DragonSlayre <[EMAIL PROTECTED]> wrote:
> >
> > Hey, I'm getting started with a friend in developing a site with
> > Django, and we're both new to this, so I am wondering what people use
> > to manage all their files, and for looking at documentation etc.
>
> While I must apologize for Kenneth's poorly expressed frustration, his
> underlying message is sound - this has come up _many_ times on
> Django-users. A quick Google search should return many options, but
> there is no clear or correct answer to your question.
>
> > Having come from a Java background, I'm used to great documentation,
> > and suspect that Java is very much the leader in doc, and not the
> > standard.
>
> Having spent the afternoon wrestling with J2EE, I'd strongly disagree
> with this assertion. I will agree that Java projects tend to have have
> very extensive API documentation. This is a result of the combination
> of Javadoc and strong IDE integration that supports Javadoc. However,
> the quality of that documentation is highly variable. Unfortunately,
> the fact that Java IDEs automatically write Javadoc stubs and provide
> 1 button "build the documentation" hooks gives developers the mistaken
> impression that a project is "well documented". Documentation for the
> method "get_username()" that reads "Returns the username" doesn't
> really illuminate anything.
>
> There is also the argument that good APIs don't require lots of API
> documentation - after all, it should be obvious what get_username()
> returns. If your API entry points require extensive explanations,
> perhaps you need a better API.
>
> Good documentation means more than an API (and a _lot_ more than an
> empty autogenerated stub). Documentation means good explanations of
> the big picture - how the pieces fit together, how to achieve
> important tasks, significant internal states, etc. This sort of
> documentation doesn't fit well into simple API docs. It is also very
> hard to write, and as a result, it often isn't written, and when it
> is, it is rarely written well. This isn't unique to Java, either - the
> vast majority of open source projects suffer from this affliction.
>
> I'd like to think that Django is on the better end of the spectrum
> when it comes to documentation - we are blessed to have a journalism
> major amongst our project founders, and a couple of other liberal arts
> majors amongst the frequent contributors. As a result,
> docs.djangoproject.com is a pretty thorough resource, and is generally
> well written. This documentation is by no means perfect, but it is
> certainly better than a lot of other projects out there.
>
> In addition to the official documentation, there is a wealth of
> contributions on django-users and in the blogging community around
> Django that provides excellent material to supplement the official
> docs. Again, Google is your friend, and Django is a pretty specific
> Google keyword :-)
>
> > I've used the pydev plugin for eclipse, but it seems extremely
> > limited.
>
> I've used PyDev too, and I'd agree with your assessment. However,
> others seem to like it. YMMV.
>
> > How do you develop your django projects, and where do you go when you
> > need to find documentation?
>
> Your original query actually reveals a bias that is significant - why
> do you want an IDE in particular?
>
> Java, as a semi-traditional compiled language, lends itself to IDE
> development. The write-compile-run cycle places a certain imperative
> on getting code right the first time. Admittedly, the incremental
> compilation features of modern Java IDEs make this less of an issue,
> but the general language culture leans towards tools and development
> techniques that support this general philosophy.
>
> However, dynamic languages tend not to leverage IDEs as much. A lot of
> Python developers (and developers in other dynamic languages) tend to
> develop using relatively lightweight text editors. Some of these
> editors provide code highlighting, code completion, and other IDE-like
> features, but they definitely don't go as far as a traditional IDE.
>
> There are at least two reasons for this. Firstly, dynamic languages
> don't require a write-compile-run cycle, so they lend themselves to
> much greater experimentation. Want to know if an idea will work? Fire
> up an interactive Python shell and test out your idea. Editors can
> help you maintain scratchpads to develop a complex test harnesses; the
> Python runtime environment provides the ability to dynamically reload
> code modules during runtime. IDEs are very good when you're dealing
> with managing a body of code that is 'published' into a compiled
> product; I'm yet to see an IDE that can deal elegantly with the
> capabilities of a dynamic language.
>
> Secondly, there is the long standing "unix vs windows" philosophical
> argument. The Windows world (which, for all the Sun heritage, Java
> really is

Re: django documentation

2008-11-25 Thread Brian Neal

On Nov 25, 8:44 am, ReneMarxis <[EMAIL PROTECTED]> wrote:
> Hello Brian
>
> i allready saw those hints on the djangoproject/djangobook homepage
> and that was the reason i was writing this post.
> Imagine i am new to django, i read "i have to add those lines to my
> model and do some stuff on the setting.py file and run syncdb" then
> everything is ok and i can use get_profile to load the profile .
> I did that but running get_profile raises exceptions. I took quite a
> bit to realize that the profile does not get generated automaticly
> (checked in db table) but you have to create it by yourself.
> I mean its just one sentense more but it would save many searching on
> the web.
>

Well, if you worked through the tutorial you should know that you need
to run syncdb after creating a new model. Your user profile is a model
after all and it needs to reside in your database for get_profile to
work. To be honest, it seemed to me your post was a thinly disguised
jab at the docs. We all feel the way you do at first, that everything
is hard to find. But if you keep reading the docs and studying other
people's source code (check out all the django apps on
code.google.com), you'll get the hang of this.

I realize we all learn differently and at our own pace. I think that
the django docs are some of the most well written and comprehensive
docs I have seen for an open source web framework. Seriously. Have you
ever looked at another frameworks docs? If you find the docs lacking
on some point, write a Trac ticket. The developers are very responsive
to documentation requests in my one single experience. They understand
the value of good docs.

I also encourage you to get on the IRC channel. You can get fast
pointers from experts that way if you are stuck.

And finally, don't forget the actual django source code. Learning how
to navigate it and find things in it is very useful. If you are
confused about the docs, take a peek at the code. You will also learn
something about python that way.

Enjoy your experience with django!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



admin can't update: AttributeError 'parse_file_upload' for a model with no file field

2008-11-25 Thread omat

Hi,

I am trying to update a object via admin interface. Nothing fancy, and
it all goes well on my local environment, as it does many times
before.

But in the production site, I get an AttributeError:

'module' object has no attribute 'parse_file_upload'


The traceback (which dpaste refused to save) is as follows:


Environment:

Request Method: POST
Request URL: http:///pws/admin/encounter/standardcomment/10/
Django Version: 1.0.2 final
Python Version: 2.5.1
Installed Applications:
['registration',
 'django.contrib.auth',
 'django.contrib.admin',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.humanize',
 'thumbnail',
 'userprofile',
 'nhsdata',
 'encounter']
Installed Middleware:
('django.middleware.cache.CacheMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'debugfooter.DebugFooter')


Traceback:
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\core
\handlers\base.py" in get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
\admin\sites.py" in root
  157. return self.model_page(request, *url.split('/',
2))
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\views
\decorators\cache.py" in _wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
\admin\sites.py" in model_page
  176. return admin_obj(request, rest_of_url)
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
\admin\options.py" in __call__
  197. return self.change_view(request, unquote(url))
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\db
\transaction.py" in _commit_on_success
  238. res = func(*args, **kw)
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\contrib
\admin\options.py" in change_view
  561. if request.method == 'POST' and request.POST.has_key
("_saveasnew"):
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\core
\handlers\pyisapie.py" in _get_post
  51. This._load_post_and_files()
File "D:\CMSRoot\Clarifix-ILG\Python25\Lib\site-packages\django\core
\handlers\pyisapie.py" in _load_post_and_files
  32.   This._post, This._files = http.parse_file_upload
(This._headers_in, This.raw_post_data)

Exception Type: AttributeError at /pathwaysolutions/validation/admin/
encounter/standardcomment/10/
Exception Value: 'module' object has no attribute 'parse_file_upload'


This happens for every model and every add / edit operation.


The model in example does not have a file or image field. Where does
this 'parse_file_upload' thing come from?


Due to the production environment limitations, the site should run
under a fixed URL, /pws/. This does not cause any problem within the
application, though. Can it be the cause of the admin sites weird
behavior?


Thanks for any comment,
oMat


ps: Django 1.0.2 is running both in local development and production
environments. IIS 6 is the server in production.


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



Re: psycopg2 Visual Studio installation error on XP

2008-11-25 Thread dj

Yes they were able to help me fix the problem.
Thank you Peter.

On Nov 17, 1:00 pm, "Peter Herndon" <[EMAIL PROTECTED]> wrote:
> Hi DJ,
>
> Psycopg2 has a C extension wrapped by Python.  That C extension must
> be compiled with the same compiler used to compile the Python compiler
> itself.
>
> This is not a Django issue, this is a psycopg issue.  You should ask
> for assistance on the psycopg mailing list, they'll be better able to
> help you.
>
> You should also look around for pre-compiled binaries of psycopg2 for
> Windows, as the packagers will have taken this compiler mismatch issue
> into account.
>
> ---Peter
>
> On 11/17/08, dj <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello All,
>
> > I am django novice and i am very, very ,very, very green.
>
> > I am trying to setup the PostgresSQL database with the psycopg2
> > library. I downloaded the psycopg2-2.0.8.tar file.
> > Opened the tar with Winzip and installed the library from the command
> > line using python setup.py. I got this really strange error message.
>
> > error: Python built with Visual Studio 2003; extensions must be built
> > with a complier than can generate compatiable binaries. Visual Studio
> > 2003 was not found on this system. If you have Cygwin installed, you
> > can tru compiling with MingW32, by passing "-c mingw32 to setup.py"
>
> > I am not using Visual Studio for any of my development, I am using the
> > python.
> > Do I need to install Cywgin or is there a work around ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django documentation

2008-11-25 Thread ReneMarxis

Hello Brian

i allready saw those hints on the djangoproject/djangobook homepage
and that was the reason i was writing this post.
Imagine i am new to django, i read "i have to add those lines to my
model and do some stuff on the setting.py file and run syncdb" then
everything is ok and i can use get_profile to load the profile .
I did that but running get_profile raises exceptions. I took quite a
bit to realize that the profile does not get generated automaticly
(checked in db table) but you have to create it by yourself.
I mean its just one sentense more but it would save many searching on
the web.

Also take a look on the groups:

"
Groups

Groups are a generic way of categorizing users so you can apply
permissions, or some other label, to those users. A user can belong to
any number of groups.

A user in a group automatically has the permissions granted to that
group. For example, if the group Site editors has the permission
can_edit_home_page, any user in that group will have that permission.

Beyond permissions, groups are a convenient way to categorize users to
give them some label, or extended functionality. For example, you
could create a group 'Special users', and you could write code that
could, say, give them access to a members-only portion of your site,
or send them members-only e-mail messages.
"

Now try to use this infomation. The documentation should point out,
that i have to create the groups with the Admin, that i have to add
the users in the Admin to those groups. It should also tell me if/how
i can add/remove users to group by code? Or creating the groups by
running syncdb (probably i have to use some dumpload)
What i want to say is that the provided infomation is not realy
usefull for someone begining django. I have to read the docs and then
start searching on the web to figure out how to use the functionality.
Thats what seems insufficient to me. And this are only 2 aspects i
wrote down as a example.

Now i just ordered 2 Books on Django and one on Python :) Hope they
will cover functions more complete.

PS: http://djangoapi.quamquam.org/trunk/

_thanks


On 25 Nov., 01:38, Brian Neal <[EMAIL PROTECTED]> wrote:
> On Nov 24, 5:18 pm, ReneMarxis <[EMAIL PROTECTED]> wrote:
>
> > hi
>
> > as mentioned earlyer today i am very new to django and againe have
> > some question, this time reguarding the documentation.
>
> > I started django by duing the tutorial, and now i started building my
> > own little project from ground up :) but i am lacking of information.
> > I am missing some documentation, some good organised api.
>
> > E.g. i want to implement AUTH_PROFILE_MODULE to store additional infos
> > on the user. The documentation fromhttp://docs.djangoproject.comsays
> > "define that in settings.py and in your model and use it via
> > get_profile" But no one tells you that you have to create it by
> > yourself and save it also. Ok this is something you can try out but
> > the information would be placed good on the doc side.
>
> http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-...http://www.djangobook.com/en/1.0/chapter12/#cn222
>
>
>
> > Can anyone give me some link to one good documentation or do there
> > exist good books which cover issue's completly so you don't have to
> > search most time while learning?
>
> Searching is part of the process of learning.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Injecting stuff to an existing list?

2008-11-25 Thread Thomas Kerpe
I think David meant a method in the model not a field so nothing is stored.

//Thomas

2008/11/25 Steve Holden <[EMAIL PROTECTED]>

>
> David Zhou wrote:
> > On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote:
> [...]
> >
> > Personally, if the current age of a person is something you'll be
> > using often, I'd add it to the model.
> >
> That's not very good advice, as the current age of a person changes with
> time, and you are introducing unnecessary redundancy into the data
> model. When do you suggest the current age columns should be updated?
>
> regards
>  Steve
> --
> Steve Holden+1 571 484 6266   +1 800 494 3119
> Holden Web LLC  http://www.holdenweb.com/
>
> >
>

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



Re: I18N not working

2008-11-25 Thread Alex Jonsson

Woohoo! Looks like I solved it.

The error I had made was that inside my locale folders I had named
Swedish "sv_se" which wasn't right. I looked into the django/conf/
locale folder and saw that there they referred to Swedish as "sv". So
by changing the folder names Django finally found them.

Oh, and I can concur that the LocaleMiddleware is not needed to
translate per-app.

Thank you everyone for your help!

On Nov 25, 12:37 pm, Alex Jonsson <[EMAIL PROTECTED]> wrote:
> I did just check the permissions, and even tried change them to a=rwx.
> Still not working.
>
> I tried a couple of other things as well - I made a symlink in one of
> my folders on my PYTHONPATH pointing to my project (it required me to
> do that in order to run the django-admin.py makemessages command) and
> then made and compiled a project-wide translation. Still not working!
>
> Could it have something to do with gettext or such? I use the
> ugettext_lazy and my server runs Python 2.3.
>
> On Nov 25, 12:03 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On Tue, 2008-11-25 at 03:01 -0800, Alex Jonsson wrote:
> > > Thank you everyone for your feedback.
>
> > > I forgot to mention that I read that paragraph in the docs as well and
> > > already installed the LocaleMiddleware. This makes the translation of
> > > the built-in modules work, but not my per-app translations. This was
> > > why I was thinking that maybe it had something to do with my
> > > PYTHONPATH. I've even tried to change it to include all the apps
> > > directories, but that was to no avail either.
>
> > > Any ideas?
>
> > Have you checked permissions? Does the webserver have permission to read
> > the files in question (including permission to access the directories
> > all the way the down to the files)?
>
> > Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Injecting stuff to an existing list?

2008-11-25 Thread Steve Holden

David Zhou wrote:
> On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote:
[...]
> 
> Personally, if the current age of a person is something you'll be
> using often, I'd add it to the model.
> 
That's not very good advice, as the current age of a person changes with
time, and you are introducing unnecessary redundancy into the data
model. When do you suggest the current age columns should be updated?

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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



Re: Disabling Admin validation

2008-11-25 Thread suganthi saravanan
Hi David,

Try it!

If you are using (blank=true) inside the model class, validation disable.

class Gallery(models.Model):
   name=models.CharField(max_length=200, blank=true)


Cheers
sugi

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



Re: trouble with foreignkey and admin interface

2008-11-25 Thread delfick755

> The error message is telling you exactly what the problem is here. It
> wants Position to have a ForeignKey to Member. When you read that and
> look at your models and see that you have Member having a ForeignKey to
> Position, you have to then think that perhaps that means you've got the
> inline direction going the wrong way. There's nothing in the
> documentation to say it's a bidirectional option. ForeignKey is a
> many-to-one option: many members for one position. Inline editing exists
> so that you can edit these "many" members inline with the single
> position that they all relate to. It isn't needed for the other
> direction.
>
> You don't seem to have tried the obvious solution here: include
> "position" in the list of fields for Member's admin. That will do
> exactly what you're after.
>
> Regards,
> Malcolm

ok then, thanks for the help.

However, I didn't see your response till just now (I sent the initial
question via gmail and expected that it wouldn't automatically add
repsonses to that conversation in gmail, but it seems it doesn't)

Anyways, I spent some time after work today playing around with it and
reading django model documentation and trying to figure it all out,
and the following works

class Committee(models.Model):
year = models.IntegerField()
members = models.ManyToManyField('Member')

class Member(models.Model):
name = models.CharField(max_length=50)
degree = models.CharField(max_length = 50)
desc = models.TextField()
position = models.ManyToManyField('Position')

class Position(models.Model):
year = models.IntegerField()
position_type = models.ForeignKey('PositionType')

class PositionType(models.Model):
title = models.CharField(max_length=50)
desc = models.TextField()

Even with default settings for admin interface :)

Only thing I need now is the "add another" button for the relationship
fields to show up even when there isn't already an instance of the
object in question in the database.

I say this, because, let's say for example the admin page for
committee.
If there is already at least one member in the database, then the
control for the members field will have this nice little green '+'
that allows me to create more members, however if there is no members
already in the database, it isn't there.
(same with foreignKey fields)

for further illustration, screenshots :)
with no objects : http://delfick.test.googlepages.com/noObjects.png
with at least one object : http://delfick.test.googlepages.com/moreThanOne.png

Thankyou

.

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



Re: generating a list of click-able links to a detail page

2008-11-25 Thread dash86no

Donn, Daniel,

Thanks for your advice. I combined both your ideas together and now
have a solution to my problem.

It was pretty difficult though; that documentation is a little hard
core. For example, there were references to post_save_redirect
throughout the documentation but no explanation or example of where to
put it. Eventually, I stumbled across an answer on these mailing lists
(the solution I found was to pass the model and post_save_redirect by
putting them both into dict())

I'm really exited about Django and I can already see that it is an
amazingly powerful framework that would make it possible to build
complex applications quickly and efficiently. However, although the
first 4 chapters of the documentation tutorials got me really far,
beyond that point it has felt so far like I reached the end of a path
only to find myself in the thick of a jungle.

I'm enjoying learning though, and really appreciate the help from the
people on this list.

Thanks

On Nov 24, 11:12 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Nov 24, 11:59 am,dash86no<[EMAIL PROTECTED]> wrote:
>
>
>
> > I've implemented a search function which brings up a list of database
> > items on a page. My template looks like this:
>
> > {% extends "base.html" %}
>
> > {% block content %}
>
> >     {% if results %}
> >       
> >       {% for quote in results %}
> >         {{ quote|escape }}
> >       {% endfor %}
> >       
> >     {% else %}
> >       No quotes found
> >     {% endif %}
> > {% endblock %}
>
> > My search code is like this:
>
> > def search(request):
> >     query = request.GET.get('q', '')
> >     if query:
> >         qset = (
> >             Q(name__icontains=query) |
> >             Q(company__name__icontains=query) |
> >             Q(note__icontains=query)
>
> >         )
> >         #results = Quote.objects.filter(qset).distinct()
> >         results = Quote.objects.filter(qset)
> >     else:
> >         results = []
>
> >     return render_to_response("sam_app/search.html", {
> >         "results": results,
> >         "query": query
> >     })
>
> > The problem, is that the outputted list is just static text. What I
> > want, is a series of links that when I click one one of them, will
> > bring up the relevant item in a form for editing.
>
> > I found 
> > this:http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index
>
> > And saw the form.as_p form.as_table form.as_ul and got exited because
> > I thought this might work. I edited the above code to make the search
> > function pass a form object to the template, but then I got the error:
> > Caught an exception while rendering: too many values to unpack.
>
> > So I guess this isn't it?
>
> > I know I could just put together a loop to generate links with the pk
> > encoded inside the url, and do it like that, but it seems to me there
> > should be a neat little method in django to do this automatically. It
> > also though generic views might be the answer but I don't think you
> > can customize those, right?
>
> > Cheers,
>
> You can use the create/update generic views[1] to provide the actual
> edit pages. Once they are linked in your urls.py, you can use the {%
> url %} tag[2] to link to them from your list template.
>
> [1]:http://docs.djangoproject.com/en/dev/ref/generic-views/#create-update...
> [2]:http://docs.djangoproject.com/en/dev/ref/templates/builtins/#url
>
> --
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Best IDE for Django and python?

2008-11-25 Thread Abdel Bolanos Martinez
I think pydev + eclipse + aptana is the best choice, just configure
correctly python PATH in pydev so the autocomplete works fine, debug
your code with the extra option runserver 8080 --noreload works fine
too, create external tools django commands, improve your pages with
aptana, use firefox as your web-browser with addons FIREBUG installed
(debug JavaScript, inspect HTML code, net speed). 
I used to work with Java but Python is relly good.


On Tue, 2008-11-25 at 15:27 +0300, Nikolay Panov wrote:

> I'm using just gvim + some plugins (help.vim, autocomplpop.vim,
> snippetsEmu.vim, ...). As for me, this is quite enough.
> 
> Have a nice day,
>Nikolay.
> 
> 
> 
> On Tue, Nov 25, 2008 at 11:27, DragonSlayre <[EMAIL PROTECTED]> wrote:
> >
> > Hey, I'm getting started with a friend in developing a site with
> > Django, and we're both new to this, so I am wondering what people use
> > to manage all their files, and for looking at documentation etc.
> >
> > Having come from a Java background, I'm used to great documentation,
> > and suspect that Java is very much the leader in doc, and not the
> > standard.
> >
> > I've used the pydev plugin for eclipse, but it seems extremely
> > limited.
> >
> > How do you develop your django projects, and where do you go when you
> > need to find documentation?
> > >
> >
> 
> > 
> 



Abdel Bolaños Martínez
Ing. Infórmatico
Telf. 266-8562
5to piso, oficina 526, Edificio Beijing, Miramar Trade Center. ETECSA

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



Re: Testing dynamic templates

2008-11-25 Thread Russell Keith-Magee

On Tue, Nov 25, 2008 at 9:18 PM, Tim Chase
<[EMAIL PROTECTED]> wrote:
>
>> Check out django.contrib.auth.tests.views.py.
>
> Is there some master index of documentation for "if you want to
> test X, see Y.py or http://Z for an example of how to do it"?
> where X is any of a number of Django features such as models,
> views, templates, middleware, filters, template-tags, forms,
> database-configurations, custom field-types, etc?
>
> I've read through
>
> http://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs
>
> and there are some good specifics here (I'd expect that several
> of the "see http://Z"; links would point here).  However, it would
> be nice to have a "testing cookbook" that would attack the topic
> by "thing you want to test" (perhaps with both unittest and
> doctest examples).
>
> Most of my learning-to-test-my-Django-app has happened through
> trial and error, so any sort of "you want to test X, see Y" would
> be helpful.

... and I'd like a pony. :-)

Seriously - I agree. The testing documentation could certainly be
improved - not just raw API, but lots of tutorials and cookbook stuff.

As soon as I work out where I put my +4 Fountain of Infinite Time,
I'll get right on this. In the meantime, if anyone wants to contribute
documentation, this is certainly an area where help would be
appreciated.

Yours,
Russ Magee %-)

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



Re: Admin form

2008-11-25 Thread sadeesh Arumugam
Hi Praveen,

You add these lines you can get the admin interface...

Coding:
***

  from django.conf.urls.defaults import *


 # Uncomment the next two lines to enable the admin:

from django.contrib import admin

admin.autodiscover()


 urlpatterns = patterns('',


 (r'^admin/(.*)', admin.site.root),

)


On Tue, Nov 25, 2008 at 5:46 PM, Praveen <[EMAIL PROTECTED]>wrote:

>
> Hi All, i am very new bie of Django, i have started work on before 3
> days.
> I am following DJango book. I am playing with 6 chapter "Using the
> admin interface"
> In my urls.py file i set the url for admin
>
> from django.conf.urls.defaults import *
> urlpatterns = patterns('',
># Example:
># (r'^blog/', include('blog.foo.urls')),
>(r"^admin/", include("django.contrib.admin.urls")),
>(r"^pro/book/$", "blog.blogapp.views.bookentry"),
> )
>
> but when i am running in browser http://127.0.0.1:8000/admin its
> giving me error
> File "/usr/lib/python2.4/site-packages/django/core/servers/
> basehttp.py", line 277, in run
>self.result = application(self.environ, self.start_response)
>
>  File "/usr/lib/python2.4/site-packages/django/core/servers/
> basehttp.py", line 634, in __call__
>return self.application(environ, start_response)
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> wsgi.py", line 239, in __call__
>response = self.get_response(request)
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 67, in get_response
>response = middleware_method(request)
>
>  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
> line 72, in process_request
>urlresolvers.resolve("%s/" % request.path_info)
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 244, in resolve
>return get_resolver(urlconf).resolve(path)
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 180, in resolve
>sub_match = pattern.resolve(new_path)
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 178, in resolve
>for pattern in self.urlconf_module.urlpatterns:
>
>  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 197, in _get_urlconf_module
>self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
> ImportError: No module named urls
>
> and when i checked manually in that directory there were no urls.py
> file
> in usr/lib/python2.4/site-packages/django/contrib/admin/
>
> how may i resolve that problem. i followed each and every steps of
> Django book
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing dynamic templates

2008-11-25 Thread Julien Phalip

On Nov 25, 11:18 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Check out django.contrib.auth.tests.views.py.
>
> Is there some master index of documentation for "if you want to
> test X, see Y.py or http://Z for an example of how to do it"?
> where X is any of a number of Django features such as models,
> views, templates, middleware, filters, template-tags, forms,
> database-configurations, custom field-types, etc?
>
> I've read through
>
> http://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs
>
> and there are some good specifics here (I'd expect that several
> of the "see http://Z"; links would point here).  However, it would
> be nice to have a "testing cookbook" that would attack the topic
> by "thing you want to test" (perhaps with both unittest and
> doctest examples).
>
> Most of my learning-to-test-my-Django-app has happened through
> trial and error, so any sort of "you want to test X, see Y" would
> be helpful.
>
> -tim

Russ, thanks again for the tip (combination of setUp trickery and
custom template loader). That would in fact be even better because it
means you don't rely on "os" and on the file system, which is good if
you're dealing with AppEngine I suppose.

Tim, I couldn't agree more. There is a big lack of practical examples
in the documentation. Most of what I learned was from django's test
suite itself or from popular third party apps. Eric Holscher recently
started a discussion on his blog [1] about this, and I tried to reply
to it in my blog [2]. Let's keep the discussion going (I mean, not
necessarily in this thread, but on blogs and forums maybe)!
It'd be great to improve the doc. It would open the doors of testing
to the community and everyone would eventually benefit from it!

Russ and Malcolm (if you're still here :) ), I'd love to hear your
view on this, as I know testing is very important in your eyes.

Regards,

Julien

[1] http://ericholscher.com/blog/2008/nov/13/stubbing-out-tests-django/
[2] 
http://www.julienphalip.com/blog/2008/11/15/misconceptions-about-testing-and-what-we-should-do/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Testing dynamic templates

2008-11-25 Thread Tim Chase

> Check out django.contrib.auth.tests.views.py.

Is there some master index of documentation for "if you want to 
test X, see Y.py or http://Z for an example of how to do it"? 
where X is any of a number of Django features such as models, 
views, templates, middleware, filters, template-tags, forms, 
database-configurations, custom field-types, etc?

I've read through

http://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs

and there are some good specifics here (I'd expect that several 
of the "see http://Z"; links would point here).  However, it would 
be nice to have a "testing cookbook" that would attack the topic 
by "thing you want to test" (perhaps with both unittest and 
doctest examples).

Most of my learning-to-test-my-Django-app has happened through 
trial and error, so any sort of "you want to test X, see Y" would 
be helpful.

-tim






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



Re: Best IDE for Django and python?

2008-11-25 Thread Nikolay Panov

I'm using just gvim + some plugins (help.vim, autocomplpop.vim,
snippetsEmu.vim, ...). As for me, this is quite enough.

Have a nice day,
   Nikolay.



On Tue, Nov 25, 2008 at 11:27, DragonSlayre <[EMAIL PROTECTED]> wrote:
>
> Hey, I'm getting started with a friend in developing a site with
> Django, and we're both new to this, so I am wondering what people use
> to manage all their files, and for looking at documentation etc.
>
> Having come from a Java background, I'm used to great documentation,
> and suspect that Java is very much the leader in doc, and not the
> standard.
>
> I've used the pydev plugin for eclipse, but it seems extremely
> limited.
>
> How do you develop your django projects, and where do you go when you
> need to find documentation?
> >
>

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



Admin form

2008-11-25 Thread Praveen

Hi All, i am very new bie of Django, i have started work on before 3
days.
I am following DJango book. I am playing with 6 chapter "Using the
admin interface"
In my urls.py file i set the url for admin

from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^blog/', include('blog.foo.urls')),
(r"^admin/", include("django.contrib.admin.urls")),
(r"^pro/book/$", "blog.blogapp.views.bookentry"),
)

but when i am running in browser http://127.0.0.1:8000/admin its
giving me error
File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 277, in run
self.result = application(self.environ, self.start_response)

  File "/usr/lib/python2.4/site-packages/django/core/servers/
basehttp.py", line 634, in __call__
return self.application(environ, start_response)

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

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 67, in get_response
response = middleware_method(request)

  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
line 72, in process_request
urlresolvers.resolve("%s/" % request.path_info)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 244, in resolve
return get_resolver(urlconf).resolve(path)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 180, in resolve
sub_match = pattern.resolve(new_path)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 178, in resolve
for pattern in self.urlconf_module.urlpatterns:

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 197, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])

ImportError: No module named urls

and when i checked manually in that directory there were no urls.py
file
in usr/lib/python2.4/site-packages/django/contrib/admin/

how may i resolve that problem. i followed each and every steps of
Django book

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >