Re: Django, CherryPy and threading
On Aug 29, 11:51 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 8/28/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > ... > > > Most importantly, you should rigorously test your application to > > ensure that it is truly safe to use in a multithreaded web server. > > Areas which I would suggest you look at closely are use of session > > objects as these from memory do not provide a locking mechanism, and > > so in an AJAX heavy application which issues lots of concurrent > > requests and each handler for them wants to manipulate the same > > session object, you might run into problems with the handlers and > > sequencing of operations against the session object. > > If your session usage follows this pattern, I'd recommend using > something like PEAR:http://cheeseshop.python.org/pypi/pear/ > > It would not be difficult to modify django to support alternative > session backends, similar to its cache and db abstractions. I should point out that this issue with sessions if applicable, isn't actually restricted to a multithreaded server. Technically it could occur with a multiprocess server as well, it just may be easier to trigger a problem when a multithreaded server is used. This issue with sessions previously came up in: http://groups.google.com/group/django-users/browse_frm/thread/a7d42475b66530bd I don't know if there was any subsequent work on Django to look at how big a problem if any this is. Anyway, what was important in what I was saying was not so much the session issue, but that you should just test your system thoroughly to make sure there aren't any problems in general if using a multithreaded server. Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django under 2.5
Hi list, I have been running django under python 2.4 but now I'm considering switching to 2.5. Are there any known compatibility issues? Or is it just straightforward? Thanks, AlvAro "You can't change the world, but you can change your mind." Software Libre: El conocimiento no puede tener dueño. --~--~-~--~~~---~--~~ 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: UnicodeDecodeError with memcache
On 8/28/07, patrickk <[EMAIL PROTECTED]> wrote: > > additional information: > I just checked the default encoding > > >>> import sys > >>> sys.getdefaultencoding() > 'ascii' > > should that be something different (like utf-8)? > btw: all our data (database) and scripts are encoded with utf-8. patrickk, I'm not sure what lapain's experience with unicode is, but please disregard the advice to switch defaultencoding to utf-8. Despite appearances, it's *good* that python refuses to guess what encoding you might wish to emit. You've found a bug in Django, and it's better to fix Django than tell everybody to go hack their python installs or change their processes with unusual configurations. --~--~-~--~~~---~--~~ 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: UnicodeDecodeError with memcache
On 8/27/07, patrickk <[EMAIL PROTECTED]> wrote: > > With using the cache_page decorator, I´m getting a Unicode Error on my > page: > > UnicodeDecodeError at /spezialprogramme/ > 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in > range(128) > patrickk, please give your whole stack trace. If it's not clear from the stack trace, please also say which CACHE_BACKEND you're using. Additionally, please give the value of the URL being requested (request.path) and the value of settings.CACHE_MIDDLEWARE_KEY_PREFIX --~--~-~--~~~---~--~~ 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: UnicodeDecodeError with memcache
What middleware you are using .. any external middleware? On Aug 28, 12:27 pm, patrickk <[EMAIL PROTECTED]> wrote: > why prefer latin1 over utf-8 (in settings.py)? > > On 28 Aug., 09:12, Iapain <[EMAIL PROTECTED]> wrote: > > > > >>> import sys > > > >>> sys.getdefaultencoding() > > > > 'ascii' > > > Try using utf-8, btw it shouldnt be a problem. Lastly try using > > changing charset to latin1 in your settings.py .. I guess your website > > is not in english .. or it has some non-ascii char. --~--~-~--~~~---~--~~ 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: Choices cannot be marked for translation?
On 28-Aug-07, at 9:55 PM, Chris Hoeppner wrote: >> when i upgraded to the latest svn head, I found that all the places >> in admin that had drop downs for choices were blank. I had always >> marked my choices for translation like so: >> >> article_type = ( >> ("NW", _("News")), >> ("FT",_("Features")), >> ) >> >> now, this doesnt work - when I remove the _(), then the choices >> appear. How do I then mark them for translation? >> > > Make sure to use gettext_lazy i *am* using: from django.utils.translation import gettext_lazy as _ -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django, CherryPy and threading
On 8/28/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: ... > Most importantly, you should rigorously test your application to > ensure that it is truly safe to use in a multithreaded web server. > Areas which I would suggest you look at closely are use of session > objects as these from memory do not provide a locking mechanism, and > so in an AJAX heavy application which issues lots of concurrent > requests and each handler for them wants to manipulate the same > session object, you might run into problems with the handlers and > sequencing of operations against the session object. If your session usage follows this pattern, I'd recommend using something like PEAR: http://cheeseshop.python.org/pypi/pear/ It would not be difficult to modify django to support alternative session backends, similar to its cache and db abstractions. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Do you like playing games?
[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: Django suddenly loses DJANGO_SETTINGS_MODULE running locally
I didn't dig deeper last night because I was "getting things done" and it was easier to just export the environment and move on. Looking harder at the traceback I noticed it was getting hung up on my putting stuff in the project's __init__.py file which was importing things from Django. It looks like a chicken and egg problem if I do that. "Which came first, the chicken or the egg? I egged the chicken and then I ate his leg." -- Beastie Boys -Rob On 8/28/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > The OP isn't talking about Apache but using inbuilt Django server > using manage.py. :-) > > The OP should really post the full traceback and messages there are > getting so it can be seen whether they are interpreting it correctly. > Information in the details may also be helpful to people in working > out what is wrong. > > Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django suddenly loses DJANGO_SETTINGS_MODULE running locally
The OP isn't talking about Apache but using inbuilt Django server using manage.py. :-) The OP should really post the full traceback and messages there are getting so it can be seen whether they are interpreting it correctly. Information in the details may also be helpful to people in working out what is wrong. Graham On Aug 29, 1:55 am, TheMaTrIx <[EMAIL PROTECTED]> wrote: > This is why, eventhough its noted in the docs as optional, I add the > pythonpath to my site in the apache vhosts file by default. > Adding the path globally isn't really a good thing to do but adding it > whenever your webserver starts the site its needed for, even if its > already defined somewhere else, is imho a good practice. > > On Aug 28, 5:49 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > > On 8/28/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > > Has anyone else noticed this? Isn't "./manage.py" supposed to set up > > > the settings module correctly? > > > manage.py just tries to import the settings module directly; it > > basically assumes that '.' is on your sys.path, that "settings" is the > > name of your settings module, and that the current working directory > > contains the settings module. > > > Is it possible any of those things changed? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django, CherryPy and threading
On Aug 29, 1:39 am, Justin Johnson <[EMAIL PROTECTED]> wrote: > I've managed to get Django working nicely with CherryPy using WSGI. > Previously I've deployed Django with Apache and ModPython where each > requested is serviced by a separate Python instance. How you think mod_python works is wrong, or at least the way you explain it is deceiving in its meaning. In mod_python, each request is not 'serviced by a separate Python instance'. In the case of prefork MPM in Apache, although it isn't threaded and so concurrent requests can't be handled at the same time within a single interpreter instance, successive requests do get handled in the same Python interpreter instance. In other words, the interpreter is not thrown away and instead persists until the process itself is killed, which may only be when Apache itself is shutdown or restarted. In the case of worker MPM in Apache, multithreading is used and so concurrent requests do get handled in the same interpreter at the same time. Again, the interpreter persists for the life of the process. Where confusion often arises and why this myth that a separate Python instance is used for each request persists is that Apache on UNIX is a multi process web server. Thus your requests aren't necessarily all handled in the same process, instead they can be distributed across multiple processes. The use of multiple processes by Apache and the fact that it can create more on demand as load rises, means that Apache is much better able to scale than solutions which use a single Python process with web server implemented in Python only. I really wish this myth about mod_python would die. :-( For a bit more information about the process/interpreter model in mod_python read: http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel > This isn't the case with CherryPy though as it's thread based which > leads me to the following concern: is it safe to serve Django with > CherryPy? If one takes the warning in mod_python documentation that only prefork MPM for Apache should be used and worker MPM should not, then it would follow that using the CherryPy multithreaded web server would not be safe. Similarly, it wouldn't be safe to run Django on Windows with Apache either. In practice, discussions in the past have indicated that there are no known multithreading problems in Django itself. Thus the warnings about avoiding worker MPM and thus multithreaded MPMs may not be strictly applicable. Now although Django may be safe for multithreading, you would still need to ensure that your higher level code implemented in Django is multithread safe. You would also need to ensure that you are using recent versions of any database adapters and that they declare themselves as multithread safe. Most importantly, you should rigorously test your application to ensure that it is truly safe to use in a multithreaded web server. Areas which I would suggest you look at closely are use of session objects as these from memory do not provide a locking mechanism, and so in an AJAX heavy application which issues lots of concurrent requests and each handler for them wants to manipulate the same session object, you might run into problems with the handlers and sequencing of operations against the session object. Graham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Development Position
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I forgot to mention that this position is located in New York, NY and > applicants must be US citizens with no criminal history. What a shame. You were talking just about me, but I don't meet the US citizen thing. We'll talk when you think about telecommuters. Good Luck! -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG1JbjSyMaQ2t7ZwcRAmR0AKCZkyjf6QKMoH5nbp6osrGsEcLv1wCfTvfm rOVdttrvCEtfGBIVsURJ048= =gD7y -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- begin:vcard fn:Christian Hoeppner n:Hoeppner;Christian email;internet:[EMAIL PROTECTED] note:I am a freelance coder specialized in web applications and their deployment at a small or medium scale. x-mozilla-html:FALSE version:2.1 end:vcard
Re: QuerySet & memory
On 8/28/07, Tomas Kopecek <[EMAIL PROTECTED]> wrote: ... > For me it could be more appropriate to change iterator() to do some > slicing for me (by explicit LIMIT clause), maybe a small patch for our > application. I understand, that changing it in general would be a bad > design decision. Ick. :) Consider subclassing queryset to override __iter__ and do the chunking yourself. This is bad in the sense that it does n+1 queries to chunk it, but you said that it wasn't needed that often. Also, note that if you need a consistent read (despite other processes committing between chunk selects), then you'll need to change your transaction isolation level: http://en.wikipedia.org/wiki/Transaction_isolation_level class MyQuerySet(QuerySet): def __iter__(self): import itertools import math count = self.count() chunk_size = 1000 #or whatever makes sense to you chunks = [] for i in range(0, math.ceil(float(count)/chunk_size)): print i chunks.append(self[chunk_size*i:chunk_size*(i+1)].iterator()) return itertools.chain(*chunks) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Development Position
I forgot to mention that this position is located in New York, NY and applicants must be US citizens with no criminal history. On Aug 28, 4:25 pm, David Sonenberg <[EMAIL PROTECTED]> wrote: > The Developer will primarily be responsible for performing development > tasks relating to the firm's intranet system including bug fixes, > documentation, and feature development. The Developer will also be > responsible for managing smaller projects to support internal systems, > external web sites, and forensic processes. > > The successful candidate will have the following technical skills: > · Python > · Django framework > · Unix/Linux system administration, including but not limited to: > o Apache > o Common RDBMS systems such as PostgreSQL or MySQL > > The following skills are not required, but highly preferable: > · PHP > · Bash/shell scripting > · Version control systems such as CVS or Subversion > > The successful candidate for this position will be able to interface > well with internal customers, work efficiently with a team, and be > comfortable with working on singular long-term projects as well as > multiple projects in a short period or simultaneously. The successful > candidate will be able to work in a multi-platform and highly secure > environment. > > Please submit resumes to [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 -~--~~~~--~~--~--~---
Error adding DateField - 'unicode' object has no attribute 'strftime'
Hello, I have the following code in my models.py file class Orders(models.Model): timestamp = models.DateField() ... etc / I have the following in my view.py function from datetime import datetime o = Orders() o.timestamp = datetime.now() ... etc o.save() However, when I view this order in the admin I get the following error: AttributeError at /admin/rugs/orders/13/ 'unicode' object has no attribute 'strftime' Does anybody know what's going on? 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 -~--~~~~--~~--~--~---
Django Development Position
The Developer will primarily be responsible for performing development tasks relating to the firm's intranet system including bug fixes, documentation, and feature development. The Developer will also be responsible for managing smaller projects to support internal systems, external web sites, and forensic processes. The successful candidate will have the following technical skills: · Python · Django framework · Unix/Linux system administration, including but not limited to: o Apache o Common RDBMS systems such as PostgreSQL or MySQL The following skills are not required, but highly preferable: · PHP · Bash/shell scripting · Version control systems such as CVS or Subversion The successful candidate for this position will be able to interface well with internal customers, work efficiently with a team, and be comfortable with working on singular long-term projects as well as multiple projects in a short period or simultaneously. The successful candidate will be able to work in a multi-platform and highly secure environment. Please submit resumes to [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: Django, CherryPy and threading
You get to decide the version of "safe" - i've done something similiar with a little REST queuing app and run it up to fairly significant loads without issue. -joe On 8/28/07, Justin Johnson <[EMAIL PROTECTED]> wrote: > > > I've managed to get Django working nicely with CherryPy using WSGI. > Previously I've deployed Django with Apache and ModPython where each > requested is serviced by a separate Python instance. > > This isn't the case with CherryPy though as it's thread based which > leads me to the following concern: is it safe to serve Django with > CherryPy? > > Cheers, > > Justin > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Image manipulation
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 SlavaSh escribió: > I need to add dynamic text to animated GIF images. > What is a best way to do it? > > Thanks. Using the PIL (Python Imaging Library) :) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG1HUKSyMaQ2t7ZwcRAv/dAKCW0xabHQK+1MxFvOVz1PqYEr7r/ACgxcEa 09CcUN/D/IU8kCCC5Z9FtpQ= =6td/ -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- begin:vcard fn:Christian Hoeppner n:Hoeppner;Christian email;internet:[EMAIL PROTECTED] note:I am a freelance coder specialized in web applications and their deployment at a small or medium scale. x-mozilla-html:FALSE version:2.1 end:vcard
Image manipulation
I need to add dynamic text to animated GIF images. What is a best way to do it? 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: second query question
> class Property(models.Model): > > thing = models.ForeignKey(Thing) > property_type = models.ForeignKey(PropertyType) > value = models.CharField(...) > ... > > I want to find, for a given PropertyType, all the Things that are > lacking any Property of that type. > > Like my previous question, in SQL I could do it with an EXCEPT: > > SELECT id > FROM myapp_thing > EXCEPT > SELECT thing_id > FROM myapp_property > WHERE property_type_id = ... > > > How can I best do these sorts of EXCEPT queries with the database API? As Maciej mentioned previously, the easiest way is to use the .extra() call that the DB API provides: things = Thing.objects.extra(where=[""" id NOT IN ( SELECT thing_id FROM myapp_property WHERE property_type_id = %s ) """], params=[42] ) Both Maciej's SQL and the above SQL should be fairly portable as long as you're not porting to some older braindead version of MySQL (pre 4.1, IIRC) that lacks support for subselects [mutters under breath about that *brilliant* decision: "gee, let's omit a hugely useful functionality from ANSI SQL..." I'm not sure I'd even consider pre-5.0 MySQL a "real" database] Some backends prefer "EXISTS" to "IN" (I noticed that for certain cases, using EXISTS in PostgreSQL triggered a monumental speed-up from minutes to seconds) which just takes a minor bit of SQL tweaking to something like where=[""" NOT EXISTS ( SELECT 1 FROM myapp_property WHERE thing_id = myapp_thing.id AND property_type_id = %s ) """] (adjust the name of "myapp_thing.id" to be whatever that fieldname is aliased to) YMMV. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
What's this mean? 'module' object has no attribute 'TagField'
Trying to install django-tagging. I put a copy of the tagging directory in my project folder: MyProject/ App1/ App2/ Tagging/ I ran tagging's setup.py from a separate directory outside of my project folder. Syncdb created tag and tagged_item tables. I added TagField to a model: tag = models.TagField() When I saved the model, the server validated the models and gives me an error: * 'module' object has no attribute 'TagField' What's that mean? -- Austin --~--~-~--~~~---~--~~ 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: second query question
I believe it would be: Thing.objects.all().exclude(property__property_type__exact = type).distinct() -rfd On Aug 28, 12:24 pm, James Tauber <[EMAIL PROTECTED]> wrote: > There's another query I want to do that I can't seem to wrap my head > around at the moment: > > Say I have a model where Things have Properties each of a particular > PropertyType. So > > class Property(models.Model): > > thing = models.ForeignKey(Thing) > property_type = models.ForeignKey(PropertyType) > value = models.CharField(...) > ... > > I want to find, for a given PropertyType, all the Things that are > lacking any Property of that type. > > Like my previous question, in SQL I could do it with an EXCEPT: > > SELECT id > FROM myapp_thing > EXCEPT > SELECT thing_id > FROM myapp_property > WHERE property_type_id = ... > > How can I best do these sorts of EXCEPT queries with the database API? > > James --~--~-~--~~~---~--~~ 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: QuerySet & memory
James Bennett napsal(a): > On 8/27/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: >> QuerySet.iterator does what you want. > > I was going to follow up with a documentation link, but it appears we > lost the documentation for QuerySet.iterator at some point. Opened a > ticket > > In any case, Jeremy's right: the "iterator" method returns a generator > which fetches the data in chunks and only instantiates objects when > they're actually needed, yielding them one at a time as you iterate > over it. So you can replace a call to 'all()' with a call to > 'iterator()', or chain 'iterator()' on after a call to 'filter()', and > you should see greatly improved memory usage for situations where > you're dealing with huge numbers of objects. > > Thanks for responses. I look to iterator() code and it does this thing ok. With some experimenting I saw that mysql backend is probably the worst. Even with iterator mysql sends whole result set and Python DB imitates cursor() semantics. As I said I get 2GB of memory footprint. With SQLite I got only 20MB with same code. So it looks that I have to more think about switching to some other DBMS or to use explicit slicing. For me it could be more appropriate to change iterator() to do some slicing for me (by explicit LIMIT clause), maybe a small patch for our application. I understand, that changing it in general would be a bad design decision. So again, thank for help. -- Tomas Kopecek e-mail: permonik at mesias.brnonet.cz ICQ: 114483784 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
second query question
There's another query I want to do that I can't seem to wrap my head around at the moment: Say I have a model where Things have Properties each of a particular PropertyType. So class Property(models.Model): thing = models.ForeignKey(Thing) property_type = models.ForeignKey(PropertyType) value = models.CharField(...) ... I want to find, for a given PropertyType, all the Things that are lacking any Property of that type. Like my previous question, in SQL I could do it with an EXCEPT: SELECT id FROM myapp_thing EXCEPT SELECT thing_id FROM myapp_property WHERE property_type_id = ... How can I best do these sorts of EXCEPT queries with the database API? James --~--~-~--~~~---~--~~ 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: What's this mean? 'module' object has no attribute 'TagField'
hi austin, Austin Govella wrote: > tag = models.TagField() > > When I saved the model, the server validated the models and gives me > an error: > * 'module' object has no attribute 'TagField' you're just addressing TagField at the wrong module; it's not part of django's 'models' module but part of the 'fields' module in django-tagging. you probably want: >>> from tagging.fields import TagField at the top, and then: >>> tag = TagField() in your model declaration. best jake --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
What's this mean? 'module' object has no attribute 'TagField'
Trying to install django-tagging. I put a copy of the tagging directory in my project folder: MyProject/ App1/ App2/ Tagging/ I ran tagging's setup.py from a separate directory outside of my project folder. Syncdb created tag and tagged_item tables. I added TagField to a model: tag = models.TagField() When I saved the model, the server validated the models and gives me an error: * 'module' object has no attribute 'TagField' What's that mean? -- Austin --~--~-~--~~~---~--~~ 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: Lighttpd advice please
The best can be get vmware, download that version of linux and play locally. Trust me, for newbiews this can be very hard... also that version of linux is hard to setup than a debian one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: dynamic links
hi rufman, Rufman wrote: > def get_absolute_url(self): > return > urlresolvers.reverse('pyOrganize.pyworkbook.views.bullet.viewBullets', > kwargs={'day_id': self.fk_day, > 'rubric_id': self.fk_rubric}) just a guess - if self.fk_day is a ForeignKey field then you'll want to pass self.fk_day.id here or the expression won't match. also, i use the permalink decorator for this: http://www.djangoproject.com/documentation/model-api/#the-permalink-decorator best jake --~--~-~--~~~---~--~~ 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: Choices cannot be marked for translation?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kenneth Gonsalves escribió: > hi, > > when i upgraded to the latest svn head, I found that all the places > in admin that had drop downs for choices were blank. I had always > marked my choices for translation like so: > > article_type = ( > ("NW", _("News")), > ("FT",_("Features")), > ) > > now, this doesnt work - when I remove the _(), then the choices > appear. How do I then mark them for translation? > Make sure to use gettext_lazy -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG1EyOSyMaQ2t7ZwcRAgMiAKCXgHMMs+GgGxhTb5MDrXvPE/omfwCcCL62 en0reRc7vwT/s4WZuRnA8Ns= =dHi8 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- begin:vcard fn:Christian Hoeppner n:Hoeppner;Christian email;internet:[EMAIL PROTECTED] note:I am a freelance coder specialized in web applications and their deployment at a small or medium scale. x-mozilla-html:FALSE version:2.1 end:vcard
Re: Django suddenly loses DJANGO_SETTINGS_MODULE running locally
On Aug 28, 8:49 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > manage.py just tries to import the settings module directly; it > basically assumes that '.' is on your sys.path, that "settings" is the > name of your settings module, and that the current working directory > contains the settings module. > > Is it possible any of those things changed? None of that changed, which is odd. I just checked it out from my repository to run test the project on another computer and the same thing -- EnvironmentError. Thanks, -Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django suddenly loses DJANGO_SETTINGS_MODULE running locally
This is why, eventhough its noted in the docs as optional, I add the pythonpath to my site in the apache vhosts file by default. Adding the path globally isn't really a good thing to do but adding it whenever your webserver starts the site its needed for, even if its already defined somewhere else, is imho a good practice. On Aug 28, 5:49 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 8/28/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > Has anyone else noticed this? Isn't "./manage.py" supposed to set up > > the settings module correctly? > > manage.py just tries to import the settings module directly; it > basically assumes that '.' is on your sys.path, that "settings" is the > name of your settings module, and that the current working directory > contains the settings module. > > Is it possible any of those things changed? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django suddenly loses DJANGO_SETTINGS_MODULE running locally
On 8/28/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > Has anyone else noticed this? Isn't "./manage.py" supposed to set up > the settings module correctly? manage.py just tries to import the settings module directly; it basically assumes that '.' is on your sys.path, that "settings" is the name of your settings module, and that the current working directory contains the settings module. Is it possible any of those things changed? --~--~-~--~~~---~--~~ 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: modpython and python2.5
mod_python needs to be compiled against the python version your using. On windows mod_python even trows errors in the logfile (although it still functions) when you use the mod_python for python 2.5, while your using python 2.5.1. On Aug 28, 1:48 pm, Leandro Zanuz <[EMAIL PROTECTED]> wrote: > You'll need to recompile your apache/mod-python. When you > compile the mod-python you'll need ro inform the python path > that you want to use. > > Grupo Django escreveu: > > > This is not a django related problem, but I thought that maybe someone > > could help me. > > I have a Debian 4 server with apache2, modpython 3.3., python2.4 and > > python2.5 > > PYthon 2.4 is required by Debian to solve some dependency problem, I > > have just installed python2.5 and made it the default interpreter, but > > modpython is not using it, I have no idea why. > > Now I have a web down because I can't solve this problem. > > > Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django, CherryPy and threading
I've managed to get Django working nicely with CherryPy using WSGI. Previously I've deployed Django with Apache and ModPython where each requested is serviced by a separate Python instance. This isn't the case with CherryPy though as it's thread based which leads me to the following concern: is it safe to serve Django with CherryPy? Cheers, Justin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django suddenly loses DJANGO_SETTINGS_MODULE running locally
I've had this happen a number of times previously and fixed it by exporting the environment variable, but last night I was running without and env variable using "./manage.py runserver", stopped the server after making some changes and it then complained about the missing environment variable. It happened right after I added a new context processor. Has anyone else noticed this? Isn't "./manage.py" supposed to set up the settings module correctly? Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Thumbnails for ImageField in admin pages
On 28, 18:05, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Is there any similar trick or should I modify admin > template for change form? Yes, you have to edit admin page template to do that --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Thumbnails for ImageField in admin pages
Brilliant, thankyou. Tom On Tue, 2007-08-28 at 13:51 +, daev wrote: > Try this: > > image = models.ImageField() > > def image_thumbnail(self): > return "" % > self.get_image_url() > image_thumbnail.allow_tags = True > > class Admin: > list_display = ( "image_thumbnail", ) > > > > --~--~-~--~~~---~--~~ 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: Thumbnails for ImageField in admin pages
On 28 Sie, 15:51, daev <[EMAIL PROTECTED]> wrote: > Try this: > > image = models.ImageField() > > def image_thumbnail(self): > return "" % > self.get_image_url() > image_thumbnail.allow_tags = True > > class Admin: > list_display = ( "image_thumbnail", ) That works fine on objects list page. I'm trying to get similar effect on object modification page (admin in 0.96 displays only the link to the image). Is there any similar trick or should I modify admin template for change form? Cheers J. --~--~-~--~~~---~--~~ 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: Thumbnails for ImageField in admin pages
Try this: image = models.ImageField() def image_thumbnail(self): return "" % self.get_image_url() image_thumbnail.allow_tags = True class Admin: list_display = ( "image_thumbnail", ) --~--~-~--~~~---~--~~ 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: Thumbnails for ImageField in admin pages
Oh great suggestion, that file browser actually looks very useful for other purposes as well, i was trying to think of good way of providing 'static' page editing with images etc. and that looks to be a great help there. Thanks Tom On Tue, 2007-08-28 at 06:43 -0700, patrickk wrote: > One way is using the FileBrowser: > http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki > > But I guess there are other possibilities (just search this forum ...) > > Patrick > > On 28 Aug., 15:35, Thomas Badran <[EMAIL PROTECTED]> wrote: > > Is it possible to have thumbnails for images in the admin pages in 0.96 > > (ive read something that suggests this might be possible in svn)? > > > > I keep finding wonderful new tricks like the side by side javascript > > stuff for many to many fields etc. but cant seem to find a sensible way > > of doing this. > > > > Thanks > > > > Tom > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Thumbnails for ImageField in admin pages
One way is using the FileBrowser: http://trac.dedhost-sil-076.sil.at/trac/filebrowser/wiki But I guess there are other possibilities (just search this forum ...) Patrick On 28 Aug., 15:35, Thomas Badran <[EMAIL PROTECTED]> wrote: > Is it possible to have thumbnails for images in the admin pages in 0.96 > (ive read something that suggests this might be possible in svn)? > > I keep finding wonderful new tricks like the side by side javascript > stuff for many to many fields etc. but cant seem to find a sensible way > of doing this. > > Thanks > > Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Lighttpd advice please
Thanks Nic, Yeah I've been reading the Django and Lighttpd docs but it's not getting any clearer, just the opposite =/ I'll keep reading... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Thumbnails for ImageField in admin pages
Is it possible to have thumbnails for images in the admin pages in 0.96 (ive read something that suggests this might be possible in svn)? I keep finding wonderful new tricks like the side by side javascript stuff for many to many fields etc. but cant seem to find a sensible way of doing this. Thanks Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Lighttpd advice please
b3n <[EMAIL PROTECTED]> writes: > I want to also install Lighttpd on this box - to act as a static media > server. Can / should I also use Lighttpd for Django? Or should the > Python/Django-ness be Apache based, leaving Lighttpd to deal with > media files only. You can use lighttpd to server django. FastCGI seems to be the preferred solution. That's what I use. It works well. > Am I supposed to use use Lighttpd as FastCGI in my circumstances or > not? Django and lighttpd can talk fastcgi together. > I'm not too familar with linux and I coldn't get past the first step > in the Lighttpd installation docs: > > -bash: yum: command not found > > ... so I guess I don't have that yum thing. Can anyone tell me how to > install Lighttpd? Or point me to a tutorial/guide that does (aimed at > linux newbies)? It can be complicated stuff. The lighttpd home page is quite a good place to start. Best to try and find someone with some linux experience to show you the ropes. http://trac.lighttpd.net/trac/#Tutorials -- Nic Ferrier http://prooveme.com - easy, simple, certificated OpenID --~--~-~--~~~---~--~~ 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: Lighttpd advice please
Actually our server OS is: Red Hat Enterprise Linux ES 4 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Lighttpd advice please
We have a dedicated server at Rackspace running Apache 2 and Fedora Core 5. I want to start using Django/Python on this server. At the moment we only have about 10 client sites (PHP based) on the server . I want to also install Lighttpd on this box - to act as a static media server. Can / should I also use Lighttpd for Django? Or should the Python/Django-ness be Apache based, leaving Lighttpd to deal with media files only. I don't think we would want to use Python on our PHP sites - or vice- versa. Am I supposed to use use Lighttpd as FastCGI in my circumstances or not? I'm not too familar with linux and I coldn't get past the first step in the Lighttpd installation docs: -bash: yum: command not found ... so I guess I don't have that yum thing. Can anyone tell me how to install Lighttpd? Or point me to a tutorial/guide that does (aimed at linux newbies)? 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 -~--~~~~--~~--~--~---
Comment-framework: UnicodeError
After not being able to use memcache (see http://groups.google.com/group/django-users/browse_thread/thread/be216ba920d3b6ad/), we´re now having problems with the Comment-Framework throwing a UnicodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128) It sometimes work, but I couldn´t figure out why. Additional Information: All our models have a method __unicode__, all our data is UTF-8 (as is as our script-encoding). We tried to use "Umlauts" in our Comments, but the UnicodeError is independent from that. Thanks, Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: query where m2m field is to have values from one set but not another
> class Blah(models.Model): > ... > sources = models.ManyToManyField(Source) > > The query I want to perform is to find all the Blahs that come from > sources 1 or 2 but not sources 3 or 4. What if Blah comes from both 1 and 3? > The SQL I want to run is something like: > > SELECT blah_id > FROM myapp_blah_sources > WHERE source_id IN (1, 2) > EXCEPT > SELECT blah_id > FROM myapp_blah_sources > WHERE source_id in (3, 4); Isn't this same as: SELECT blah_id FROM myapp_blah_sources WHERE source_id IN (1, 2) AND source_id NOT IN (3,4) Maybe "Complex lookups with Q objects" from http://www.djangoproject.com/documentation/db-api/ can help here or just use extra like: Blah.objects.extra(where=['source_id IN (1, 2)', 'source_id NOT IN (3, 4)']) -- Maciej Wisniowski --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
query where m2m field is to have values from one set but not another
I have a model where each Blah can come from one or more Sources. i.e. I have: class Blah(models.Model): ... sources = models.ManyToManyField(Source) The query I want to perform is to find all the Blahs that come from sources 1 or 2 but not sources 3 or 4. My first attempt was: Blah.objects.filter(sources__id__in=[1, 2]).exclude(sources__id__in= [3, 4]) but that just returns all Blahs (the filter(sources__id__in=[1, 2]) is definitely wrong) The SQL I want to run is something like: SELECT blah_id FROM myapp_blah_sources WHERE source_id IN (1, 2) EXCEPT SELECT blah_id FROM myapp_blah_sources WHERE source_id in (3, 4); and this seems to work. Note it's directly referencing the m2m relation. What's the best way to express that SQL query in the database API? Note that the lists [1, 2] and [3, 4] are actually coming from a form and may be empty, in which case the WHERE clause could be eliminated on that side of the EXCEPT. Thanks James --~--~-~--~~~---~--~~ 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: modpython and python2.5
You'll need to recompile your apache/mod-python. When you compile the mod-python you'll need ro inform the python path that you want to use. Grupo Django escreveu: > This is not a django related problem, but I thought that maybe someone > could help me. > I have a Debian 4 server with apache2, modpython 3.3., python2.4 and > python2.5 > PYthon 2.4 is required by Debian to solve some dependency problem, I > have just installed python2.5 and made it the default interpreter, but > modpython is not using it, I have no idea why. > Now I have a web down because I can't solve this problem. > > Thank you. > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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 -~--~~~~--~~--~--~---
Choices cannot be marked for translation?
hi, when i upgraded to the latest svn head, I found that all the places in admin that had drop downs for choices were blank. I had always marked my choices for translation like so: article_type = ( ("NW", _("News")), ("FT",_("Features")), ) now, this doesnt work - when I remove the _(), then the choices appear. How do I then mark them for translation? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
modpython and python2.5
This is not a django related problem, but I thought that maybe someone could help me. I have a Debian 4 server with apache2, modpython 3.3., python2.4 and python2.5 PYthon 2.4 is required by Debian to solve some dependency problem, I have just installed python2.5 and made it the default interpreter, but modpython is not using it, I have no idea why. Now I have a web down because I can't solve this problem. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Problem in current svn TRUNK
Hi, Though I cannot easily test with exactly your packages, I tested django trunk under Ubuntu (feisty) with postgresql-8.2.3-3, python-2.5.1~rc1-0ubuntu3, python-psycopg2-2.0.5.1-6ubuntu1, with a minimal model syncdb, and it worked. Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689 --~--~-~--~~~---~--~~ 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 tutotial !?
i have try'd to go to url: http://192.168.1.1:8800/admin/polls/poll/ and i recive this error: AttributeError at /admin/polls/poll/ 'NoneType' object has no attribute 'manager' Request Method: GET Request URL:http://192.168.1.1:8800/admin/polls/poll/ Exception Type: AttributeError Exception Value:'NoneType' object has no attribute 'manager' Exception Location: /usr/local/lib/python2.5/site-packages/django/ contrib/admin/views/main.py in __init__, line 560 Python Executable: /usr/local/bin/python Python Version: 2.5.1 the source: from django.db import models import datetime class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question def was_published_today(self): return self.pub_date.date() == datetime.date.today() def was_published_today(self): return self.pub_date.date() == datetime.date.today() was_published_today.short_description = 'Published today?' class Admin: fields = ( (None, {'fields': ('question',)}), ('Date information', {'fields': ('pub_date',), 'classes': 'collapse'}), ) class Choice(models.Model): list_display = ('question', 'pub_date', 'was_published_today') list_filter = ['pub_date'] search_fields = ['question'] date_hierarchy = 'pub_date' poll = models.ForeignKey(Poll, edit_inline=models.TABULAR, num_in_admin=3) choice = models.CharField(max_length=200, core=True) votes = models.IntegerField(core=True) This two lines give error. #def __unicode__(self): #return self.choice I use the svn version. the last ! 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: Problem in current svn TRUNK
On Tue, Aug 28, Michael Radziej wrote: > > On Mon, Aug 27, Peter Nixon wrote: > > > > > On Wed 11 Jul 2007, Michael Radziej wrote: > > > Hi, > > > > > > you're using the alpha version of SuSE ... well ... there might very well > > > be a problem very deep in one of the libraries. The alpha releases aren't > > > very reliable. I'd suggest that you try it with another OS. > > > > Hi Guys > > > > I would like to point out that this problem still exists in Django post SVN > > 5608 (I just tried again with 6022). Since I initially reported this bug, I > > have moved from a 32bit to a 64bit notebook and have moved from > > "openSUSE 10.3 (i586) Alpha5" to a new install of "openSUSE 10.3 (X86-64) > > Beta2". > > > > Given that openSUSE 10.3 is going to be released soon, and that this is a > > 100% repeatable problem which only occurs post the unicode merge in Django, > > I would really appreciate if one of the developers could take the time to > > have a look at it. > > Is it possible at all to access the database from python with psycopg2? Ah, forget it. You wrote that it worked fine with older versions, so it can't be psycopg2. I'm really busted here. Please understand that I simply don't have the time to set up a SuSE box for this. As a last resort, you could try to find out at which line in the code the process aborts by adding print statements in the django database backend to psycopg2, or by single-stepping through the code with pdb. So long, Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689 --~--~-~--~~~---~--~~ 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: changing versions
> So I ran svn update and checked out rev 6022, restarted apache and > unfortunately got an "Internal Server Error" visiting the website. Please look inside apache log > I dont think I am using the correct svn command... > > when im in the .../python2.5/site-packages/django directory, I use > #sudo svn co -r 5918http://code.djangoproject.com/svn/django/trunk/ > (I cant remember when I found it) -r is a correct parameter svn co -r 5918 http://code.djangoproject.com/svn/django/trunk/ PATH Pozdrowienia --~--~-~--~~~---~--~~ 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 tutotial !?
no! I don't arrive at that part of tutorial yet. and is very strange for me. I started from the beggining. When I change from: class Admin: pass in to class Admin: fields = ( (None, {'fields': ('pub_date', 'question')}), ) it dissapear from admin. If I change it back, it doesn't apear back in admin. Why ? Is that normal ? On Aug 28, 12:28 pm, "arcr. ." <[EMAIL PROTECTED]> wrote: > Hi Sheriff, > > Have you edit the view.py and urls.py? > > On 8/28/07, Sheriff26 <[EMAIL PROTECTED]> wrote: > > > > > Hi. > > > I'm new here. I try to follow the tutorial, but I have some problems. > > > When I changed from (tutorial part two): > > > class Choice(models.Model): > > poll = models.ForeignKey(Poll) > > choice = models.CharField(max_length=200) > > votes = models.IntegerField() > > > TO > > > class Choice(models.Model): > > poll = models.ForeignKey(Poll, edit_inline=models.TABULAR, > > num_in_admin=3) > > choice = models.CharField(max_length=200, core=True) > > votes = models.IntegerField(core=True) > > > the Polls have dissapierd from the admin page. > > If I try to access it trough the url, I recive a Page Not Found 404 > > error. > > > I used only copy I have no idea where I miss'd ... > > > HELP ! > > > 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: Problem in current svn TRUNK
On Mon, Aug 27, Peter Nixon wrote: > > On Wed 11 Jul 2007, Michael Radziej wrote: > > Hi, > > > > you're using the alpha version of SuSE ... well ... there might very well > > be a problem very deep in one of the libraries. The alpha releases aren't > > very reliable. I'd suggest that you try it with another OS. > > Hi Guys > > I would like to point out that this problem still exists in Django post SVN > 5608 (I just tried again with 6022). Since I initially reported this bug, I > have moved from a 32bit to a 64bit notebook and have moved from > "openSUSE 10.3 (i586) Alpha5" to a new install of "openSUSE 10.3 (X86-64) > Beta2". > > Given that openSUSE 10.3 is going to be released soon, and that this is a > 100% repeatable problem which only occurs post the unicode merge in Django, > I would really appreciate if one of the developers could take the time to > have a look at it. Is it possible at all to access the database from python with psycopg2? Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
changing versions
Hi, I had finally decided to see if the new svn version of django fixed an issue I was having (ticket 1796 - fixed in rev 5919). So I ran svn update and checked out rev 6022, restarted apache and unfortunately got an "Internal Server Error" visiting the website. So I starting to checkout different versions to see where the problem was. I dont think I am using the correct svn command... when im in the .../python2.5/site-packages/django directory, I use #sudo svn co -r 5918 http://code.djangoproject.com/svn/django/trunk/ (I cant remember when I found it) Is that how I revert back to a previous version? When I run svnversion i get 6022, when I run svnversion trunk/ i get 5918... Which version will django be using? Im guessing 6022, but if so, how do i get it to use 5918? Any suggestion what could be causing the Internal Server Error? or how go about figuring it out? Cheers, Pawel --~--~-~--~~~---~--~~ 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 tutotial !?
Hi Sheriff, Have you edit the view.py and urls.py? On 8/28/07, Sheriff26 <[EMAIL PROTECTED]> wrote: > > > Hi. > > I'm new here. I try to follow the tutorial, but I have some problems. > > When I changed from (tutorial part two): > > class Choice(models.Model): > poll = models.ForeignKey(Poll) > choice = models.CharField(max_length=200) > votes = models.IntegerField() > > TO > > class Choice(models.Model): > poll = models.ForeignKey(Poll, edit_inline=models.TABULAR, > num_in_admin=3) > choice = models.CharField(max_length=200, core=True) > votes = models.IntegerField(core=True) > > the Polls have dissapierd from the admin page. > If I try to access it trough the url, I recive a Page Not Found 404 > error. > > I used only copy I have no idea where I miss'd ... > > HELP ! > > 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 -~--~~~~--~~--~--~---
problems with tutotial !?
Hi. I'm new here. I try to follow the tutorial, but I have some problems. When I changed from (tutorial part two): class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200) votes = models.IntegerField() TO class Choice(models.Model): poll = models.ForeignKey(Poll, edit_inline=models.TABULAR, num_in_admin=3) choice = models.CharField(max_length=200, core=True) votes = models.IntegerField(core=True) the Polls have dissapierd from the admin page. If I try to access it trough the url, I recive a Page Not Found 404 error. I used only copy I have no idea where I miss'd ... HELP ! 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: dynamic links
I tried both methods and what i found out was that im getting an empty link...how can that happen i.e how can i fix the problem? thx for your help On Aug 28, 8:13 am, Rufman <[EMAIL PROTECTED]> wrote: > >http://www.djangoproject.com/documentation/templates/#url > > I tried that already...but its not working for me...or i just don't > know whats happening. I always get a link to the current page. i.e the > page links to itself. i can't seem to find more documentation to the > url tag, so that i could solve this problem. Im going to try lapains > solution...just have to find out how that works:) --~--~-~--~~~---~--~~ 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: memcache: getting all cached keys?
Answer to my own question after contacting the memcache mailing-list: http://www.socialtext.net/memcached/index.cgi?faq#can_i_iterate_the_items_of_the_memcached_server On 27 Aug., 14:34, patrickk <[EMAIL PROTECTED]> wrote: > I´ve just used Fredriks cache view (http://effbot.org/zone/django- > memcached-view.htm) and now I´d like to additionally display all > cached sites/fragments. > Question is: How do I get all the sites/fragments currently in cache? > > Thanks, > patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: UnicodeDecodeError with memcache
why prefer latin1 over utf-8 (in settings.py)? On 28 Aug., 09:12, Iapain <[EMAIL PROTECTED]> wrote: > > >>> import sys > > >>> sys.getdefaultencoding() > > > 'ascii' > > Try using utf-8, btw it shouldnt be a problem. Lastly try using > changing charset to latin1 in your settings.py .. I guess your website > is not in english .. or it has some non-ascii char. --~--~-~--~~~---~--~~ 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: UnicodeDecodeError with memcache
> >>> import sys > >>> sys.getdefaultencoding() > > 'ascii' Try using utf-8, btw it shouldnt be a problem. Lastly try using changing charset to latin1 in your settings.py .. I guess your website is not in english .. or it has some non-ascii char. --~--~-~--~~~---~--~~ 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: UnicodeDecodeError with memcache
additional information: I just checked the default encoding >>> import sys >>> sys.getdefaultencoding() 'ascii' should that be something different (like utf-8)? btw: all our data (database) and scripts are encoded with utf-8. thanks, patrick On 28 Aug., 08:21, patrickk <[EMAIL PROTECTED]> wrote: > I´m sorry for bothering again, but our site has to be online soon and I > ´m currently not able to use the cache_page decorator (which makes me > a bit nervous). > I did some research on smart_str, but I don´t know how and where to > use it and I also don´t see why this should solve the problem. > > any feedback is highly appreciated. > btw: I´m able to use the low-level cache. > > thanks, > patrick > > On 27 Aug., 16:52, patrickk <[EMAIL PROTECTED]> wrote: > > > so you say I should use __str__ instead of __unicode__, right? > > according to the django-docs, that´s not recommended though ... > > > On 27 Aug., 16:40, Iapain <[EMAIL PROTECTED]> wrote: > > > > > UnicodeDecodeError at /spezialprogramme/ > > > > 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in > > > > range(128) > > > > try using smart_str, it it doesnt work then use less restrictive decode --~--~-~--~~~---~--~~ 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: is 40 MB RAM enough?
> could you run it and check the output. 14.28 MB --~--~-~--~~~---~--~~ 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: UnicodeDecodeError with memcache
I´m sorry for bothering again, but our site has to be online soon and I ´m currently not able to use the cache_page decorator (which makes me a bit nervous). I did some research on smart_str, but I don´t know how and where to use it and I also don´t see why this should solve the problem. any feedback is highly appreciated. btw: I´m able to use the low-level cache. thanks, patrick On 27 Aug., 16:52, patrickk <[EMAIL PROTECTED]> wrote: > so you say I should use __str__ instead of __unicode__, right? > according to the django-docs, that´s not recommended though ... > > On 27 Aug., 16:40, Iapain <[EMAIL PROTECTED]> wrote: > > > > UnicodeDecodeError at /spezialprogramme/ > > > 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in > > > range(128) > > > try using smart_str, it it doesnt work then use less restrictive decode --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: dynamic links
> > http://www.djangoproject.com/documentation/templates/#url I tried that already...but its not working for me...or i just don't know whats happening. I always get a link to the current page. i.e the page links to itself. i can't seem to find more documentation to the url tag, so that i could solve this problem. Im going to try lapains solution...just have to find out how that works:) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---