Re: migration problem from Django0.96 to Django1.0
I solved that problem. On Mon, Sep 15, 2008 at 11:09 AM, vijay bhaskar <[EMAIL PROTECTED]> wrote: > > > On Mon, Sep 15, 2008 at 11:07 AM, vijay bhaskar <[EMAIL PROTECTED]> wrote: > >> Hi karen,Thanks for your reply.but the problem is ,there is no definition >> for WEEKDAYS_ABBR in the django.utils.dates.That's the reason its >> throwing error.How can i get rid of this? >> >> Thanks & regards >> Vijay >> >> >> On Sat, Sep 13, 2008 at 5:39 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: >> >>> On Sat, Sep 13, 2008 at 5:28 AM, vijay <[EMAIL PROTECTED]> wrote: >>> When i'am trying to migrate my application which is wriiten in 0.96 version to 1.0, i encountered the following error message. File "c:\python25\lib\site-packages\django\utils\dateformat.py", line 127, in D return WEEKDAYS_ABBR[self.data.weekday()] NameError: global name 'WEEKDAYS_ABBR' is not defined Is there any patch available for this? How can i get rid of this problem? >>> Have you modified that file django\utils\dateformat.py? The one shipped >>> with 1.0 does not have the problem you are seeing since it imports >>> WEEKDAYS_ABBR from where it is defined before using it, see line 14 in: >>> >>> >>> http://code.djangoproject.com/browser/django/tags/releases/1.0/django/utils/dateformat.py >>> >>> (Also the line number reported in your error message does not match what >>> is on that line the shipped version of the file, so something seems to have >>> happened to alter your 1.0 Django files, or at least this one.) >>> >>> Karen >>> >>> >>> >>> >>> >> > --~--~-~--~~~---~--~~ 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: migration problem from Django0.96 to Django1.0
Hi karen,Thanks for your reply.but the problem is ,there is no definition for WEEK_ABBR in the django.utils.dates.That's the reason its throwing error.How can i get rid of this? Thanks & regards Vijay On Sat, Sep 13, 2008 at 5:39 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: > On Sat, Sep 13, 2008 at 5:28 AM, vijay <[EMAIL PROTECTED]> wrote: > >> >> When i'am trying to migrate my application which is wriiten in 0.96 >> version to 1.0, i encountered the following error message. >> >> File "c:\python25\lib\site-packages\django\utils\dateformat.py", >> line 127, in D >>return WEEKDAYS_ABBR[self.data.weekday()] >> NameError: global name 'WEEKDAYS_ABBR' is not defined >> >> >> Is there any patch available for this? How can i get rid of this >> problem? >> >> > Have you modified that file django\utils\dateformat.py? The one shipped > with 1.0 does not have the problem you are seeing since it imports > WEEKDAYS_ABBR from where it is defined before using it, see line 14 in: > > > http://code.djangoproject.com/browser/django/tags/releases/1.0/django/utils/dateformat.py > > (Also the line number reported in your error message does not match what is > on that line the shipped version of the file, so something seems to have > happened to alter your 1.0 Django files, or at least this one.) > > Karen > > > > > --~--~-~--~~~---~--~~ 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: Persistent Global Imports
On Sep 15, 1:50 pm, "Chris Spencer" <[EMAIL PROTECTED]> wrote: > One minor question. I'd like to test multiple mod_wsgi Django apps > locally, each accessed like localhost/app*. Can I simply use the above > directives for each app in httpd.conf without using a VirtualHost for > each app? Not quite. You need to move the WSGIProcessGroup directive inside of the Directory container for the specific application. WSGIDaemonProcess myapp processes=1 threads=25 Alias /myapp/static /usr/local/django/myapp/static/ Order deny,allow Allow from all WSGIScriptAlias /myapp /usr/local/django/myapp/apache/django.wsgi WSGIProcessGroup myapp Order deny,allow Allow from all Do that and you can then duplicate it for any number of applications. Graham > Chris > > On Sun, Sep 14, 2008 at 11:43 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: > > Nevermind. I just found your post on this issue at > >http://code.google.com/p/modwsgi/wiki/ConfigurationIssues > > > On Sun, Sep 14, 2008 at 11:32 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: > >> Ok, so this is what I put at the bottom of my httpd.conf: > > >> WSGIDaemonProcess myapp processes=1 threads=25 > >> WSGIProcessGroup myapp > >> Alias /myapp/static /usr/local/django/myapp/static/ > >> > >> Order deny,allow > >> Allow from all > >> > >> WSGIScriptAlias /myapp /usr/local/django/myapp/apache/django.wsgi > >> > >> Order deny,allow > >> Allow from all > >> > > >> Everything in /myapp/static/* loads fine. However, all other requests > >> that got to django.wsgi generate this error to my Apache log: > > >> [Sun Sep 14 23:26:09 2008] [error] [client 127.0.0.1] (13)Permission > >> denied: mod_wsgi (pid=344): Unable to connect to WSGI daemon process > >> 'myapp' on '/etc/httpd/logs/wsgi.28572.2.1.sock' after multiple > >> attempts. > > >> Any thoughts? The above is what the docs use as the standard recipe > >> for running Django with mod_wsgi. Am I missing anything? > > >> Regards, > >> Chris > > >> On Thu, Sep 11, 2008 at 9:06 PM, Graham Dumpleton > >> <[EMAIL PROTECTED]> wrote: > > >>> On Sep 12, 10:35 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote: > On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton > > <[EMAIL PROTECTED]> wrote: > > Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be > > multiprocess. Thus where you think it is being loaded on every > > request, it is more likely just the result of the various processes > > loading the application the first time it is used. After they are all > > loaded, you shouldn't see loading occurring. > > > Anyway this is it in simple terms, as it is actually more complicated > > than that as Apache can kill off processes and replace them in certain > > situations. > > > For some details of how processes are used in Apache/mod_wsgi see: > > > http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading > > > To know what is definitively what is going on, following instructions > > in: > > > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques > > > and set: > > > LogLevel info > > > in Apache configuration, in place of default 'warn'. This should > > result in mod_wsgi outputing a lot of information into main and per > > virtual host, as appropriate, error logs about when processes are > > being started/restarted and when WSGI application scripts being > > loaded. > > > So do that and report on what you see, including examples of Apache > > error logs which you believe shows the behaviour you are claiming. > > I set LogLevel, and after each request, the only thing I'm seeing in > the log is something like: > [Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create > interpreter 'localhost.localdomain|/myapp'. > [Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi > (pid=18858, process='', application='localhost.localdomain|/myapp'): > Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'., > referer:http://localhost/myapp > > Is there any way to force a specific WSGI app to run on a single > process, without changing the number of processes used otherwise on > the server? I've toyed around with WSGIDaemonProcess, but all this > seems to do is break the debugger without fixing the problem. Would I > use something like: > > WSGIDaemonProcess myapp processes=1 threads=1 > > >>> Which debugger? Any specific reason you are using a single thread, > >>> such as using older Django version or your application is not > >>> multithread? > > >>> Anyway, the in web browser debuggers I know of will only work if one > >>> process, but 'processes=1' still marks it as multiprocess in WSGI > >>> environment. Just drop 'processes=1' and let if use default of 1 > >>> process. If you don't do that the debugger may complain it is not > >>> running in valid environment. Thus: > >
Re: Running into errors using S3 backend for Django
On Sep 15, 2008, at 1:01 AM, vinay wrote: > File "/usr/lib/python2.5/site-packages/django/core/files/ > storage.py", line 81, in path >raise NotImplementedError("This backend doesn't support absolute > paths.") > NotImplementedError: This backend doesn't support absolute paths. Sounds like you just need to define that method for the S3 backend. It's falling back on the base method that spits out the exception. --- 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: using forloop variable to get the provide special tags for the 4th element.
On Sun, Sep 14, 2008 at 10:00 PM, sotirac <[EMAIL PROTECTED]> wrote: > > In the django template where I am using a for loop, I have to use a > special tag (div class="yui-u first" instead of div class="yui") for > every forth item. Im trying to create a table with three columns. I > can access the first loop but how do I do it for every third. > -- > > {% extends "base.html" %} > > {% block content %} >{% for website in websites %} >{% if forloop.first %} > >{% else %} > >{% endif %} >{{ website.title > }} h1> >{% for entry in website.entries_one_to_ten %} > > href="{{entry.url}}">{{ entry.title }} > >{% endfor %} >{% if website.entries_eleven_to_twenty %} > > >{% for entry in website.entries_eleven_to_twenty %} > > href="{{entry.url}}">{{ entry.title }} > >{% endfor %} > > >More/Less >{% endif %} > >{% endfor %} > {% endblock %} > Check the template tags. I think divisibleby might work for you. > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#divisibleby > --~--~-~--~~~---~--~~ 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 setup LDAP authorisation in django/apache.
-> Re: how to setup LDAP authorisation in django/apache. django-users <-- Thread --> <-- Date --> how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. madyogi Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Joseph Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Reply via email to how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. madyogi Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Joseph Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Reply via email to how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. madyogi Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Joseph Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Jashugan Reply via email to how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. madyogi Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Joseph Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Jashugan
how to setup LDAP authorisation in django/apache.
-> how to setup LDAP authorisation in django/apache. django-users <-- Thread --> <-- Date --> how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Graham Dumpleton Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. madyogi Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. Joseph Re: how to setup LDAP authorisation in django/apache. PeteDK Re: how to setup LDAP authorisation in django/apache. PeteDK Reply via email to
Running into errors using S3 backend for Django
I have been trying to test the S3 backend for Django. I am using the code drop from http://code.larlet.fr/doc/django-s3-storage.html for my default storage as per the instructions on the website. The storage tests (included in the instructions) went fine with my S3 account. I have been running into some problems trying to use S3 storage backend with photologue and I am trying to see if somebody (who know more about Django than I do) shed some light into the following error. Let me know if I need to include additional information. Thanks --- Request Method: GET Request URL:http://192.168.0.5:8000/admin/photologue/photo/ Exception Type: TemplateSyntaxError Exception Value: Caught an exception while rendering: This backend doesn't support absolute paths. Original Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/usr/lib/python2.5/site-packages/django/template/__init__.py", line 915, in render dict = func(*args) File "/usr/lib/python2.5/site-packages/django/contrib/admin/ templatetags/admin_list.py", line 242, in result_list 'results': list(results(cl))} File "/usr/lib/python2.5/site-packages/django/contrib/admin/ templatetags/admin_list.py", line 237, in results yield list(items_for_result(cl,res)) File "/usr/lib/python2.5/site-packages/django/contrib/admin/ templatetags/admin_list.py", line 161, in items_for_result value = attr() File "/usr/lib/python2.5/site-packages/photologue/models.py", line 276, in admin_thumbnail (self.get_absolute_url(), func()) File "/usr/lib/python2.5/site-packages/django/utils/functional.py", line 55, in _curried return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs)) File "/usr/lib/python2.5/site-packages/photologue/models.py", line 308, in _get_SIZE_url if not self.size_exists(photosize): File "/usr/lib/python2.5/site-packages/photologue/models.py", line 337, in size_exists if os.path.isfile(func()): File "/usr/lib/python2.5/site-packages/django/utils/functional.py", line 55, in _curried return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs)) File "/usr/lib/python2.5/site-packages/photologue/models.py", line 316, in _get_SIZE_filename return os.path.join(self.cache_path(), File "/usr/lib/python2.5/site-packages/photologue/models.py", line 284, in cache_path return os.path.join(os.path.dirname(self.image.path), "cache") File "/usr/lib/python2.5/site-packages/django/db/models/fields/ files.py", line 49, in _get_path return self.storage.path(self.name) File "/usr/lib/python2.5/site-packages/django/core/files/ storage.py", line 81, in path raise NotImplementedError("This backend doesn't support absolute paths.") NotImplementedError: This backend doesn't support absolute paths. Exception Location: /usr/lib/python2.5/site-packages/django/template/ debug.py in render_node, line 81 Python Executable: /usr/bin/python Python Version: 2.5.2 Python Path:['/home/vinay/projects/photoalbum', '/usr/lib/python2.5/ site-packages/geopy-0.93-py2.5.egg', '/usr/lib/python2.5/site-packages/ geopy-0.93-py2.5.egg', '/usr/lib/python2.5/site-packages/geopy-0.93- py2.5.egg', '/home/vinay/projects/photoalbum/utils', '/usr/lib/ python2.5/site-packages', '/home/vinay/projects/photoalbum', '/home/ vinay/projects', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/ lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/ python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/ usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site- packages/PIL', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/ python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0'] Server time:Sun, 14 Sep 2008 21:47:35 -0700 Template error In template /usr/lib/python2.5/site-packages/django/contrib/admin/ templates/admin/change_list.html, error at line 34 Caught an exception while rendering: This backend doesn't support absolute paths. 24 {% if cl.has_filters %} 25 26 {% trans 'Filter' %} 27 {% for spec in cl.filter_specs %} 28 {% admin_list_filter cl spec %} 29 {% endfor %} 30 31 {% endif %} 32 {% endblock %} 33 34 {% block result_list %}{% result_list cl %}{% endblock %} 35 {% block pagination %}{% pagination cl %}{% endblock %} 36 37 38 {% endblock %} 39 --~--~-~--~~~---~--~~ 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
using forloop variable to get the provide special tags for the 4th element.
In the django template where I am using a for loop, I have to use a special tag (div class="yui-u first" instead of div class="yui") for every forth item. Im trying to create a table with three columns. I can access the first loop but how do I do it for every third. -- {% extends "base.html" %} {% block content %} {% for website in websites %} {% if forloop.first %} {% else %} {% endif %} {{ website.title }} {% for entry in website.entries_one_to_ten %} {{ entry.title }} {% endfor %} {% if website.entries_eleven_to_twenty %} {% for entry in website.entries_eleven_to_twenty %} {{ entry.title }} {% endfor %} More/Less {% endif %} {% endfor %} {% endblock %} --~--~-~--~~~---~--~~ 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: Persistent Global Imports
One minor question. I'd like to test multiple mod_wsgi Django apps locally, each accessed like localhost/app*. Can I simply use the above directives for each app in httpd.conf without using a VirtualHost for each app? Chris On Sun, Sep 14, 2008 at 11:43 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: > Nevermind. I just found your post on this issue at > http://code.google.com/p/modwsgi/wiki/ConfigurationIssues > > On Sun, Sep 14, 2008 at 11:32 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: >> Ok, so this is what I put at the bottom of my httpd.conf: >> >> WSGIDaemonProcess myapp processes=1 threads=25 >> WSGIProcessGroup myapp >> Alias /myapp/static /usr/local/django/myapp/static/ >> >>Order deny,allow >>Allow from all >> >> WSGIScriptAlias /myapp /usr/local/django/myapp/apache/django.wsgi >> >>Order deny,allow >>Allow from all >> >> >> Everything in /myapp/static/* loads fine. However, all other requests >> that got to django.wsgi generate this error to my Apache log: >> >> [Sun Sep 14 23:26:09 2008] [error] [client 127.0.0.1] (13)Permission >> denied: mod_wsgi (pid=344): Unable to connect to WSGI daemon process >> 'myapp' on '/etc/httpd/logs/wsgi.28572.2.1.sock' after multiple >> attempts. >> >> Any thoughts? The above is what the docs use as the standard recipe >> for running Django with mod_wsgi. Am I missing anything? >> >> Regards, >> Chris >> >> On Thu, Sep 11, 2008 at 9:06 PM, Graham Dumpleton >> <[EMAIL PROTECTED]> wrote: >>> >>> >>> >>> On Sep 12, 10:35 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote: On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be > multiprocess. Thus where you think it is being loaded on every > request, it is more likely just the result of the various processes > loading the application the first time it is used. After they are all > loaded, you shouldn't see loading occurring. > Anyway this is it in simple terms, as it is actually more complicated > than that as Apache can kill off processes and replace them in certain > situations. > For some details of how processes are used in Apache/mod_wsgi see: > http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading > To know what is definitively what is going on, following instructions > in: > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques > and set: > LogLevel info > in Apache configuration, in place of default 'warn'. This should > result in mod_wsgi outputing a lot of information into main and per > virtual host, as appropriate, error logs about when processes are > being started/restarted and when WSGI application scripts being > loaded. > So do that and report on what you see, including examples of Apache > error logs which you believe shows the behaviour you are claiming. I set LogLevel, and after each request, the only thing I'm seeing in the log is something like: [Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create interpreter 'localhost.localdomain|/myapp'. [Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi (pid=18858, process='', application='localhost.localdomain|/myapp'): Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'., referer:http://localhost/myapp Is there any way to force a specific WSGI app to run on a single process, without changing the number of processes used otherwise on the server? I've toyed around with WSGIDaemonProcess, but all this seems to do is break the debugger without fixing the problem. Would I use something like: WSGIDaemonProcess myapp processes=1 threads=1 >>> >>> Which debugger? Any specific reason you are using a single thread, >>> such as using older Django version or your application is not >>> multithread? >>> >>> Anyway, the in web browser debuggers I know of will only work if one >>> process, but 'processes=1' still marks it as multiprocess in WSGI >>> environment. Just drop 'processes=1' and let if use default of 1 >>> process. If you don't do that the debugger may complain it is not >>> running in valid environment. Thus: >>> >>> WSGIDaemonProcess myapp thread=1 >>> WSGIProcessGroup myapp >>> >>> For more information on web browser debuggers and debugging in general >>> see: >>> >>> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques >>> >>> Also see comments about WSGI multiprocess/multithread flags in: >>> >>> http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading >>> >>> For configuration of WSGIDaemonProcess see examples in: >>> >>> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide >>> http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines >>> http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives >>> >>>
Re: Persistent Global Imports
Nevermind. I just found your post on this issue at http://code.google.com/p/modwsgi/wiki/ConfigurationIssues On Sun, Sep 14, 2008 at 11:32 PM, Chris Spencer <[EMAIL PROTECTED]> wrote: > Ok, so this is what I put at the bottom of my httpd.conf: > > WSGIDaemonProcess myapp processes=1 threads=25 > WSGIProcessGroup myapp > Alias /myapp/static /usr/local/django/myapp/static/ > >Order deny,allow >Allow from all > > WSGIScriptAlias /myapp /usr/local/django/myapp/apache/django.wsgi > >Order deny,allow >Allow from all > > > Everything in /myapp/static/* loads fine. However, all other requests > that got to django.wsgi generate this error to my Apache log: > > [Sun Sep 14 23:26:09 2008] [error] [client 127.0.0.1] (13)Permission > denied: mod_wsgi (pid=344): Unable to connect to WSGI daemon process > 'myapp' on '/etc/httpd/logs/wsgi.28572.2.1.sock' after multiple > attempts. > > Any thoughts? The above is what the docs use as the standard recipe > for running Django with mod_wsgi. Am I missing anything? > > Regards, > Chris > > On Thu, Sep 11, 2008 at 9:06 PM, Graham Dumpleton > <[EMAIL PROTECTED]> wrote: >> >> >> >> On Sep 12, 10:35 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote: >>> On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton >>> >>> >>> >>> <[EMAIL PROTECTED]> wrote: >>> > Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be >>> > multiprocess. Thus where you think it is being loaded on every >>> > request, it is more likely just the result of the various processes >>> > loading the application the first time it is used. After they are all >>> > loaded, you shouldn't see loading occurring. >>> >>> > Anyway this is it in simple terms, as it is actually more complicated >>> > than that as Apache can kill off processes and replace them in certain >>> > situations. >>> >>> > For some details of how processes are used in Apache/mod_wsgi see: >>> >>> > http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading >>> >>> > To know what is definitively what is going on, following instructions >>> > in: >>> >>> > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques >>> >>> > and set: >>> >>> > LogLevel info >>> >>> > in Apache configuration, in place of default 'warn'. This should >>> > result in mod_wsgi outputing a lot of information into main and per >>> > virtual host, as appropriate, error logs about when processes are >>> > being started/restarted and when WSGI application scripts being >>> > loaded. >>> >>> > So do that and report on what you see, including examples of Apache >>> > error logs which you believe shows the behaviour you are claiming. >>> >>> I set LogLevel, and after each request, the only thing I'm seeing in >>> the log is something like: >>> [Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create >>> interpreter 'localhost.localdomain|/myapp'. >>> [Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi >>> (pid=18858, process='', application='localhost.localdomain|/myapp'): >>> Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'., >>> referer:http://localhost/myapp >>> >>> Is there any way to force a specific WSGI app to run on a single >>> process, without changing the number of processes used otherwise on >>> the server? I've toyed around with WSGIDaemonProcess, but all this >>> seems to do is break the debugger without fixing the problem. Would I >>> use something like: >>> >>> WSGIDaemonProcess myapp processes=1 threads=1 >> >> Which debugger? Any specific reason you are using a single thread, >> such as using older Django version or your application is not >> multithread? >> >> Anyway, the in web browser debuggers I know of will only work if one >> process, but 'processes=1' still marks it as multiprocess in WSGI >> environment. Just drop 'processes=1' and let if use default of 1 >> process. If you don't do that the debugger may complain it is not >> running in valid environment. Thus: >> >> WSGIDaemonProcess myapp thread=1 >> WSGIProcessGroup myapp >> >> For more information on web browser debuggers and debugging in general >> see: >> >> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques >> >> Also see comments about WSGI multiprocess/multithread flags in: >> >> http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading >> >> For configuration of WSGIDaemonProcess see examples in: >> >> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide >> http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines >> http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives >> >> Sorry, but have to run somewhere. Will check later than I actually >> answered your question. I may not have. ;-) >> >> Graham >> >>> How does that directive differentiate between multiple WSGI apps >>> running on the same server? The docs mention that it specifies a >>> "process group", but how do you make a single WSGI Django app run in >>> that process group? >>> >>> > Also, you should still post the configuration you use
Re: Persistent Global Imports
Ok, so this is what I put at the bottom of my httpd.conf: WSGIDaemonProcess myapp processes=1 threads=25 WSGIProcessGroup myapp Alias /myapp/static /usr/local/django/myapp/static/ Order deny,allow Allow from all WSGIScriptAlias /myapp /usr/local/django/myapp/apache/django.wsgi Order deny,allow Allow from all Everything in /myapp/static/* loads fine. However, all other requests that got to django.wsgi generate this error to my Apache log: [Sun Sep 14 23:26:09 2008] [error] [client 127.0.0.1] (13)Permission denied: mod_wsgi (pid=344): Unable to connect to WSGI daemon process 'myapp' on '/etc/httpd/logs/wsgi.28572.2.1.sock' after multiple attempts. Any thoughts? The above is what the docs use as the standard recipe for running Django with mod_wsgi. Am I missing anything? Regards, Chris On Thu, Sep 11, 2008 at 9:06 PM, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > > On Sep 12, 10:35 am, "Chris Spencer" <[EMAIL PROTECTED]> wrote: >> On Thu, Sep 11, 2008 at 6:16 AM, Graham Dumpleton >> >> >> >> <[EMAIL PROTECTED]> wrote: >> > Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be >> > multiprocess. Thus where you think it is being loaded on every >> > request, it is more likely just the result of the various processes >> > loading the application the first time it is used. After they are all >> > loaded, you shouldn't see loading occurring. >> >> > Anyway this is it in simple terms, as it is actually more complicated >> > than that as Apache can kill off processes and replace them in certain >> > situations. >> >> > For some details of how processes are used in Apache/mod_wsgi see: >> >> > http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading >> >> > To know what is definitively what is going on, following instructions >> > in: >> >> > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques >> >> > and set: >> >> > LogLevel info >> >> > in Apache configuration, in place of default 'warn'. This should >> > result in mod_wsgi outputing a lot of information into main and per >> > virtual host, as appropriate, error logs about when processes are >> > being started/restarted and when WSGI application scripts being >> > loaded. >> >> > So do that and report on what you see, including examples of Apache >> > error logs which you believe shows the behaviour you are claiming. >> >> I set LogLevel, and after each request, the only thing I'm seeing in >> the log is something like: >> [Thu Sep 11 20:17:37 2008] [info] mod_wsgi (pid=18858): Create >> interpreter 'localhost.localdomain|/myapp'. >> [Thu Sep 11 20:17:37 2008] [info] [client 127.0.0.1] mod_wsgi >> (pid=18858, process='', application='localhost.localdomain|/myapp'): >> Loading WSGI script '/usr/local/django/myapp/apache/django.wsgi'., >> referer:http://localhost/myapp >> >> Is there any way to force a specific WSGI app to run on a single >> process, without changing the number of processes used otherwise on >> the server? I've toyed around with WSGIDaemonProcess, but all this >> seems to do is break the debugger without fixing the problem. Would I >> use something like: >> >> WSGIDaemonProcess myapp processes=1 threads=1 > > Which debugger? Any specific reason you are using a single thread, > such as using older Django version or your application is not > multithread? > > Anyway, the in web browser debuggers I know of will only work if one > process, but 'processes=1' still marks it as multiprocess in WSGI > environment. Just drop 'processes=1' and let if use default of 1 > process. If you don't do that the debugger may complain it is not > running in valid environment. Thus: > > WSGIDaemonProcess myapp thread=1 > WSGIProcessGroup myapp > > For more information on web browser debuggers and debugging in general > see: > > http://code.google.com/p/modwsgi/wiki/DebuggingTechniques > > Also see comments about WSGI multiprocess/multithread flags in: > > http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading > > For configuration of WSGIDaemonProcess see examples in: > > http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide > http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines > http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives > > Sorry, but have to run somewhere. Will check later than I actually > answered your question. I may not have. ;-) > > Graham > >> How does that directive differentiate between multiple WSGI apps >> running on the same server? The docs mention that it specifies a >> "process group", but how do you make a single WSGI Django app run in >> that process group? >> >> > Also, you should still post the configuration you use so we can >> > confirm it is correct. I have many times had people say they followed >> > the documentation, but in fact they had tweaked it slightly and >> > inadvertently caused problems for themselves. >> >> What I posted is my exact configuration. It's a simple minimal case >> app for testing this problem. >> >> Regards, >>
Re: ***SPAM*** A trick to force autoreloading, in case of changes in views.py
Are we still on this!?!? There are SPAM filters (like Spam Assassin) that automatically add this in the subject if it this an email is SPAM. Relax! On Sep 14, 9:19 pm, n00m <[EMAIL PROTECTED]> wrote: > Next time you open your own thread > let me know: > I'll mark it as ***SPAM*** > and we'll see how tolerant *you* are. > > On Sep 15, 1:47 am, Martin Diers <[EMAIL PROTECTED]> wrote: > > > Chill out. It's a personal website - no product being sold or > > advertised. > > > If this group were moderated, you would no doubt be bounced for that > > comment. If you treat others here with such disdain, do not expect to > > be treated any better. --~--~-~--~~~---~--~~ 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: working with yaml fixtures
On Mon, Sep 15, 2008 at 10:27 AM, sotirac <[EMAIL PROTECTED]> wrote: > > I'm trying to initialize my database using yaml fixtures. > I've created a yaml fixtures directory (src/fixtures). Within the > yaml fixtures directory, I created a yaml fixtures file title > websites.yaml. ... > Now when I try to invoke the command "python > manage.py loaddata fixtures/websites" inside my src directory, it > gives me no error message but nothing is added into my sqlite > database. You say you didn't get an error message, but did you get a message saying "X objects loaded from Y fixtures"? If you didn't see this message, then the fixtures have not been loaded. The next thing to check is where you have put the fixtures. You say you put the fixtures in a src/fixtures directory - did you add this directory in the FIXTURE_DIRS setting? By default, Django will only look for a fixtures directory in each installed applicaiton (e.g., if you have polls/models.py, Django will look in polls/fixtures/* for fixtures). If you want to use another directory, you will need to register that directory using the FIXTURE_DIRS setting. Lastly, you only need to specify the fixture name when loading the fixture (i.e., "websites" or "websites.yaml") - you don't need to provide a full path for the fixture. Django will fill in the rest of the path name as it searches the known locations for fixtures. 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 -~--~~~~--~~--~--~---
working with yaml fixtures
I'm trying to initialize my database using yaml fixtures. I've created a yaml fixtures directory (src/fixtures). Within the yaml fixtures directory, I created a yaml fixtures file title websites.yaml. I first had error saying that: neptune:$ python manage.py loaddata fixtures/websites.yml Problem installing fixture 'fixtures/websites': yml is not a known serialization format. I think the solution to that problem was to install pyyaml package. I have done that. Now when I try to invoke the command "python manage.py loaddata fixtures/websites" inside my src directory, it gives me no error message but nothing is added into my sqlite database. --- sample of my yaml file -- - model: src.website fields: title: Our Awesome Planet url: http://www.ourawesomeplanet.com feed: http://feeds.feedburner.com/ourawesomeplanet - model: src.website fields: title: The Unlawyer url: http://www.unlawyer.net feed: http://www.unlawyer.net/?feed=rss --~--~-~--~~~---~--~~ 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: ***SPAM*** A trick to force autoreloading, in case of changes in views.py
Next time you open your own thread let me know: I'll mark it as ***SPAM*** and we'll see how tolerant *you* are. On Sep 15, 1:47 am, Martin Diers <[EMAIL PROTECTED]> wrote: > Chill out. It's a personal website - no product being sold or > advertised. > > If this group were moderated, you would no doubt be bounced for that > comment. If you treat others here with such disdain, do not expect to > be treated any better. --~--~-~--~~~---~--~~ 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 inlines and foreign keys
On Sun, Sep 14, 2008 at 4:26 PM, Donn <[EMAIL PROTECTED]> wrote: > > > That should happen automatically - you shouldn't see the foreign key > > to the parent model. Can you post your model and admin code on > > dpaste.com so we can work out what's wrong? > Thanks, I'm sure it's something dumb I'm doing. Here: > http://dpaste.com/78053/ > > So you've got: class Website( models.Model ): client = models.ForeignKey( Client ) class PluginsEnabled( models.Model ): client = models.ForeignKey( Client ) website = models.ForeignKey( Website ) and you do not want the 'client' field of PluginsEnabled to appear when edited inline for a Website because it should always be the same as Website's 'client' field? If so, then why is the information duplicated in the PluginsEnabled model? If those two values should always be the same, then it's much better practice to have just one copy. Instead of having 'client' in PluginsEnabled, you can get the value through the 'website' foreign key. Karen --~--~-~--~~~---~--~~ 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 Inline does not want to edit
I think this is the same error I'm seeing in http://code.djangoproject.com/ticket/9076. It involves getting duplicate pks from the form. I've used the below workaround in the meantime. Index: django/forms/models.py === --- django/forms/models.py (revision 8961) +++ django/forms/models.py (working copy) @@ -336,7 +336,7 @@ def _construct_form(self, i, **kwargs): if i < self._initial_form_count: -kwargs['instance'] = self.get_queryset()[i] +kwargs['instance'] = list(self.get_queryset())[i] return super(BaseModelFormSet, self)._construct_form(i, **kwargs) def get_queryset(self): On Sep 14, 9:26 am, Marek Kubica <[EMAIL PROTECTED]> wrote: > Hi, > > I fought against this for the whole day already (with patching Django; > creating Form and FormSet subclasses etc.) but nothing helped. I want to > have a Message with multiple translations in my database and the admin > should display the message and the translations inline. > > Now the problem is, that the following works and sometimes saving in the > admin fails with "Please correct the errors below." and no errors below > that. When I patched the template to show {{ errors }} I also get this: > > Translation with this None already exists. > > When I take a look on the errors of the translation formset I get this: > > [{'id': [u'Translation with this None already exists.']}, {}] > > The only solution this far was creating a new message, copying stuff over > and deleting the old one. > > I'm running the current Django trunk, but this has been broken for quite > some time. > > The relevant files look like this: > > admin.py > > from sys import maxint > from django.contrib import admin > from pointtec.transdigest import models > > class TranslationInline(admin.TabularInline): > model = models.Translation > > class MessageAdmin(admin.ModelAdmin): > ordering = ('text',) > list_per_page = maxint > search_fields = ('text',) > inlines = [TranslationInline] > > admin.site.register(models.Message, MessageAdmin) > > models.py: > > from django.db import models > from django.conf import settings > from django.utils.translation import get_language, gettext_lazy as _ > > languages_available = settings.LANGUAGES > > class Message(models.Model): > """A message which is to translate""" > text = models.TextField(_('original message'), unique=True) > > def __unicode__(self): > """A nice representation for the user""" > return self.text > > def save(self, *args, **kwargs): > self.text = self.text.strip() > super(Message, self).save(*args, **kwargs) > > class Translation(models.Model): > """Translation""" > message = models.ForeignKey(Message) > language = models.CharField(_('language'), max_length=5, > choices=settings.LANGUAGES) > translation = models.TextField(_('translation')) > > def save(self, *args, **kwargs): > self.translation = self.translation.strip() > super(Translation, self).save(*args, **kwargs) > > def __unicode__(self): > return u"%s: %s" % (self.language, self.translation) > > It would be really nice if someone could show me what I'm doing wrong. > > regards, > Marek --~--~-~--~~~---~--~~ 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: The User mess
I second this suggestion. I've struggled to decide whether to extend auth.User with a profile class with a reference to auth.User as recommended in the docs or by defining a superclass of auth.User. Each method has its pros and cons, but neither method is completely satisfactory. Rodney On Sep 12, 3:58 am, Dan Ellis <[EMAIL PROTECTED]> wrote: > First of all, congratulations to the team on reaching 1.0. It looks > like a lot of good features landed in time. > > One thing that I still find messy, though, is the whole user/profile > thing. Having separate models for users and profiles has a number of > drawbacks: > > * extra DB hits > * having to traverse either the user attribute or the result of the > get_profile method > * by default, the user information is split across two models in the > admin interface > * the user, the profile, or both might need to be saved depending on > which information was edited > * uncertainty over whether other models should have user or profile > as FK > * uncertainty over whether friendship relationship should be on user > or profile > > Some people have suggested that the qsrf inheritance be used to create > a model derived from User, and a custom authentication backend written > that creates and returns instances of the appropriate model. I'm > fairly "meh" on that idea (and ORM-based inheritance in general, but > that's another story), and it doesn't seem to be a solution supported > by the official documentation. > > What I'd like to see is an easy, supported way of specifying the name > of the user model in the settings file, thereby avoiding all of the > above complexity. There are a few places where hard-coded references > to django.contrib.auth.models.User would need to be replaced, but I > can think of a couple of ways of doing that, including backwards- > compatible ones. Can anyone think of any reasons why this would be a > bad idea? I'd certainly be willing to provide a suitable patch. --~--~-~--~~~---~--~~ 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: uses_case_insensitive_names = True
On Sep 14, 2008, at 4:22 PM, sal wrote: > > Have looked extensively but cannot find a solution :( > > While trying to follow tutorial in a django book, I get the following > error when running manage.py a second time: > > _mysql_exceptions.OperationalError: (1050, "Table 'people_person' > already exists > ") > > I am running a development server on Windows with Mysql 5, Python25, > django, MySQL-python.exe-1.2.1_p2.win32-py2.5.exe > > I have added 'uses_case_insensitive_names = True' inside: > C:\Python25\Lib\site-packages\django\db\backends\__init__.py > > The error is fixed if i change the case of the models name to match > the database table in models.py but I think this is the correct > solution. > > Would appreciate any advice, thanks. What you are doing is most certainly not the correct solution, because you are changing the DB backend, telling it to treat MySQL as case- insensitive. This is wrong. MySQL table names are case sensitive when MySQL is running on case-sensitive filesystems such as Unix/Linux/some OSX. What you changed is a core Django variable, not an end-user setting. It is there because the back-end is written to deal with MySQL in a case-sensitive manner, which will also work on a case-insensitive filesystems. The correct solution is what you did: match case, because that is what the MySQL backend requires. --~--~-~--~~~---~--~~ 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: Strange URL behavoir/problem
No, thats why its wierd, it just says; Page not found (404) Request Method: GET Request URL:http://www.url.net/2008/aug/ no other information at all, thts why its really strange. Andrew --~--~-~--~~~---~--~~ 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 get the list of logged in users?
-> Re: How to get the list of logged in users? django-users <-- Thread --> <-- Date --> How to get the list of logged in users? tamonash Re: How to get the list of logged in users? Rene Jochum Reply via email to How to get the list of logged in users? tamonash Re: How to get the list of logged in users? Rene Jochum Reply via email to How to get the list of logged in users? tamonash Re: How to get the list of logged in users? Rene Jochum Re: How to get the list of logged in users? tamonash Reply via email to
Re: Strange URL behavoir/problem
On Sep 14, 2008, at 5:16 PM, djandrow wrote: > > I have the folling urls: > > (r'^(?P\d{4})/$', > 'django.views.generic.date_based.archive_year', archive_info), > (r'^(?P\d{4})/(?P[a-z]{3})/$', > 'django.views.generic.date_based.archive_month', archive_info), > > and archive_info is: > > archive_info = { > 'queryset' : Entry.objects.all(), > 'date_field' : 'entry_date', > 'template_name' : 'blog/archive.html', > } > > The problem i am having is when i enter; > > myurl.net/2008/aug/ > > i get a 404 error, but not the one saying it doesn't match any url > patters, theres two strange things about this, > > 1. if i do /2008/ without the month it works, fine every time, > 2. about once in every 20 times it will work with myurl.net/2008/aug/ > > this to me seems very strange, that it work once every so often, and > practically the same url /2008/ seems to work fine, even though the > majority of information is the same. > > Does anyone have any possible ideas on theories on this, thanks > > Andrew Could you post the actual 404 error somehow? Does i give any clue, like, for instance, something saying "Entry matching query was not found"? --~--~-~--~~~---~--~~ 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: ***SPAM*** A trick to force autoreloading, in case of changes in views.py
On Sep 14, 2008, at 12:59 PM, n00m wrote: > > What is the http://www.thomas-guettler.de/? > > Remove from your sig this link to your f**king spam-like site. > > On Sep 12, 4:36 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: >> Thomas Guettler,http://www.thomas-guettler.de/ > Chill out. It's a personal website - no product being sold or advertised. If this group were moderated, you would no doubt be bounced for that comment. If you treat others here with such disdain, do not expect to be treated any better. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
foreign key passed as form field?
Apologies for the likely noob question as I'm just getting started with Django: I'd like users to be able to input a Book.id as a form field, with validation that the id exists. Here's what I have so far: class ShelfSaveForm(forms.Form): barcode = forms.IntegerField( label='enter ID', widget=forms.TextInput(attrs={'size': 20}) ) def clean_barcode(self): barcode = self.clean_data['barcode'] try: Book.objects.get(id=barcode) except ObjectDoesNotExist: raise forms.ValidationError('Book ID not found. Find book again.') return barcode @login_required def shelf_save_page(request): if request.method == 'POST': form = ShelfSaveForm(request.POST) if form.is_valid(): shelf = _shelf_save(request, form) else: form = ShelfSaveForm() variables = RequestContext(request, { 'form': form }) return render_to_response('shelf_page.html', variables) def _shelf_save(request, form): shelf, created = Shelf.objects.get_or_create( user=request.user, barcode=self.clean_data['barcode'] ) shelf.save() return shelf The validation works, but after tyring a bunch of things I can't pass the Book.id into the Shelf model as a ManytoMany. The idea is I'd like each user to be able to create a shelf of exisiting books in the database. I give them the id on each book page. Many thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Strange URL behavoir/problem
I have the folling urls: (r'^(?P\d{4})/$', 'django.views.generic.date_based.archive_year', archive_info), (r'^(?P\d{4})/(?P[a-z]{3})/$', 'django.views.generic.date_based.archive_month', archive_info), and archive_info is: archive_info = { 'queryset' : Entry.objects.all(), 'date_field' : 'entry_date', 'template_name' : 'blog/archive.html', } The problem i am having is when i enter; myurl.net/2008/aug/ i get a 404 error, but not the one saying it doesn't match any url patters, theres two strange things about this, 1. if i do /2008/ without the month it works, fine every time, 2. about once in every 20 times it will work with myurl.net/2008/aug/ this to me seems very strange, that it work once every so often, and practically the same url /2008/ seems to work fine, even though the majority of information is the same. Does anyone have any possible ideas on theories on this, thanks Andrew --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
uses_case_insensitive_names = True
Have looked extensively but cannot find a solution :( While trying to follow tutorial in a django book, I get the following error when running manage.py a second time: _mysql_exceptions.OperationalError: (1050, "Table 'people_person' already exists ") I am running a development server on Windows with Mysql 5, Python25, django, MySQL-python.exe-1.2.1_p2.win32-py2.5.exe I have added 'uses_case_insensitive_names = True' inside: C:\Python25\Lib\site-packages\django\db\backends\__init__.py The error is fixed if i change the case of the models name to match the database table in models.py but I think this is the correct solution. Would appreciate any advice, 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: Problems with signals accessing kwargs
Or: def mail_on_create_intro(sender, created=None, **kwargs): if created: email_body = 'A new intro at ' + instance.url email_subject = 'New intro' else: email_body = 'An intro has changed at ' + instance.url email_subject = 'Changed Intro' mail_managers(email_subject, email_body) On 15.09.2008, at 0:13, globophobe wrote: > > Try: > > if 'created' in kwargs: >if kwargs['created']: > # Send email > > --~--~-~--~~~---~--~~ 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: Problems with signals accessing kwargs
Try: if 'created' in kwargs: if kwargs['created']: # Send email --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problems with signals accessing kwargs
Hi, I have this code in myapp.intros.models to send a mail to the managers each time an intro gets saved: from django.db.models.signals import post_save from django.core.mail import mail_managers def mail_on_create_intro(sender, **kwargs): if created: email_body = 'A new intro at ' + instance.url email_subject = 'New intro' else: email_body = 'An intro has changed at ' + instance.url email_subject = 'Changed Intro' mail_managers(email_subject, email_body) post_save.connect(mail_on_create_intro, sender=Intro) This doesn't work, here's the last part of the traceback: File "/home/benni/kassette/../kassette/intros/models.py", line 20, in mail_on_create_intro if created: NameError: global name 'created' is not defined How comes that? The documentation at http://docs.djangoproject.com/en/dev/ref/signals/#post-save says there should be an argument named 'created'... If I replace 'created' with 'True' for example, the error says that 'global name 'instance' is not defined'. I suspect I'm writing bad syntax? -benjamin --~--~-~--~~~---~--~~ 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 inlines and foreign keys
So closed problem with me. My model's parent is itself. I mean, I want it like that. class Content(models.Model): subtitle = models.CharField(blank=True, max_length=300, help_text='Something is coming.') title = models.CharField(max_length=300, unique=True, help_text='Something is coming.') slug = models.SlugField(db_index=True, unique=True) spot = models.TextField() content = models.TextField() key_words = models.TextField(blank=True) short_exp = models.TextField(blank=True) avatar = models.ImageField(upload_to='images/content/', blank=True) gallery = models.ManyToManyField(Gallery, blank=True) relateds = models.ManyToManyField('self', blank=True) parent = models.ForeignKey('self', blank=True, related_name='parent_id', verbose_name='parent content', null=True) Firstly I want to make possible it can be left blank. But django says me parent_id' cannot be null when i leave it blank. And secondly can I define a default value for it. Thank you.. 2008/9/14 Daniel Roseman <[EMAIL PROTECTED]> > > On Sep 14, 9:05 am, Donn <[EMAIL PROTECTED]> wrote: > > Hi, > > I have been looking, but can't find. > > > > I have a Client model with a Website inline (related by FK). it's open in > a > > change screen in the admin. > > The inline below has a field that refers to the parent Client. > > That field is a drop-down showing many Clients. > > > > Is there any way to tell the inline to use the Client name that I am > currently > > editing anyway? > > > > If I edit Client A it seems silly to have to choose "A" again from the > inline > > for each row I want to add/edit. > > > > Just wondering. A client is bound to ask "can you just..." :) > > \d > > That should happen automatically - you shouldn't see the foreign key > to the parent model. Can you post your model and admin code on > dpaste.com so we can work out what's wrong? > > -- > DR. > > > -- Ali Deniz EREN [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: Admin inlines and foreign keys
> That should happen automatically - you shouldn't see the foreign key > to the parent model. Can you post your model and admin code on > dpaste.com so we can work out what's wrong? Thanks, I'm sure it's something dumb I'm doing. Here: http://dpaste.com/78053/ \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 -~--~~~~--~~--~--~---
Change 'name' attribute of form field
Prior to django's 1.0 release, I had unfortunately avoided django's forms. Now, I've mostly converted my project to make use of them. I want to use django to display the form field in my templates; however, I want the 'name' attribute of the field to be as below, but the value does not change: In [149]: f['title'].name = 'model.0.title' In [150]: f['title'].name Out[150]: 'title' How can I change this value? --~--~-~--~~~---~--~~ 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: Internal server error upgarding from 0.97 to 1.0
On Sep 9, 2008, at 10:39 AM, Haku wrote: > > Hello, i'm quite frustrated by this problem. > Today i had the idea to update my svn from the old 0.97 to the 1.0 > release, and now nothing is working anymore. > > I always get an anonymous "Internal Server Error" > Maybe because my project included mptt, but the fact is that i cant > figure out why it is crashing. Seems like it's the slug fields but i > don't really know. > Mptt has not been updated to work with 1.0, as it relies upon signals, which were changed in 1.0. If you want to use mptt, you will need to examine the new signals API, and update a local copy of the mptt codebase to use it. It's not that hard - The signals are just declared differently. Mptt needs a refactor anyway. It would be ideal if it dropped the dynamic Model alterations, and utilized the new Model inheritance features introduced in 1.0. I re-implemented mptt this way for my own uses - but other customizations I made to it make it inappropriate for a patch. --~--~-~--~~~---~--~~ 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: ORM vs SQL vs HBase
On Sep 13, 2008, at 7:11 PM, Russell Keith-Magee wrote: > > On Sun, Sep 14, 2008 at 7:24 AM, Martin Diers <[EMAIL PROTECTED]> wrote: >> >> On Sep 6, 2008, at 11:36 AM, Posi wrote: >>> >>> Still though, how tied are we to a true relational model and how >>> does >>> that tie to a column based DB. >> >> So utterly and completely, that if you wished to use HBase, there >> would be no possible way to integrate in into the current ORM. > > This answer is utterly and completely untrue. > > One of the outcomes of the recent queryset-refactor was to decouple > the SQL specific parts of the ORM from the queryset itself. Writing a > non-SQL backend for queries is now in the realm of possibility (and > during DjangoCon, I heard at least one mention of a prototype CouchDB > backend). Obviously, there will always be limitations - the concept of > 'joins' on CouchDB is a little vague, for example - but basic data > queries can definitely be integrated. > > To be clear - this doesn't mean "writing a CouchDB backed is a 30 > minute job for a newcomer", and there aren't any tutorials on how to > do this, and if you try and it breaks you get to keep every single one > of the shiny pieces. However, it is _possible_, and I for one am > interested in seeing support for non-SQL databases in the Django > world. > > Yours > Russ Magee %-) > Point taken, and I should have read the post better. Although the current ORM would need to be extended to gain the true power of a column oriented DB. When I think of where things like a ColumnSet fits into the Django ORM, I start to get dizzy. --~--~-~--~~~---~--~~ 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 inlines and foreign keys
On Sep 14, 9:05 am, Donn <[EMAIL PROTECTED]> wrote: > Hi, > I have been looking, but can't find. > > I have a Client model with a Website inline (related by FK). it's open in a > change screen in the admin. > The inline below has a field that refers to the parent Client. > That field is a drop-down showing many Clients. > > Is there any way to tell the inline to use the Client name that I am currently > editing anyway? > > If I edit Client A it seems silly to have to choose "A" again from the inline > for each row I want to add/edit. > > Just wondering. A client is bound to ask "can you just..." :) > \d That should happen automatically - you shouldn't see the foreign key to the parent model. Can you post your model and admin code on dpaste.com so we can work out what's wrong? -- 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: Customizing new comment
chatchai wrote: > 2. Once I authenticate user, no need to have user filling user name > and email. Unfortunately, comment form required those fields. Not really. If user is authenticated, her id is stored along with comment in DB, and you can transparently access user_name and user_email like if a user filled these fields in while posting a comment. -- Happy Hacking. http://sphinx.net.ru む --~--~-~--~~~---~--~~ 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: ***SPAM*** A trick to force autoreloading, in case of changes in views.py
Steve Holden wrote: > n00m wrote: >> What is the http:[...]? >> >> Remove from your sig this link to your f**king spam-like site. >> >> On Sep 12, 4:36 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: >> >>> Thomas Guettler[...] > If you think it's spam, why add another link to Google by quoting the > URL (twice) in your message? > Aah, don't you just love the days you make the same mistake you criticize other people for? -- 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: Database Security
All, Thank you very much for all the insightfull techniques. I will test the proposed functionalities in a lab environment prior to deployment. V/r, -Mario On Sep 13, 5:32 pm, Sander Steffann <[EMAIL PROTECTED]> wrote: > Hi Mario, > > > DATABASE_HOST ="http://192.168.1.128; > > DATABASE_HOST must contain a hostname or IP address, not an URL. You > should remove the "http://; part and check that the IP address is > correct and reachable. > > - Sander --~--~-~--~~~---~--~~ 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: 3 models need to access 1 model
[EMAIL PROTECTED] wrote: > Thanks Steve. I currently don't have an admin.py file in any of my > apps. Is this as simple as creating the file and moving all > admin.site.register() and admin.ModelAdmin sections into it ? and the > file gets autoloaded ? > Pretty much, yes. 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: ***SPAM*** A trick to force autoreloading, in case of changes in views.py
n00m wrote: > What is the http://www.thomas-guettler.de/? > > Remove from your sig this link to your f**king spam-like site. > > On Sep 12, 4:36 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > >> Thomas Guettler,http://www.thomas-guettler.de/ If you think it's spam, why add another link to Google by quoting the URL (twice) in your message? 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: ***SPAM*** A trick to force autoreloading, in case of changes in views.py
What is the http://www.thomas-guettler.de/? Remove from your sig this link to your f**king spam-like site. On Sep 12, 4:36 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Thomas Guettler,http://www.thomas-guettler.de/ --~--~-~--~~~---~--~~ 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: maxlength or max_length?
Thanks, its a shared server so I will have to enquire as to what is happening concerning the python path. Regards, Andrew --~--~-~--~~~---~--~~ 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 Inline does not want to edit
Hi, I fought against this for the whole day already (with patching Django; creating Form and FormSet subclasses etc.) but nothing helped. I want to have a Message with multiple translations in my database and the admin should display the message and the translations inline. Now the problem is, that the following works and sometimes saving in the admin fails with "Please correct the errors below." and no errors below that. When I patched the template to show {{ errors }} I also get this: Translation with this None already exists. When I take a look on the errors of the translation formset I get this: [{'id': [u'Translation with this None already exists.']}, {}] The only solution this far was creating a new message, copying stuff over and deleting the old one. I'm running the current Django trunk, but this has been broken for quite some time. The relevant files look like this: admin.py from sys import maxint from django.contrib import admin from pointtec.transdigest import models class TranslationInline(admin.TabularInline): model = models.Translation class MessageAdmin(admin.ModelAdmin): ordering = ('text',) list_per_page = maxint search_fields = ('text',) inlines = [TranslationInline] admin.site.register(models.Message, MessageAdmin) models.py: from django.db import models from django.conf import settings from django.utils.translation import get_language, gettext_lazy as _ languages_available = settings.LANGUAGES class Message(models.Model): """A message which is to translate""" text = models.TextField(_('original message'), unique=True) def __unicode__(self): """A nice representation for the user""" return self.text def save(self, *args, **kwargs): self.text = self.text.strip() super(Message, self).save(*args, **kwargs) class Translation(models.Model): """Translation""" message = models.ForeignKey(Message) language = models.CharField(_('language'), max_length=5, choices=settings.LANGUAGES) translation = models.TextField(_('translation')) def save(self, *args, **kwargs): self.translation = self.translation.strip() super(Translation, self).save(*args, **kwargs) def __unicode__(self): return u"%s: %s" % (self.language, self.translation) It would be really nice if someone could show me what I'm doing wrong. regards, Marek --~--~-~--~~~---~--~~ 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: 3 models need to access 1 model
Thanks Steve. I currently don't have an admin.py file in any of my apps. Is this as simple as creating the file and moving all admin.site.register() and admin.ModelAdmin sections into it ? and the file gets autoloaded ? --~--~-~--~~~---~--~~ 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: Integrity Error (1062, "Duplicate entry '0' for key 1") ???
Well, after validating, syncing, re-validating and re-syncing, I ended up just dropping the entire database and now it works fine. On Sep 14, 10:10 am, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm using 1.0 Final, MySQL 5, and I'm getting this lovely error for > the first time. Here is my model: > > from django.db import models > from django.contrib import admin > from crider_law.sidebar_modules.models import SidebarModule > > class Page(models.Model): > name = models.CharField(max_length=100, help_text='This value is > for your reference only.') > content = models.TextField(blank=True) > title = models.CharField(max_length=100, help_text='This value > will be appended to "Crider Law |" in the browser window') > keywords = models.TextField(help_text='Please separate keywords > and/or phrases with a comma.', blank=True) > description = models.TextField(help_text='Please enter a > description for the page. This value appears in search result > listings.', blank=True) > topic = models.TextField(help_text='Please enter a topic for this > page. This value appears in search result listings.', blank=True) > sidebar_modules = models.ManyToManyField(SidebarModule, > blank=True) > body_class = models.CharField(max_length=50, editable=False) > > class Meta(): > abstract = True > > class StaticPage(Page): > can_have_child_pages = models.BooleanField() > slug = models.SlugField(editable=False) > > def __unicode__(self): > return format_name(self.name) > > class EditablePage(Page): > parent_page = models.ForeignKey(StaticPage, help_text='The static > page this page should appear under.', > limit_choices_to={'can_have_child_pages' : True}) > slug = models.SlugField(help_text='This field is suggessted for > you, but can be changed.', unique=True) > > def __unicode__(self): > return format_name(self.name) > > class StaticPageAdmin(admin.ModelAdmin): > list_display = ['__unicode__', 'title'] > fieldsets = ( > ('Fields marked in bold are required', { > 'fields' : > ('name', 'title',) > } > ), > ('Page Content', { > 'fields' : ('content',) > } > ), > ('Sidebar Modules', { > 'fields' : ('sidebar_modules',) > } > ), > ('Meta Page Properties (optional, but recommended)', { > 'fields' : > ('keywords', 'description', 'topic',) > } > ), > ) > > class Meta: > ordering = ['name'] > > class Media: > js = ('/static/upload_media/jquery.js','/static/upload_media/ > tiny_mce/tiny_mce.js', '/static/upload_media/model.js') > > class EditablePageAdmin(admin.ModelAdmin): > list_display = ['__unicode__', 'title'] > prepopulated_fields = ({ 'slug' : ('title',) }) > fieldsets = ( > ('Fields marked in bold are required', { > 'fields' : > ('parent_page', 'name', 'title', 'slug',) > } > ), > ('Page Content', { > 'fields' : > ('content',) > } > ), > ('Sidebar Modules', { > 'fields' : ('sidebar_modules',) > } > ), > ('Meta Page Properties (optional, but recommended)', { > 'fields' : > ('keywords', 'description', 'topic',) > } > ), > ) > > class Meta: > ordering = ['name'] > > class Media: > js = ('/static/upload_media/jquery.js','/static/upload_media/ > tiny_mce/tiny_mce.js', '/static/upload_media/model.js') > > def save_model(self, request, obj, form, change): > obj.body_class = obj.parent_page.body_class > obj.save() > > admin.site.register(EditablePage, EditablePageAdmin) > admin.site.register(StaticPage, StaticPageAdmin) > > def format_name(name): > return name[0].upper() + name[1:].replace('_', ' ') > > I've found a few posts regarding this, but I can't seem to figure out > what the duplicate key is. Can anyone see what I'm missing? Many > thanks in advance, > Brandon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to
Re: Filtering ManyToManyField
I would also be interested in figuring out how to "filter" a ManyToMany field David Reynolds: I went to see how this thing was done under Satchmo Project, but i didn't see the point with the specified lines of code. Could you be more specific about that please. Many thanks to who can help us Amine 2008/9/11 MikeHowarth <[EMAIL PROTECTED]> > > Anyone? > > I'm really struggling with this. > > As stated in my first post running the code creates a recursive loop. > > Had a bit of a hack around with things, but can't figure anything > obvious out. > > On Sep 11, 10:58 am, MikeHowarth <[EMAIL PROTECTED]> wrote: > > The model I'm using is very similar to that of Satchmo's > > > > Model basically looks like this: > > > > class Product(models.Model): > > name = models.CharField(_("Full Name"), max_length=255, > blank=False, > > slug = models.SlugField(_("Slug Name"), blank=True, > > related_items = models.ManyToManyField('self', blank=True, > null=True, > > verbose_name=_('Related Items'), related_name='related_products') > > > > David Reynolds wrote: > > > On 11 Sep 2008, at 10:06 am, MikeHowarth wrote: > > > > > > Could anyone clarify what I need to do be doing to acheive the > desired > > > > filtering? > > > > > Can we see your model too? > > > > > Although, I note satchmo do a similar thing: > > > > >http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/ > > > product/models.py#L458 > > > > > -- > > > David Reynolds > > > [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 -~--~~~~--~~--~--~---
Integrity Error (1062, "Duplicate entry '0' for key 1") ???
Hi everyone, I'm using 1.0 Final, MySQL 5, and I'm getting this lovely error for the first time. Here is my model: from django.db import models from django.contrib import admin from crider_law.sidebar_modules.models import SidebarModule class Page(models.Model): name = models.CharField(max_length=100, help_text='This value is for your reference only.') content = models.TextField(blank=True) title = models.CharField(max_length=100, help_text='This value will be appended to "Crider Law |" in the browser window') keywords = models.TextField(help_text='Please separate keywords and/or phrases with a comma.', blank=True) description = models.TextField(help_text='Please enter a description for the page. This value appears in search result listings.', blank=True) topic = models.TextField(help_text='Please enter a topic for this page. This value appears in search result listings.', blank=True) sidebar_modules = models.ManyToManyField(SidebarModule, blank=True) body_class = models.CharField(max_length=50, editable=False) class Meta(): abstract = True class StaticPage(Page): can_have_child_pages = models.BooleanField() slug = models.SlugField(editable=False) def __unicode__(self): return format_name(self.name) class EditablePage(Page): parent_page = models.ForeignKey(StaticPage, help_text='The static page this page should appear under.', limit_choices_to={'can_have_child_pages' : True}) slug = models.SlugField(help_text='This field is suggessted for you, but can be changed.', unique=True) def __unicode__(self): return format_name(self.name) class StaticPageAdmin(admin.ModelAdmin): list_display = ['__unicode__', 'title'] fieldsets = ( ('Fields marked in bold are required', { 'fields' : ('name', 'title',) } ), ('Page Content', { 'fields' : ('content',) } ), ('Sidebar Modules', { 'fields' : ('sidebar_modules',) } ), ('Meta Page Properties (optional, but recommended)', { 'fields' : ('keywords', 'description', 'topic',) } ), ) class Meta: ordering = ['name'] class Media: js = ('/static/upload_media/jquery.js','/static/upload_media/ tiny_mce/tiny_mce.js', '/static/upload_media/model.js') class EditablePageAdmin(admin.ModelAdmin): list_display = ['__unicode__', 'title'] prepopulated_fields = ({ 'slug' : ('title',) }) fieldsets = ( ('Fields marked in bold are required', { 'fields' : ('parent_page', 'name', 'title', 'slug',) } ), ('Page Content', { 'fields' : ('content',) } ), ('Sidebar Modules', { 'fields' : ('sidebar_modules',) } ), ('Meta Page Properties (optional, but recommended)', { 'fields' : ('keywords', 'description', 'topic',) } ), ) class Meta: ordering = ['name'] class Media: js = ('/static/upload_media/jquery.js','/static/upload_media/ tiny_mce/tiny_mce.js', '/static/upload_media/model.js') def save_model(self, request, obj, form, change): obj.body_class = obj.parent_page.body_class obj.save() admin.site.register(EditablePage, EditablePageAdmin) admin.site.register(StaticPage, StaticPageAdmin) def format_name(name): return name[0].upper() + name[1:].replace('_', ' ') I've found a few posts regarding this, but I can't seem to figure out what the duplicate key is. Can anyone see what I'm missing? Many thanks in advance, Brandon --~--~-~--~~~---~--~~ 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 do you create custom Meta Options ?
Hi! Just like permission options, I would like to provide an option called "menus" used in my App Models. For example, if I write this in my model class : class Meta: permissions = {.} I'd like to write this for "menus" : class Meta: menus = {.} OR in a options.py file, I'd like to write something like this (in my app) : menus = {.} Can you advise how to perform this task ? Many thanks for your help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: maxlength or max_length?
On Sun, Sep 14, 2008 at 8:31 PM, djandrow <[EMAIL PROTECTED]> wrote: > > I'm currently using django Version: 1.0-final-SVN-9020 and python > Version: 2.4.4, a few weeks ago (maybe a bit longer) I had to change > all my maxlengths to max_length, as I believe that was a change in > Django. > > Anyway now when i try and use manage.py validate I get: > > __init__() got an unexpected keyword argument 'max_length' > > however if i call parts of the model from the templates they work > fine. > > So my question is what is going on? and what should i be using? max_length is definitely the correct version. If you are getting errors, you either have an old version of Django in your PYTHONPATH, or the error that is being thrown by something other than a field validation. 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 -~--~~~~--~~--~--~---
maxlength or max_length?
I'm currently using django Version: 1.0-final-SVN-9020 and python Version: 2.4.4, a few weeks ago (maybe a bit longer) I had to change all my maxlengths to max_length, as I believe that was a change in Django. Anyway now when i try and use manage.py validate I get: __init__() got an unexpected keyword argument 'max_length' however if i call parts of the model from the templates they work fine. So my question is what is going on? and what should i be using? Regards, Andrew --~--~-~--~~~---~--~~ 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: [solved] Problems with mails and django-contact-form
Forget about it. Everything works fine. I just didn't check the spam filter... -benjamin --~--~-~--~~~---~--~~ 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: Creating an Archive
I solved this problem, for those who come after me, you can use: Entry.objects.dates('entry_date', 'month', order='DESC') where entry is the name of the table/model and entry_date is the name of the date field. This returns a list of months with objects in. Thanks for everyone's help, Andrew --~--~-~--~~~---~--~~ 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: Internal server error upgarding from 0.97 to 1.0
hi,Haku,I have solved the problem: old code from django.newforms.fields import Field --- change to new code --- from django.forms.fields import Field search all code, replace django.newforms with django.forms! On 9月9日, 下午11时39分, Haku <[EMAIL PROTECTED]> wrote: > Hello, i'm quite frustrated by this problem. > Today i had the idea to update my svn from the old 0.97 to the1.0 > release, and now nothing is working anymore. > > I always get an anonymous "InternalServerError" > Maybe because my project included mptt, but the fact is that i cant > figure out why it is crashing. Seems like it's the slug fields but i > don't really know. > > Is there a solution? Or maybe, how can i return to my loved 0.97 > version? > > Sorry for the dumb questions and the bad english! > > --- IF THIS CAN HELP, THIS IS THE ERRORS I GET FROM THE LOG FILE > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: Traceback (most recent > call last): > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/mod_python/apache.py", line 299, in > HandlerDispatch\nresult = object(req) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/core/handlers/modpython.py", line 222, > in handler\nreturn ModPythonHandler()(req) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/core/handlers/modpython.py", line 195, > in __call__\nresponse = self.get_response(request) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/core/handlers/base.py", line 67, in > get_response\nresponse = middleware_method(request) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/home/django/ > intranet_pini/../intranet_pini/middleware/threadlocals.py", line 12, > in process_request\n_thread_locals.user = getattr(request, 'user', > None) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/contrib/auth/middleware.py", line 5, in > __get__\nrequest._cached_user = get_user(request) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/contrib/auth/__init__.py", line 83, in > get_user\nuser_id = request.session[SESSION_KEY] > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/contrib/sessions/backends/base.py", > line 46, in __getitem__\nreturn self._session[key] > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/contrib/sessions/backends/base.py", > line 172, in _get_session\nself._session_cache = self.load() > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/contrib/sessions/backends/db.py", line > 16, in load\nexpire_date__gt=datetime.datetime.now() > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/db/models/manager.py", line 93, in get > \nreturn self.get_query_set().get(*args, **kwargs) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/db/models/query.py", line 297, in get > \nclone = self.filter(*args, **kwargs) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/db/models/query.py", line 483, in filter > \nreturn self._filter_or_exclude(False, *args, **kwargs) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/db/models/query.py", line 501, in > _filter_or_exclude\nclone.query.add_q(Q(*args, **kwargs)) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/db/models/sql/query.py", line 1224, in > add_q\ncan_reuse=used_aliases) > [Tue Sep 09 19:35:43 2008] [error] [client 192.168.0.101] > PythonHandler django.core.handlers.modpython: File "/usr/lib/ > python2.4/site-packages/django/db/models/sql/query.py", line 1099, in
Customizing new comment
-> Customizing new comment django-users <-- Thread --> <-- Date --> Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus Reply via email to Customizing new comment chatchai Re: Customizing new comment Dmitry Dzhus
Problems with mails and django-contact-form
-> Problems with mails and django-contact-form django-users <-- Thread --> <-- Date --> Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to Problems with mails and django-contact-form Benjamin Buch Re: [solved] Problems with mails and django-contact-form Benjamin Buch Reply via email to
FileSystemStorage preventing large file uploads
Hi, Some code is below. I am in my FileSystemStorage class and I want to prevent users from uploading images over 100K. There are 2 questions here: 1. Is my use of len(content) sensible? I don't have a file yet, only a memory object, so I can't use stat. 2. How would I raise an error so that it appears in the admin form? Code: class myImageStorage( FileSystemStorage ): def save(self, name, content ): lenf = len(content) # Is this right? if lenf > 102400: # WHAT do I do here? return "FILE TOO LARGE %s" % len(content) # not good... dud = super( myImageStorage,self)._save(name,content) return name i = myImageStorage( location = blah, base_url = blahblah ) class ImageMedia(models.Model): image = models.ImageField( storage = i, blank = False, upload_to="./" ) Many thanks, \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: Admin: design question
Marc Boivin wrote: [queryset method on ModelAdmin] >It is valid, tested and working on Django 1.0. I have it working. It is not >documented, you need to search in the source code to get around it. Ah, yes, it does work -- but not in the way I expected it to! I spent the better part of two hours trying to figure out why the queryset method wasn't called, and wondering if my admin.py was somehow wrong. (The documentation on this at http://docs.djangoproject.com/en/dev/ref/contrib/admin/ could use some more information on how to put it all together, especially if you *don't* want a custom AdminSite, but even if you do.) Anyway, I have found that the *only* time the queryset method is called is on the list page for ProjectCodes. I don't need a filter there! I need a filter on the edit page for Hours instances, but queryset isn't called there. It appears that the queryset method is intended mainly to restrict what a given user can see in the list. Useful for implementing complicated permission systems, but not appropriate in my case I believe. Regards, Gertjan. -- Gertjan Klein <[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 -~--~~~~--~~--~--~---
Admin inlines and foreign keys
Hi, I have been looking, but can't find. I have a Client model with a Website inline (related by FK). it's open in a change screen in the admin. The inline below has a field that refers to the parent Client. That field is a drop-down showing many Clients. Is there any way to tell the inline to use the Client name that I am currently editing anyway? If I edit Client A it seems silly to have to choose "A" again from the inline for each row I want to add/edit. Just wondering. A client is bound to ask "can you just..." :) \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 -~--~~~~--~~--~--~---