Re: Django Core mentorship list
Ahem: [1] https://groups.google.com/forum/?fromgroups#!forum/django-core-mentorship :) On Wed, Apr 3, 2013 at 11:44 AM, Jeremy Dunck <jdu...@gmail.com> wrote: > Hey all, > I've just created django-core-mentorship[1] with founding members > including Carl Meyer, Jacob Kaplan-Moss, Simon Charette, and Russell > Keith-Magee. > > Modeled after pythonmentors.com, the intention is to help more > people make the leap from using django to contributing to it. It is a > complement to django-developers, where most members are already quite > experienced with django and development in general. > > django-core-mentorship will consist just of people interested in > learning to contribute, or members of django-core who are interested > in helping those people succeed. We'll have a Code along the lines of > pythonmentors as well, but for now, I hope this email will suffice. > > If you ever see conversation on this list where you feel a new > contributor is being turned away (or turned off) by the existing > django-developers discussion, please direct them to > django-core-mentorship. > > If you've considered contributing to Django but haven't felt > welcome, this list is for you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Django Core mentorship list
Hey all, I've just created django-core-mentorship[1] with founding members including Carl Meyer, Jacob Kaplan-Moss, Simon Charette, and Russell Keith-Magee. Modeled after pythonmentors.com, the intention is to help more people make the leap from using django to contributing to it. It is a complement to django-developers, where most members are already quite experienced with django and development in general. django-core-mentorship will consist just of people interested in learning to contribute, or members of django-core who are interested in helping those people succeed. We'll have a Code along the lines of pythonmentors as well, but for now, I hope this email will suffice. If you ever see conversation on this list where you feel a new contributor is being turned away (or turned off) by the existing django-developers discussion, please direct them to django-core-mentorship. If you've considered contributing to Django but haven't felt welcome, this list is for you. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Getting tuple of (sql, params) from the ORM.
On Tue, Jun 26, 2012 at 11:40 AM, David Novakovicwrote: > Hey all, > > Is it possible to get a tuple of (sql, params) from an ORM queryset? Yep: sql, params = qs.query.get_compiler('default').as_sql() (Fancy meeting you here. :)) -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django (and Python) speakers
I'd also like to see Malcolm again, but I fear that'll take a trip to Sydney. :) On Tue, Feb 7, 2012 at 9:29 PM, Jeremy Dunck <jdu...@gmail.com> wrote: > The original musketeers, Jacob, Simon, and Adrian, are all great > speakers, of course. > > I thought Jeff Balough, Mike Malone, and Eric Florenzano did very well > on their talks. David Cramer represents Disqus well and has recently > released Sentry 2. > > As a particular pain points for me, I'd like to hear from someone > using MySQL and Django at scale. Similarly, a walkthrough of how to > work with celery under evented IO would be useful. > > Coverage of puppet (my preference) or Chef would also be interesting. > > PyPy deserves attention as well as the general progress towards Python 3. > > I'd like to hear Jeff Croft talk about design and open source. > > I fear I've given too many topics, but there you go. :) > > On Tue, Feb 7, 2012 at 5:00 PM, Steve Holden <holden...@gmail.com> wrote: >> I don't know if readers have heard the news that PyCon has closed >> registration early because it is full. So you may be interested in six >> new conferences, three about Python and three about Django, that we >> have just announced: >> >> http://www.prweb.com/releases/2012/1/prweb8945991.htm >> >> With this announcement I would like to solicit suggestions for >> speakers. Who do you think does an excellent job of covering their >> material? Whom do you enjoy hearing? Who has information you need. The >> conferences will be two-day single-track events, and besides having >> guest speakers we will also be including some talks submitted by the >> community. So we'll be trying to retain the "community" feel of >> DjangoCon and PyCon. >> >> Amy other ideas for speakers or other activities please get in touch! >> >> 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 >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django (and Python) speakers
The original musketeers, Jacob, Simon, and Adrian, are all great speakers, of course. I thought Jeff Balough, Mike Malone, and Eric Florenzano did very well on their talks. David Cramer represents Disqus well and has recently released Sentry 2. As a particular pain points for me, I'd like to hear from someone using MySQL and Django at scale. Similarly, a walkthrough of how to work with celery under evented IO would be useful. Coverage of puppet (my preference) or Chef would also be interesting. PyPy deserves attention as well as the general progress towards Python 3. I'd like to hear Jeff Croft talk about design and open source. I fear I've given too many topics, but there you go. :) On Tue, Feb 7, 2012 at 5:00 PM, Steve Holdenwrote: > I don't know if readers have heard the news that PyCon has closed > registration early because it is full. So you may be interested in six > new conferences, three about Python and three about Django, that we > have just announced: > > http://www.prweb.com/releases/2012/1/prweb8945991.htm > > With this announcement I would like to solicit suggestions for > speakers. Who do you think does an excellent job of covering their > material? Whom do you enjoy hearing? Who has information you need. The > conferences will be two-day single-track events, and besides having > guest speakers we will also be including some talks submitted by the > community. So we'll be trying to retain the "community" feel of > DjangoCon and PyCon. > > Amy other ideas for speakers or other activities please get in touch! > > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Fixture migrations using South?
I have some test fixtures with scenarios under test. Later, I need to migrate (with South) the DB schema around, which of cours necessitates changing domain and test code. A common problem I run into, though, is that I also need to migrate the data in my fixtures. It is possible to create a new DB, sync it to a given migration point, load the fixture, run the remaining migrations, and dump a new fixture, then drop the extra db. But it seems like a very awkward dance given how often I have the problem. Is there already a solution to this? It seems to me that South could manage some book keeping to maintain what fixtures are at which migration level, and a new south command could manage the migration of fixtures. ./manage migrate --fixtures [all other options staying the same] I imagine this would read/write some bookmark files to each affected app's ./fixtures/ directory. If the bookmark file didn't exist, the 0001 schema would be assumed. Otherwise it'd be something along the lines of: fixture_file.name.south, and contents would roughly mirror south_migrationhistory, perhaps in JSON format. Thoughts? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: cannot import blank value to IntegerField()
On Wed, Aug 3, 2011 at 5:08 PM, Didymuswrote: ... > ERROR: invalid input syntax for integer: "" > CONTEXT: COPY train_emp, line 1, column phone: "" ... > I have tried the following code in models.py > > phone = models.IntegerField(blank=True) > phone = models.IntegerField(null=True) > phone = models.IntegerField(null=True, blank=True). blank=True affects only model validation, which is a separate layer than the database. null=True allows nulls, but "" is not the same as null (at least in PostgreSQL). I think this may be a question for the postgres mailing list since this has little to do with django, but to be helpful, perhaps you are using the import command incorrectly? You didn't list the command you run, but here's a reference: http://www.postgresql.org/docs/8.2/static/sql-copy.html -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to display Scientific Notation for a field on the admin pages?
On Tue, Aug 2, 2011 at 12:32 PM, DjangoOfWarwrote: > Right now I have a Decimal field in my model but I'd like it to > display as scientific notation on the admin pages. > > Do I need to make a custom model field, that uses a custom form field > or is there an easier way? > > (I'm on Django 1.2 if it matters) What you want is a ModelAdmin which declares formfield_overrides to map the model Field to a custom widget: https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django for lean - app recommendation - A/B, cohort, user lifecycle, etc.
Hey all, I'm working on a project where I'd like to do user cohort analysis, create user lifecycle events (such as when a user hasn't used the site in X time), and A/B test changes. I know about https://bitbucket.org/akoha/django-lean/ but was wondering if people had any other favorites in this area? Cheers, Jeremy -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How can I flush my response stream in django?
On Wed, Oct 6, 2010 at 3:58 PM, Emil Stenström <e...@kth.se> wrote: > On Aug 24 2007, 8:18 pm, "Jeremy Dunck" <jdu...@gmail.com> wrote: >> >> On 8/24/07, whitesmell <jihua.p...@gmail.com> wrote: >> > One of my response content was build by several synchronous method, >> > how can Iflushmy response to client browser as soon as some part of >> > the response content is ready? >> >> The HttpResponse constructor takes either a string or an iterable. >> >> To trickle content down, you can make the iterable a generator. > > To reopen a really old thread: > > For performance reasons it might be a good idea to start sending HTML > to the client before the whole page has been rendered. For instance, > flushing directly after makes sure new HTTP requests to linked > media (CSS and JS) gets requested while the rest of the page is > loaded. > > Now: Is there a nice way of doing this in Django? Short answer: it's not well-supported. There are middleware which require access to the whole content (CSRF (possibly fixed now), GZip, etc.) I think people in Django core would like to better support it, but it's not an easy problem, because post-request cleanup depends on some signalling based on the response being complete. Please post to Django-dev if you'd like to discuss improving support. Related tickets: http://code.djangoproject.com/ticket/7581 http://code.djangoproject.com/ticket/13910 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: New User - Writing your first Django app part 1 crashed
On Sat, Mar 27, 2010 at 10:40 PM, Paul Harouffwrote: > On Sat, Mar 27, 2010 at 2:45 AM, Thierry Chich > wrote: >> Are you sure that the postgres driver of your jython is installed ? >> > > Yes. But I don't believe Jython is seeing it. > > I might have to switch to python. I was hoping to use jython so the > application would be easier to port to laptops using a CDROM. The > documentation said django was 100% compatible with jython. It should be, but using Django under jython is a minority case; your bug reports would be a valuable community contribution. We lean pretty heavily on Oracle-using for continued Oracle support -- jython support would be no different. In this case, it sounds like an issue specific to jython and its postgres driver, so you may have better luck asking their user group for help: https://lists.sourceforge.net/lists/listinfo/jython-users -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: RV: photos sexy
That's enough, folks. Gisela seems to be doing some off-topic work and made a silly mistake using gmail autocomplete. Let's let this one go. There's no need to be crass or misogynist. On Fri, Feb 26, 2010 at 11:22 AM, Juan Hernandezwrote: > Lastima que esa no seas tu Gisela!! jajajaj > > slds desde vzla > > On Fri, Feb 26, 2010 at 12:40 PM, Gisela Cartaya > wrote: >> >> My apologize for all, this has been a big mistake error, this is a >> technical mailing list I ask to the administrator to delete from archive >> that email as soon as possible. >> >> Thanks >> >> Greetings. >> >> >> >> De: Nicolas Couture [mailto:nicolas.cout...@gmail.com] >> Enviado el: Friday, February 26, 2010 1:16 AM >> Para: django-users@googlegroups.com >> CC: isaacr...@gmail.com >> Asunto: Re: RV: photos sexy >> >> >> >> This is probably the funniest post I've seen on a technical mailing list >> this year. >> >> >> >> __ Information from ESET NOD32 Antivirus, version of virus >> signature database 4220 (20090706) __ >> >> The message was checked by ESET NOD32 Antivirus. >> >> http://www.eset.com >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-us...@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dallas Django sprint 4/18 - 4/19 at CoHabitat
We've firmed up the Dallas Django sprint plans: Django 1.1 is around the corner, but there are lots of bugs left to squash. Come meet the other Django people around Dallas and check out Cohabitat, the great coworking spot in uptown. We'll start Saturday, April 18, 2009 at 9:00am through Sunday, April 19, 2009 around 5:00pm Cohabitat 2517 Thomas Ave. Dallas, TX If you'd like to go, please let me know, or mark it in Facebook: http://www.facebook.com/event.php?eid=81320026376=nf While you're considering, maybe you'll also want to come out to the Crawfish boil and party the night before: http://www.facebook.com/event.php?eid=61382229537 --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
[OT] python + rrdtool?
Does anyone use a python interface to rrdtool? I've looked around, and it seems there are several interfaces, but non have been updated recently. If someone could report success with one, I'd appreciate it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Development Process
On Sun, Jan 11, 2009 at 9:03 PM, AlexiPoliskiwrote: ... > What I would like to ask is, from more experienced Django developers, > what way do you prefer to create your applications? Models then views > then templates? Models then templates then views? Or models then views > AND templates concurrently. My general approach is: URLs first, which helps me think through the various pages users will interact with. Roughly sketch those pages, think about features and models needed for reasonable normalization. Code models Implement views. Implement templates. Factor out template tags. Performance test, tuning SQL/caching. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Admin Site
On Wed, Dec 17, 2008 at 11:34 AM, samirawrote: > > I active admin site for Django 1.0.2, it is correct on my local, but > I > see below error on server: > > emplateSyntaxError at /mywebSite/admin/ > > > Caught an exception while rendering: Tried activateAccount in module > mywebSite.mywebSite_app.views. Error was: 'module' object has no > attribute > 'activateAccount' > > > can anu body knows about activeAccount attribute? That must be in your source code. Within mywebSite_app.views, do you, in face, have an activateAccount object (usually a function)? If you think you do, please paste your views module to dpaste.com and share the link so we can further troubleshoot. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
transaction.commit_manually
Are people using the transaction.commit_manually decorator? I thought I understood it, but just learned that I don't. I'm using the transaction middleware and that's good for most of my purposes. I have another function called from lots of different views, and within that function, I wanted to isolate the general transaction condition from the connection/queries I need to run from that function. The goal here is to have a function that can run successfully when the calling view (or anything else in the request cycle) had a SQL error. Or vice versa, if an error occurs in this function, I'd like to isolate it from the calling view's functionality. Anyway, I thought commit_manually set up a nested transaction, but apparently it doesn't. So, if you're using it, can you explain how it's been useful to you? I'd like to use it correctly. :) -Jeremy --~--~-~--~~~---~--~~ 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: syncdb and postgres problems
On Jan 25, 2008 11:55 AM, Martin Ostrovsky <[EMAIL PROTECTED]> wrote: > > I'm trying to run syncdb on a clean database (no other tables etc.) in > postgres. It produces the standard Postgres error: ... > I know there's nothing wrong with my settings file and/or models code > because I'm just trying to clone an already-working instance from > another server. > > Has anybody seen this before? I haven't seen that error precisely, but I have seen odd errors when trying to syncdb a lot of apps at once. When I've seen it before, it happened because signals fired for apps which depended on other apps. Please run: django-admin.py syncdb --verbosity=2 and dpaste the entire output, then share the dpaste link here. --~--~-~--~~~---~--~~ 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: Newform-admin: problem with loading admin templates and templatetags
On Dec 27, 2007 2:15 AM, Webchemist <[EMAIL PROTECTED]> wrote: > > Jeremy, thanks to reply! > > > What you really want here is to have > > 'django.template.loaders.app_directories.load_template_source' in your > > TEMPLATE_LOADERS. That's really what you want, not add add the admin > > templates to TEMPLATE_DIRS. > > This template loader was enabled of cause from the beginning. But it > does not help. > > The traceback is at http://dpaste.com/29095/ > Err, django.contrib.admin isn't in your INSTALLED_APPS. :) --~--~-~--~~~---~--~~ 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: Datetime ordering correct?
On Dec 26, 2007 4:04 PM, Ryan K <[EMAIL PROTECTED]> wrote: > def get_sp_from_date_range(start_date, end_date, order=False): > s_products = ScheduledProduct.objects.filter(start__gt=start_date) > s_products = s_products.filter(finish__lt=end_date) > if order: > return s_products.order_by('finish') > else: > return s_products > > When order==True these are the results: > > .. > 2007-12-25 00:00:00 > 2008-01-01 00:00:00 > 2007-12-25 01:27:11 > 2007-12-25 04:27:11 > 2007-12-25 08:27:11 > ... > > Is this the correct behavior? It doesn't look like it. :) with settings.DEBUG = True, you can inspect the SQL that's being run this way: >>> from django.db import connection >>> print connection.queries If the SQL being run includes the expected order by clause, then it's time to go to the DB to verify that it gives the expected results. Not that the SQL included in connection.queries is a bit different from what's actually run on your DB since quoting is handled by the DB driver, not Django, but it should get you in the right ballpark. --~--~-~--~~~---~--~~ 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: Newform-admin: problem with loading admin templates and templatetags
On Dec 26, 2007 3:49 AM, Webchemist <[EMAIL PROTECTED]> wrote: > > Hi, all! > I am trying to switch to the new-form admin branch and created a > simple project in test purposes. > I installed 0.97-newforms-admin-SVN-6977 and created a test project. > When trying to start at 127.0.0.1:8000/admin I got an error What rev were you at before switching to newforms? > TemplateDoesNotExist at /admin/ > admin/login.html > > Ok, I add the path to the settings.TEMPLATE_DIRS: > "C:/Python25/Lib/site-packages/django/contrib/admin/templates/" ...See, this makes it seem like you're starting with a new project from scratch? If you were using the same settings file that was working on (and old rev of) trunk before, I would have thought it'd work as-is. What you really want here is to have 'django.template.loaders.app_directories.load_template_source' in your TEMPLATE_LOADERS. That's really what you want, not add add the admin templates to TEMPLATE_DIRS. Give that a go w/ the loader changed and see if adminmedia works that way, too. > All files exist, i.e. django/contrib/admin/templatetags/adminmedia.py > exists > > My configuration is: > Windows XP SP2 Pro > Python 2.5 (C:\Python25) > Django 0.97-pre-SVN-6964 and 0.97-newforms-admin-SVN-6977 (I switch > between them by renaming django folder) > If changing TEMPLATE_LOADER doesn't help, have a look at the code here: http://code.djangoproject.com/browser/django/branches/newforms-admin/django/template/__init__.py#L1000 I'd just see what paths were coming in there and go from there. If you're not sure how to proceed but changing TEMPLATE_LOADERS didn't help, please paste the entire raw stack trace for the error to dpaste.com and put a link here on the list. Cheers, Jeremy P.S. Turnaround on help from the list is generally better; I imagine it's slow due to the holidays. --~--~-~--~~~---~--~~ 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: Many2Many Lookup query
On Dec 19, 2007 2:20 AM, Julien <[EMAIL PROTECTED]> wrote: ... > So far, my query looks like this: > (Thread.objects.filter(message__sender=request.user) | > Thread.filter(message__recipients=request.user)).distinct() > > I'm not sure about the "message__recipients=request.user". > Do you know how the query should be? AFAIK, that's correct. But you have some syntax errors. Fixed here: http://dpaste.com/28606/ --~--~-~--~~~---~--~~ 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: Catching 413 response
I think you want tramline. Or you want ticket #2070 Sorry you've received no helpful response in the meantime. On Dec 7, 2007 8:58 AM, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > > Did anybody manage to catch in Django 413 response (request entity too > large), thrown by http servers eg. when size of uploaded file exceeds > limit? I cann't find any way to communicate this response to application. --~--~-~--~~~---~--~~ 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: Performance of a django website
On Dec 11, 2007 1:39 PM, Richard Coleman <[EMAIL PROTECTED]> wrote: ... > > > I think a large part of my question really comes down to "Is 300 > requests per second reasonable for an uncached django site on a single > machine?". Maybe it is. > > We are looking at using the memcached API in our code, and I'm sure we > will get a speedup there. But before we start down that route, I wanted > to make sure we weren't doing any silly on the raw site. > > I think my next step is to use the profiler and find out why the site is > so CPU intensive. > > Thanks for all the help. Again I suggest a hello-world view as a baseline, but if you really are doing 7000 queries per second, perhaps you're also constructing a lot of ORM objects; there's some overhead to the signalling (pre/post init, pre/post save). --~--~-~--~~~---~--~~ 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: Performance of a django website
On Dec 11, 2007 1:21 PM, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > Hi again, > > > 3. I'm using prefork MPM on apache with maxclients set to 1000. > > Apart from Joe's excellent profiling suggestion, I would recommend > reducing maxclients to a much lower value (like say 100) and then > increasing it gradually. Please make 'hello world' view to simplify the troubleshooting. If it's still "only" 300 r/s without hitting the DB, the problem is much smaller. You haven't listed your ab parameters; if you're using maxclients so high, perhaps you're paying the process startup cost (nearly) each time, so consider setting startservers high. In general, if you have a dedicated web server, setting startservers near maxclients isn't a bad way to go. --~--~-~--~~~---~--~~ 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: Performance of a django website
On Dec 11, 2007 12:18 PM, Joe <[EMAIL PROTECTED]> wrote: > > I've found the largest memory hog to be the native way related tables > are setup. > > Check class definitions with related tables and edit as such: > > class ...(models.Mode): > relatedtable= models.ForeignKey(RelatedTable, core=True, > raw_id_admin=True) > > The raw_id_admin=True prevents django from pulling up all related > records when the object is loaded etc. While I would have expected > this to only affect the admin side, it had a huge impact on the public > side of our site. Memory consumption went from +500mb to 20-30mb. > You must be using manipulators in oldforms. Try newforms. --~--~-~--~~~---~--~~ 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: Checking if in query set...
On Dec 9, 2007 8:43 PM, radioflyer <[EMAIL PROTECTED]> wrote: > > On Dec 9, 8:52 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > > On Dec 9, 2007 5:06 PM, radioflyer <[EMAIL PROTECTED]> wrote: > > > > > > > > > parents = students.parents.all() ... > > class Student(models.Model): > parents = models.ManyToManyField(User, filter_interface=True) ... > As you can see, students have a m2m relationship with parents. When a > user/parent logs in, OK, so a parent is a user, and you want to check that the user is a parent for the chosen student ID. If I understand you correctly, this would be more like this: def student_view(request, student_id): student = Student.objects.get(student_id) if student.parents.filter(pk=request.user.id).count() == 0: raise Http404 Now, another approach would be to use a URL structure which doesn't provide access to a given student ID, but rather limited access by the parent. Under that approach, /students/0/ (or even students/joe-smith/) would mean different things based on which parent was using the site. That approach would use Student.objects.filter(parents__id=request.user.id) to get the list of students for that parent, perhaps further filtering the queryset based on the given ordinal or slug. I generally prefer not to show raw IDs in the URL if I can help it, since it makes DB merging/moving tougher and it affects search results. Cheers, Jeremy --~--~-~--~~~---~--~~ 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: Checking if in query set...
On Dec 9, 2007 5:06 PM, radioflyer <[EMAIL PROTECTED]> wrote: > > parents = students.parents.all() > > And then check if logged in user.id matches against any of the parent > ids. It'd help if you shared your model definitions; any answers given will be guesses as it is. > Is there a query set method for this? If not, what would the Python > look like? (Learning Python as I learn Django.) There isn't a dedicated method to do what you want, but it's certainly possible. Share your definitions and we'll be able to help 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: static on separate what?
On Dec 9, 2007 3:07 PM, andy baxter <[EMAIL PROTECTED]> wrote: > Does this mean running the django server on a different port to the > static files, or is there a way to do it through virtual hosts? > If you only have one IP, you could run media off a non-standard port. If you have multiple IPs, just bind your media server to a different IP (but still port 80). --~--~-~--~~~---~--~~ 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: Issues trying to Caching a View
Try setting your mime type appropriately. HttpResponse(mimetype="application/x-javascript") Notice this in your view-generated-js response: Content-Type: text/html; charset=utf-8 On Dec 5, 2007 3:08 PM, Matt <[EMAIL PROTECTED]> wrote: > > Alright... still haven't figured it out. The Vary: Cookie header gets > added because I am using user authentication stuff and the view > depends on the user. But I still want the browser to cache the file. I > was thinking of using @cache_control(private=True, max_age=37000) in > order to deal with the user specific factor. > > Instead, with Vary: Cookie, the browser goes back to the server and > grabs the file again. Which is not what I want. > > Any help would be appreciated. > > Thanks, > Matt > > > > > On Dec 5, 12:26 pm, Matt <[EMAIL PROTECTED]> wrote: > > Alright... I think I might have tracked it down. I think it's an issue > > with "Vary: Cookie" and it appears their is a fix for making this > > header only show up when the request varies on the > > cookie.http://code.djangoproject.com/ticket/3586 > > > > Haven't confirmed this yet, but seem like the issue. > > > > Matt > > > > On Dec 4, 10:58 am, Matt <[EMAIL PROTECTED]> wrote: > > > > > Hi. I am trying to get a JS file cached by the browser using per-view > > > caching with @cache_page and/or @cache_control. But the file is not > > > getting cached as I would like. > > > > > I have the following scenario: A view generates a JavaScript file that > > > is unique for each user. However the JS file rarely changes for a > > > user. > > > > > In view.py--- > > > @cache_page(37000) > > > @cache_control(private=True, max_age=37000) > > > def user_unique_js(request): > > > - > > > > > When accessing the page using FireFox I can check out the HTTP headers > > > and they look like the following: > > > > > > HTTP/1.1 200 OK > > > Date: Tue, 04 Dec 2007 14:59:43 GMT > > > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/ > > > 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c > > > Expires: Wed, 05 Dec 2007 01:16:23 GMT > > > Vary: Cookie > > > Last-Modified: Tue, 04 Dec 2007 14:59:43 GMT > > > Etag: af0d1f45cb03ee198342ddb280f3164d > > > Cache-Control: private, max-age=37000 > > > Content-Type: text/html; charset=utf-8 > > > - > > > > > However, from looking at the cache using about:cache, it appears the > > > JS file get reloaded each time the page is loaded. > > > > > From about:cache - > > > last fetched: 2007-12-04 10:54:08 > > > last modified: 2007-12-04 10:54:04 > > > expires: 2007-12-04 20:16:23 > > > --- > > > > > The static JS files served by Apache do get cached. Their headers look > > > like the following: > > > -- > > > HTTP/1.1 200 OK > > > Date: Tue, 04 Dec 2007 14:58:27 GMT > > > Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/ > > > 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c > > > Last-Modified: Mon, 03 Dec 2007 19:59:20 GMT > > > Etag: "67bf-8136-37463600" > > > Accept-Ranges: bytes > > > Content-Length: 33078 > > > Content-Type: application/x-javascript > > > -- > > > > > From about:cache - > > > last fetched: 2007-12-04 10:54:06 > > > last modified: 2007-12-04 10:52:48 > > > expires: 2007-12-04 11:52:21 > > > -- > > > > > Does anyone have an idea of what the issue could? Am I attempting to > > > cache the file properly? > > > > > Thanks, > > > Matt > > > --~--~-~--~~~---~--~~ 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 on iis
Nice. Any chance of getting this page translated to English? http://code.google.com/p/pyisapi-scgi/wiki/howtousepyisapiscgi Unfortunately, I can't help. :( On Nov 29, 2007 10:10 AM, 头太晕 <[EMAIL PROTECTED]> wrote: > > pyISAPI_SCGI is a ISAPI Extension for SCGI. It can run django on iis. > > http://code.google.com/p/pyisapi-scgi/ > > > --~--~-~--~~~---~--~~ 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: 'Context' object has no attribute 'push'
On Nov 28, 2007 9:14 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Tue, 2007-11-27 at 16:47 -0800, eberg wrote: > > To continue this monolouge I worked around the problem by omitting the > > Context object and render the page with locals() instead. > > This called for unsetting all "private" variables in the view. > > > > It would however be interesting to figure out what went wrong... > > ...I realise you're only using that as a workaround, but we > can't help you solve the original problem with the information you've > provided. /me stabs in the dark: http://code.djangoproject.com/ticket/3192 --~--~-~--~~~---~--~~ 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_IPS and netmask/CIDR notation
On Nov 23, 2007 10:57 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > > Hmm...your code seems to reference an "ipv4" module I don't have > here on either of my Debian boxes, or my Win32 box at work. That > could have been handy to have, rather than trying to reinvent the > wheel. The closest I could find was an entry in the Python > Cookbook that referenced an off-site broken-link. Anything that > works with the std library? http://pypi.python.org/pypi/IPv4_Utils/0.35 It is apparently unmaintained, but does well enough. :) --~--~-~--~~~---~--~~ 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_IPS and netmask/CIDR notation
On Nov 23, 2007 10:32 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > > I don't know whether this would be better done by replacing the > INTERNAL_IPS functionality, or adding a second similar means, but > for my app, it's helpful to know if the user is "internal" or > "external" as defined by several netmasks/CIDR addresses. Rather > than adding every address in the network to INTERNAL_IPS, it > would be nice to be able to specify something like > http://dpaste.com/25684/ We've been doing this for a while. It sounds like you have more functionality in mind, though. --~--~-~--~~~---~--~~ 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: Street address normalisation
On Nov 20, 2007 3:26 PM, hajo <[EMAIL PROTECTED]> wrote: > > Thanks a lot; will defintely look into this one! > The other solution I looked at was to send an address to google (We > have a commercial deal with them; I work for a failry large > newspaper); get it geocoded and then go from there... The issue here > is one of time... Time to implement, or run-time? Implementing is not that hard... http://www.google.com/uds/solutions/localsearch/reference.html --~--~-~--~~~---~--~~ 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: weird "can't adapt" error
"Can't adapt" is quite a vague error that psycopg2 issues. Your issue is (apparently) something to do with encoding, and that's different than Sandro's issue. Please include more information, especially if you do decide to file a ticket. I can't help with the info given so far... On Nov 20, 2007 2:55 PM, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > > The problem in my case seems to be strictly related to psycopg2 > backend. I tried with psycopg and it does not happens. > > Should I file a ticket? > > > On 20 Lis, 10:17, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > > I just started receiving the same problem when I try to save an object > > that has non-ASCII values in char field (the values are all properly > > decoded to unicode)> This seems related to psycopg2 backend, as I do > > not observe such behaviour on my dev server with sqlite3 backend. The > > model is similar to: > > > > class Label(models.Model): > > title = models.CharField(max_length=200, unique=True) > > > > the code that leads to exception is like: > > > > t = 'żołędzie'.decode('utf-8') > > label = Label(title=t) > > label.save() > > > > The traceback from ipython: > > > > /home/zgoda/www/zgodowie/blog/models.py in save(self) > > 42 if not self.slug: > > 43 self.slug = slughifi(self.title) > > ---> 44 super(Label, self).save() > > 45 > > 46 > > > > /home/zgoda/www/.python/lib/python2.4/site-packages/django/db/models/ > > base.py in save(self, raw) > > 257 cursor.execute("INSERT INTO %s (%s) VALUES > > (%s)" % \ > > 258 (qn(self._meta.db_table), > > ','.join(field_names), > > --> 259 ','.join(placeholders)), db_values) > > 260 else: > > 261 # Create a new record with defaults for > > everything. > > > > ProgrammingError: can't adapt > > > > I use SVN trunk rev. 6702. > > > > On 26 Paź, 09:47, sandro dentella <[EMAIL PROTECTED]> wrote: > > > > > On 26 Set, 12:59, Sandro Dentella <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > > I'm meeting a weird problem in adjangoapplication. > > > > It works w/o any problem from my pc connecting remotely to my > > > > customer's > > > > apache but is not working inside the lan. > > > > > > I'm connecting from firefox/ubuntu they're connecting from firefox/XP. > > > > > > the weird part is that: > > > > > > 1. they have being working w/o probelms for 10 days and no > > > > modifications > > > >where made > > > > > > 2. the error complains "can'tadapt" as if trying to insert wrong > > > > types > > > >into the db, but the error trace shows the values are correct > > > > > > 3. a restart of apache fixes the problem > > > > > > 4. this is the second time the error happens... > > > > > > Any hints? > > > > TIA > > > > sandro > > > > *:-) > > > > > Hi, > > > > > once again I stumble into this problem. This time I gathered some > > > more > > > info so I describe them. > > > > > I try to insert a record it fails from a Windows pc with Firefox > > > (and > > > IE). It works from linux (firefox or galeon). > > > > > When it fails the error message is "can't adapt" but > > > > > 1. the params in the log are: > > > ('2007-10-26 08:50:03.651993', '2007-10-26 08:50:03.652039', 1, 17, > > > '2007-10-26', u'2', Decimal("100"), 'h', u'prova in fi' > > > > > 2. from my linux box I print params before a *working* insert and I > > > get: > > > ['2007-10-26 09:17:44.744656', '2007-10-26 09:17:44.744682', 1, 17, > > > '2007-10-26', u'2', Decimal("100"), 'h', u'prova'] > > > > >Not realy different > > > > > 3. When it fails the database is not hit. Db is postgres and I > > > switched on > > > statement log on every log: > > > > > log_min_duration_statement = 0 > > > > > 4. If I restart apache the error is fixed > > > > > I'm running mod_wsgi > > > > > What should I do, next time it happens to better investigate. It's > > > already > > > happened 4 times in 2 months and I cannot just accept it... > > > > > Thanks for any possible help > > > > > sandro > > > *:-) > > > > > the insert statement that worked follows: > > > > > INSERT INTO > > > "timereport_report" > > > ("date_create","date_last_modify","status","user_id","date","job_id","qty","unit","description") > > > VALUES ('2007-10-26 10:09:07.721575','2007-10-26 10:09:07.721619', > > > 1,17,'2007-10-26','2',100,'h','prova in fi2') > > > --~--~-~--~~~---~--~~ 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: weird "can't adapt" error
On Oct 26, 2007 2:47 AM, sandro dentella <[EMAIL PROTECTED]> wrote: ... > > once again I stumble into this problem. This time I gathered some > more > info so I describe them. http://groups.google.com/group/django-users/browse_thread/thread/091aa6c088f6c090 I understand you're running wsgi rather than mod_python, but if you're running multiple interpreters, you'll still have the problem discussed there. --~--~-~--~~~---~--~~ 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: postgresql problem with django api (iregex)
On Nov 20, 2007 7:12 AM, cesco <[EMAIL PROTECTED]> wrote: ... > isn't the django API supposed to be portable across different database > platforms? Does iregex make an exception because of SQLite lack of reg- > exp support? It tries, but isn't heroic. The options for total portability would be either no regex support at all (since SQLite doesn't support it), or an adapting shim (as it currently does) or maybe even dropping SQLite as an option. I think the adaptation approach is a good option. >If that's the case then the code has to be changed when > moving to production (that is, likely to a different database > platform)? Not really-- you could build your regex based on the engine: from django.conf import settings if settings.DATABASE_ENGINE == 'sqlite': re = something else: re = something_else That may make you cringe, but it only makes explicit what is really going on when you push to prod w/ modified code anyway. --~--~-~--~~~---~--~~ 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: Strip Illegal Characters - Django Admin
On Nov 15, 2007 1:04 PM, Joel Hooks <[EMAIL PROTECTED]> wrote: > > My users are cutting and pasting descriptions from Word, and this > causes HTTP 500 errors with Django AMF (but not Django more broadly.) > This textbox that I am typing in here on groups.google.com won't allow > me to paste the offending characters at all. Is there a way to force > the textbox in the Django admin change form to be whatever kind of box > this is as to disallow users from breaking the system with bad > characters? Alternatively, can I strip the bad characters somehow when > they hit save? I don't quite understand what you mean in saying that some characters aren't accepted. Are you familiar with character sets and encoding? If not, this may help: http://www.intertwingly.net/stories/2004/04/14/i18n.html It sounds like DjangoAMF isn't handling your encoding; perhaps this is a bug in DjangoAMF, or perhaps you are telling DjangoAMF the wrong thing? --~--~-~--~~~---~--~~ 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 or Cheetah (why not both)?
On Nov 11, 2007 11:51 PM, justquick <[EMAIL PROTECTED]> wrote: > > Now the project is going under the name django_cheetahtemplates to > avoid contrib namespace confusion. Regardless of name, having cheetah > templates is very handy and increases the rendering times of your > templates. We are working on transferring over all the power of the > django tags/filters to cheetah syntax. More development, including > comparative benchmarks, will be available soon on our project site > http://code.google.com/p/django-cheetahtemplate/ These are related: http://www.hoboes.com/Mimsy/?ART=554 http://huangyilib.googlecode.com/svn/trunk/mashi_django/ If you're going to go this route, it might be good to provide a unifying abstraction over the other template languages. --~--~-~--~~~---~--~~ 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 GeoDjango features with current trunk?
On 11/5/07, Karen Tracey <[EMAIL PROTECTED]> wrote: ... >You can check the branch log: > > http://code.djangoproject.com/log/django/branches/gis > > to see how current it is with respect to trunk. Look for the most recent > log message that starts "Merged revisions". In this case gis was updated > from trunk on Oct. 26 and contains all trunk changes through r6613. > All correct, thanks for the informative reply, Karen. One more note: the GeoDjango branch is off trunk because it's currently unstable in features and bugs. We'll be merging from trunk revs periodically, as well as committing bugfixes and new features to it. If you'll be using the branch, please be aware of which version you're running on and be careful updating both in terms of trunk rev on which it is based and features you depend on. The latest merge from trunk was done to include a security bugfix. Unless there is a similarly urgent reason, we'll try to pick a fairly stable trunk rev when we merge up. We'll be happy to support you in your use of the branch, of course, but understand that there are fewer people using the branch than trunk, so there are fewer people available to answer your questions. You should be prepared to be involved in troubleshooting the branch. Cheers, Jeremy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango
It's still a bit early in GeoDjango's life and functionality. Conversation has been occasional and with a relatively small number of participants. I haven't heard any complaints about the topics for discussion. I agree that GIS stuff may be a bit out of scope for dj-u, but as it pertains to bugs and features intended to land as a django contrib some day, I'd prefer to keep the discussion in the main community in the hopes that it'll produce a better package and more knowledge of the code. I'm happy to be corrected by a core contrib... On 11/3/07, Jeffrey Johnson <[EMAIL PROTECTED]> wrote: > > Why is there no list specific to GeoDjango? ... I am sure the rest of > the general Djangonauts don't need to see discussions about > Projectsions, EPSG codes and the like ;) Can we just set one up on > google groups? > > Jeff > > On 11/3/07, tlp <[EMAIL PROTECTED]> wrote: > > > > You can post to list and put GeoDjango in the subject line. > > > > - Travis > > > > > > On Nov 3, 9:17 am, "Jeffrey Johnson" <[EMAIL PROTECTED]> wrote: > > > Hi Everyone, > > > > > > Is there a specific group or list for users of GeoDjango. We just > > > started an implementation, and I want to know where I can turn to for > > > help and/or help others out. > > > > > > Thanks, > > > > > > Jeff > > > > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Caching querysets
On 11/1/07, Joe <[EMAIL PROTECTED]> wrote: > Correct me if I'm wrong, but wouldn't this place more load on the > server to to this, as an anonymous user visiting the site for the > first time would start a new session, and therefore bypass the cache? Sessions aren't created unless you modify a value in the session. If you don't do that for anonymous users, there's no problem. > My main question is this: If I changed the templates so there was only > two versions (one for authenticated users that said log out, and one > for anonymous users that said log in), how could I get the cache > middleware to vary on request.user.is_authenticated, and NOT the value > of > the cookie header? Well, you can do internal caching that varies like that, but HTTP downstream caching's Vary header can't do that. If you want to get fancy, you could issue a different ETag for the two flavors. But it sounds like you want to look at the low-level cache API in any case. --~--~-~--~~~---~--~~ 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: Off Topic: Slug regular expression
On 11/1/07, cjl <[EMAIL PROTECTED]> wrote: > > Do I need it if Django is already appending slashes? > No. Writing regular expressions is obviously something that can be done different ways. I think you should write your URLconfs expecting the slashes to be there so that you let Django append it and therefore have a single URL format. This gives you a little more coherence when people link to you, and also helps with search ranking a little. If you have APPEND_SLASH = False and wish to accept either form, then you need to have the ? after the final "/" in order to match either form. The answer to what that last "?" did, though, is answered in the re syntax guide which Tim posted. ( http://docs.python.org/lib/re-syntax.html ) Quoting: " "?" Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ab? will match either 'a' or 'ab'. " --~--~-~--~~~---~--~~ 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: Off Topic: Slug regular expression
On 10/31/07, cjl <[EMAIL PROTECTED]> wrote: ... > > > > Welcome to the transition between steps #1 and #2 ;) > > Actually, I think I'm still at step 0.5, the one where I wish someone > would post a library of frequently used Django URLconf regular > expressions, so I could 'borrow' them. > This is a pretty common response to regex's, but they really are very useful. Well worth learning. If you're having trouble figuring out what's going on, Kodos might help: http://kodos.sourceforge.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ANN: Satchmo 0.6 Released
On 10/31/07, Chris Moffitt <[EMAIL PROTECTED]> wrote: > > There have been some spurious routing issues but it looks fine now. > Are you still not seeing it? Yep, up now. :) --~--~-~--~~~---~--~~ 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: ANN: Security fix to i18n framework
On 10/31/07, Jason Cui <[EMAIL PROTECTED]> wrote: > 2007/10/31, Malcolm Tredinnick <[EMAIL PROTECTED]>: > > > > On Tue, 2007-10-30 at 00:37 -0700, Jason Cui wrote: > > > When I update my site from 0.96 to 0.96.1,my internationalize function > > > won't work for firefox, but fine for IE. > > > I use english in views and templates, and trans it to chinese in po > > > file, and I have to local folder named en and zh, now, any firefox > > > users can only see english page, change the language options is > > > useless, but IE has no problem, show chinese page. > > > > Can anybody else confirm this? > > > > Malcolm > > > > If my firefox's language setting has only zh and zh_cn options, it will show > chinese page, > when I add en to this setting, it will always show english page, even if I > set en as the last one. > Please use a tool like Wireshark or LiveHttpHeaders to show us what your Accept-Language header has. Providing this info would give bonus points (ripped from LocaleMiddleware docs): * a django_language key in the the current user's session. * a cookie called django_language. * Accept-Language HTTP header. * the global LANGUAGE_CODE setting. --~--~-~--~~~---~--~~ 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: ANN: Satchmo 0.6 Released
On 10/30/07, Chris Moffitt <[EMAIL PROTECTED]> wrote: > > After a little bit of confusion with my rss feed, I am very pleased to > announce that release 0.6 of Satchmo is really available now. Congratulations. ... > You can learn more by visiting the main satchmo site at - > http://www.satchmoproject.com Down at the moment. :-/ --~--~-~--~~~---~--~~ 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: serving django project through ssl and without ssl at the same time?!
On 10/30/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > On Oct 31, 10:23 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: ... > > This is the current logic: > > return 'HTTPS' in self._req.subprocess_env and > > self._req.subprocess_env['HTTPS'] == 'on' > > Hmmm, using req.is_https() was put back in trunk, if it fails, because > it didn't exist, it would fallback to looking for HTTPS in > req.subprocess_env. > > 44 def is_secure(self): > 45 try: > 46 return self._req.is_https() > 47 except AttributeError: > 48 # mod_python < 3.2.10 doesn't have req.is_https(). > 49 return self._req.subprocess_env.get('HTTPS', > '').lower() in ('on', '1') > > The changes were: > > http://code.djangoproject.com/changeset/6359#file0 > > Presume you aren't using trunk then. Interesting, and correct, we're on 6023. I'll look for a new stable-ish rev to jump to. :) --~--~-~--~~~---~--~~ 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: serving django project through ssl and without ssl at the same time?!
On 10/30/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: ... > In mod_wsgi, although the application entry point is defined twice, > mod_wsgi will recognise that they are on 80/443 for the same site and > ensure that only one Django instance runs in each Apache process, but > with both HTTP and HTTPS requests going to it. Whether the original > request was HTTP or HTTPS will be obtained from the is_secure() > function within Django API. I'm sorry to spread FUD here, but when running two interpreters (one for SSL, one for HTTP) for the same django settings file, is_secure has not consistently given the right answer. A while back, we tried to fix this by shifting to mod_python's req.is_https, but it was backed out, since that was just introduced with 3.2.10. You can read up on is_https's implementation to see why it was done, but I suspect Django's approach is flawed. (Graham, I'm sure you know this area better than me.) This is the current logic: return 'HTTPS' in self._req.subprocess_env and self._req.subprocess_env['HTTPS'] == 'on' >From what I saw, the subprocess_env sometimes didn't have 'HTTPS' == 'on', even when serving an HTTPS request. I asked people from 2 other Django sites under both HTTP and HTTPS-- they each happen to run separate apache instances for HTTP and HTTPS rather than using vhost under a single instance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: cursor.execute returns LONG
On 10/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > So I have a function in views: > # > def getEntries(user): > """Returns unique entries and page views for each of last 30 day > """ > cursor = connection.cursor() > query = cursor.execute('SELECT COUNT(DISTINCT(ip)) AS uniqs, > COUNT(ip) AS views, date FROM pw_logs GROUP BY date LIMIT 30') > return query.fetchall() > # > The query in phpMyAdmin returns the correct data. In Django-SVN > cursor.execute returns LONG - a number. I used SQLite yesterday with > simillar query (and others) and it worked. Now what I se on MySQL all > or almost all my cursor.execute give LONGs. What's going on? What's "connection"? Is it django.db.connection? What're your settings? DATABASE_* and DEBUG are relevant here. --~--~-~--~~~---~--~~ 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: Lost in why "UnicodeDecodeError" on changeset 6601
On 10/26/07, mamcxyz <[EMAIL PROTECTED]> wrote: > > > What's the type and value of "request.content"? What's the type and > > value of "text" ? > > self.response= Err, please give the type and value of request.*content*, not request. :) ... > 'content-type': ('Content-Type', 'text/html; charset=utf-8')} ... > > (why is utf8) There are several different charsets in play. DEFAULT_CHARSET is the encoding sent back to the client. FILE_CHARSET is the encoding of the template and initial sql files. There's also TEST_DATABASE_CHARSET with is the DB encoding, of course, but is only used when the test runner is creating your schema in the test DB. In any case, your DEFAULT_CHARSET is probably still UTF-8. This should be OK, assuming your internal bytestrings are UTF-8. The problem is clearly before the response, so we can worry about that later. :) I dunno what DB you're using, but you might ensure that the DB created for testing is using the same charset/encoding as your prod one. > > Err, your comment seems to suggest you're just switching the CHARSET > > parameter as a guess. The files really *are* in some specific > > charset, and the setting needs to agree. :-/ > > I click in file properties in komodo and tell me that my files are in > utf8. However 2 o 3 (one are part in the response) stick to CP-1252, > no matter what I do... That's very interesting. Perhaps you should get a text editor that doesn't lie to you, or a hex editor that tells you what the text editor is trying to do? :) > > ...And what rev were you at before 6601? > > Kick me, but I not take note on that :(. I'm sure was after the > unicode branch merge and before changeset 5152 because my test break > for the new "next" setting. OK. :) --~--~-~--~~~---~--~~ 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: Lost in why "UnicodeDecodeError" on changeset 6601
On 10/26/07, mamcxyz <[EMAIL PROTECTED]> wrote: > > self.assertContains(self.response,u'Buscar:') > File "D:\Programacion\Python\Python24\lib\site-packages\django\test > \testcases.py", line 111, in assertContains > real_count = response.content.count(text) > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position > 162: ordinal not in range(128) What's the type and value of "request.content"? What's the type and value of "text" ? > I must note that: > > settings.py have: > > LANGUAGE_CODE = 'es-CO' > FILE_CHARSET = 'iso-8859-1' //with utf-8 I get a lot more Err, your comment seems to suggest you're just switching the CHARSET parameter as a guess. The files really *are* in some specific charset, and the setting needs to agree. :-/ ...And what rev were you at before 6601? --~--~-~--~~~---~--~~ 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: which Django version to use for live site to be released in end of february 2008
We're running on r6023 OK. It was a quiet point on trunk after Unicode landed and the related bugfixes were done. If I were picking now, I'd find a rev closer to current trunk. But I'm pretty knowledgeable about Django and don't mind managing my own rev and applying important bugfixes when needed. 0.96 is r4810; trunk is now r6600.If you want lots of support and stable, accurate docs, you probably want 0.96. If you're concerned about large changes later, something later might be worth going with, but it will be a bit of a moving target. As a small tip, I watch trunk and if there's something really useful that's easy to pull in, I do that. I was using {% with %} on 0.96 + patches for a long while. Have a look at this: http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges if you need more details. On 10/23/07, ydjango <[EMAIL PROTECTED]> wrote: > > Not for the February/March 08 release, but yes, I will need it by the > last quarter of 2008. > > Ashish > On Oct 23, 8:18 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > On 10/23/07, ydjango <[EMAIL PROTECTED]> wrote: > > > > > > > > > I am working on product which will be released end of february. I am > > > planning to use Django for building the site. I am new to Django > > > > > Which version should I use - SVN or 0.96? > > > > > If I use 0.96, I am worried migration to 1.0 will be very painful and > > > time consuming. > > > If I use SVN version , I am not sure how stable it is? > > > Are there any production sites using the svn version. > > > Can some one please recommend? > > > > Do you need unicode (i18n or non-ASCII charsets)? That's the biggest > > single determining factor. > > > > > --~--~-~--~~~---~--~~ 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: which Django version to use for live site to be released in end of february 2008
On 10/23/07, ydjango <[EMAIL PROTECTED]> wrote: > > I am working on product which will be released end of february. I am > planning to use Django for building the site. I am new to Django > > Which version should I use - SVN or 0.96? > > If I use 0.96, I am worried migration to 1.0 will be very painful and > time consuming. > If I use SVN version , I am not sure how stable it is? > Are there any production sites using the svn version. > Can some one please recommend? > Do you need unicode (i18n or non-ASCII charsets)? That's the biggest single determining factor. --~--~-~--~~~---~--~~ 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: Does anyone know where I can find cache tag library?
On 10/23/07, Karen Tracey <[EMAIL PROTECTED]> wrote: > If you're referring to template fragment caching, it's been in trunk since > rev. 6580 (just a couple of days). Doc is here: > > http://www.djangoproject.com/documentation/cache/#template-fragment-caching > > Does your checkout not have django/templatetags/cache.py? It's certainly in > svn: > > http://code.djangoproject.com/browser/django/trunk/django/templatetags/cache.py > But beware the recent backwards-incompatible changes. http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges --~--~-~--~~~---~--~~ 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: Does anyone know where I can find cache tag library?
On 10/22/07, Nicholas Ding <[EMAIL PROTECTED]> wrote: > Hi, guys: > I've checked out the code from svn, and wanna use cache in the template, but > cache tag library has gone... > Does anyone know where is the tag library? http://www.djangosnippets.org/snippets/223/ --~--~-~--~~~---~--~~ 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: RESTful Geodjango
On 10/20/07, Ariel Mauricio Nunez Gomez <[EMAIL PROTECTED]> wrote: > POINT ( 31.00892404 ... > That NoField type, is it ok? Well, it depends what you're going to do with it. :) That 'NoField' comes from django.db.models.fields.Field.get_internal_type. It was originally used during table creation (as in manage.py syncdb) and introspection. It is also included when serializing objects (as the REST interface does), but it appears to be only serving as an annotation for convenience-- it's not actually used in deserialization. The problem you may run into is that there are various types of GIS fields, all of which will return NoField. Further, other custom field types may return NoField and not actually be GIS fields. Again, this doesn't affect Django-proper, but if you need to do something intelligent based on the type attribute, you may have trouble. ...A simple solution to fix Django on this issue isn't immediately apparent. I know Malcolm was noodling on improving Field subclassing, and this get_internal_type bit is one thing that needs improvement. I can tell you that the text value inside the for GIS fields is WKT: http://en.wikipedia.org/wiki/Well-known_text There are libraries for pasting it... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Custom middleware for logging
On 10/19/07, Steve Potter <[EMAIL PROTECTED]> wrote: > > I would like to put together a piece of code that will test the > referer for each request and if it matches a predefined pattern it > would log that request as well as place a cookie on the client. > > Is custom middleware the correct place to do this? Yes. It sounds like you want to use process_request, do your matching, and either log right then, or, if you need to wait for the response for some reason, annotate the request with an extra attribute, which a later process_* can check for. > Also, I'm not exactly clear how response.set_cookie() works. If I set > a cookie in the middleware during a request, will it be passed to the > client on the next response? Use response.set_cookie in process_response. That's always the response passed back from the resolved view. The cookie will be set on *that* response, which is going on the wire back to the client just after you return. :) --~--~-~--~~~---~--~~ 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 Django's Auth System
On 10/18/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > On 10/18/07, Hugh Bien <[EMAIL PROTECTED]> wrote: > > I was wondering if it was possible to customize Django's Auth system to not > > include permissions, groups, or messages. For the app I'm working on, just > > have a User model would be great. > > Just because they're there doesn't mean you have to use 'em. Just > ignore what you don't need. Admin and comments rely on them, of course. --~--~-~--~~~---~--~~ 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 is happening with mod_python
On 10/17/07, Michael Newman <[EMAIL PROTECTED]> wrote: ... > > ImportError: No module named django.core.handlers.modpython > ... > my conf file is a basic: > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE videouploader.settings > PythonDebug On > PythonPath "['/home/django/myapp']+sys.path" > > > can anyone see the stupid mistake that I am making? Make sure that the sys.path for the python Apache's user has Django on the sys.path and that it has permissions to execute all the directories up to it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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*** Nested in statements
On 10/16/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Hi, > > you can use the extra() method of QuerySet: > > Example: Entry.objects.extra(where=['id IN (3, 4, 5, 20)']) > How is this different from __in, and where did that list of numbers come from? :) --~--~-~--~~~---~--~~ 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: Nested in statements
On 10/16/07, Rufman <[EMAIL PROTECTED]> wrote: > > in SQL terms this is what i want to do: > SELECT * > FROM `build` > WHERE `iKeyBuildNr` > IN ( > >SELECT `iFKeyBuildNr` >FROM `package` >WHERE `strPackageName` > IN ("denon_AVR4306") >) > > How can i do this with the django db api? I tried it with __in, but it > doesn't seem to take QuerSets. You can't, at least not in one query. The nearest would be something like this: iKeys = [p['iFKeyBuildNr'] for p in Package.objects.filter(strPackageName__in=['denon_AVR4306'] ).values('iFKeyBuildNr')] builds = Build.objects.filter(iKeyBuildNr__in=iKeys) There are several variations on that theme, but I'm pretty sure it'll require 2 queries if you really need the nested in. --~--~-~--~~~---~--~~ 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: OT: How did you handle asynchronous tasks?
On 10/16/07, David Larlet <[EMAIL PROTECTED]> wrote: > * Review some parts of the code, for example use queryset.count() > instead of len(queryset), or change this part: FWIW, doing qs.count() creates a new queryset, then executes it. Doing len(queryset), then queryset[0], the second access of queryset hits the queryset cache rather than executing a second query. Even so, if queryset returns a lot of records, it does seem like a lot of work. (Code referred to is here, I presume: http://django-queue-service.googlecode.com/svn/trunk/queue/models.py ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to define urls
On 10/16/07, Pythoni <[EMAIL PROTECTED]> wrote: ... > so I have in urls.py > (r'^Myscript/(?P\w+)/','miproject.apps.mi.views.mi.Myscript'), > > it works only ifNameis one word, e.g. John. You'll see documentation of python's re syntax here: http://docs.python.org/lib/re-syntax.html Based on that, \w is indeed only these chars: [a-zA-Z0-9_] You can extend the character class to accept spaces as well like so: [\w ]+ So this would work for your purpose: (r'^Myscript/(?P[\w ]+)/','miproject.apps.mi.views.mi.Myscript'), --~--~-~--~~~---~--~~ 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 - Oracle support
On 10/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > On 10/15/07, Stefan Bethge <[EMAIL PROTECTED]> wrote: > > Just an addition. I would not recommend using oracle with django if > > you don't have an enterprise version which contains the oracle > > connection manager. Without it you won't have connection pooling > > functionality which slows down django quite a bit. > > It seems there are no free alternatives for it. > > http://www.postgresql.org/ *snark* --~--~-~--~~~---~--~~ 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: Multiple app environments on the same machine - settings & more
On 10/15/07, RajeshD <[EMAIL PROTECTED]> wrote: > > 1. Don't add myapp_* to site-packages at all. Instead keep them in two > directory roots say /home/apps/prod and /home/apps/preprod. Similarly, > you can have two different settings files for the two environments. > > 2. In your Apache vhost config for myapp.com:80, add /home/apps/prod > to the PYTHONPATH setting. And, for myapp.com:8080, add /home/apps/ > preprod. +1 If you're concerned about sharing site-packages and similar between the envs, have a look at virtualenv, too. (It supercedes workingenv.) http://pypi.python.org/pypi/virtualenv/ --~--~-~--~~~---~--~~ 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: bug in rendering non ascii characters in admin changelist
On 10/14/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: ... > class Sponsorship(models.Model): > """ links child to sponsor, startdate enddate and comments""" > sponsor = models.ForeignKey(Sponsor,verbose_name=_("Sponsor")) > child = models.ForeignKey(Child,verbose_name=_("Child")) > class Admin: > pass > def __unicode__(self): > return "%s: %s" %(self.sponsor,self.child) Maybe I'm silly, but shouldn't this: def __unicode__(self): return "%s: %s" %(self.sponsor,self.child) be more like this: def __unicode__(self): return u"%s: %s" %(self.sponsor,self.child) (Taking care to use encoding declaration for the source file, of course...) --~--~-~--~~~---~--~~ 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: Cab issue
On 10/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > This obviously means that i have misunderstood somthing in the > Templates section of the readme. Could someone provide some example > templates or requirements and locations for the templates needed? > >From the ReadMe: "The Subversion checkout will get you a set of example templates matching those currently in use on djangosnippets.org, but they assume the existence of base project-wide templates used by that site; you'll need to either create templates with the same names to extend, or edit the included templates to suit your site's layout." Did you create a base.html template somewhere it can be found by a template loader? (If you're not sure what a template loader is, check these out: http://www.djangoproject.com/documentation/settings/#template-loaders http://www.djangoproject.com/documentation/templates_python/#loading-templates ) --~--~-~--~~~---~--~~ 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: Object not callable
On 10/11/07, Cat <[EMAIL PROTECTED]> wrote: > Can anyone tell me why when I get to the line - form = > InstanceForm(request.POST) in the following view (stepping through the > code), I get a Type Error SurveyForm object is not callable. My > understanding is that it should be as it subclasses Form What is the definition of SurveyForm? --~--~-~--~~~---~--~~ 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 Django's builtin documentation
On 10/11/07, James Bennett <[EMAIL PROTECTED]> wrote: > > On 10/11/07, Rufman <[EMAIL PROTECTED]> wrote: > > Django uses docutils and restructured text for the documentation of > > the admin. How can i get my own documentation of my views and models > > (restructured text) to show on the documentation page in the django > > admin (dashboard -> documentation)? > > It's generated from the docstrings, so if you're following good Python > practice of writing docstrings in your code you'll see them show up in > the admin as documentation. ...Except that attributes are lost when functions are decorated. :) What a handy example for the patch here: http://code.djangoproject.com/ticket/5701 :) N.B. There is some doubt that the included patch will be included in Django due to provenance issues with the copied functools code. There is a current thread on django-dev regarding this. --~--~-~--~~~---~--~~ 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: NameError when following tutorial in djangobook.com/en/beta/chapter03/
On 10/10/07, drdukk <[EMAIL PROTECTED]> wrote: > > I'm new to python and django and I'm trying to follow the tutorial on > djangobook.com, but when i get to the step (chapter 3) where the first > piece of code should be executed (current_time) i get a NameError > telling me "name 'current_datetime' is not defined" > > I'm running django 0.96 on python 2.5.1 on windows 2003. > > I get the "It worked" screen fine. > > I think I have all paths as they should be, my project is in > pythonpath, I can import my project, the url is mapped. > > Any tips would be greatly appreciated, I can't seem to find anything > about it elsewhere (as it's apparently a very generic error). > drdukk, sorry for lack of response on mailing list. The beta version of the book has been out for quite a while and is not in line w/ django is some respects. Even so, when reporting errors like this, putting code on dpaste.com as well as (full) traceback will generally get you a more helpful and informed response. Glad IRC worked for 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: TinyMCE in admin
On 10/11/07, AniNair <[EMAIL PROTECTED]> wrote: > > I am trying to have tinyMCE for flatpages... Should I be using a model > for that? Ah, sorry, I missed that. Did you follow these steps? http://code.djangoproject.com/wiki/AddWYSIWYGEditor#UsingTinyMCEwithflatpages If so, you've just got your src attribute for your script tags wrong. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to allow a ForeignKey field to be null
On 10/11/07, Greg <[EMAIL PROTECTED]> wrote: > > Hello, > I have the following field in my Orders class > > delivery_method = models.ForeignKey(Delivery) > > I want to be able to add a Order record and not specify a Delivery > option when the order is initially created. > > I've tried > > delivery_method = models.ForeignKey(Delivery, null=True) > and > delivery_method = models.ForeignKey(Delivery,blank=True) > > However, when I do this I get the error 'This field is required' Try it with both. null=True, blank=True null is DB-specific. blank is validation-specific. --~--~-~--~~~---~--~~ 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: TinyMCE in admin
On 10/11/07, AniNair <[EMAIL PROTECTED]> wrote: > > My admin url ishttp://localhost:8000/admin/flatpages/flatpage/1/ > The url being requested is > [11/Oct/2007 10:21:35] "GET /admin/flatpages/flatpage/1/media/js/ > tiny_mce/tiny_m > ce.js HTTP/1.1" 404 3644 > [11/Oct/2007 10:21:35] "GET /admin/flatpages/flatpage/1/media/js/ > tiny_mce/textar > eas.js HTTP/1.1" 404 3647 > And what URL would you *expect* to successfully serve the media? As the doc[1] describes, relative URLs are prepended w/ settings.ADMIN_MEDIA_PREFIX. [1] http://www.djangoproject.com/documentation/model-api/#js --~--~-~--~~~---~--~~ 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: TinyMCE in admin
On 10/11/07, AniNair <[EMAIL PROTECTED]> wrote: > > I am trying to follow the method in > http://code.djangoproject.com/wiki/AddWYSIWYGEditor > > . I still can't get django find the files textareas.js and > tiny_mce.js. it's returning 404. Please help. Thank you > What's your admin URL and what URL is being requested for the textarea.js? This is generally a matter of putting the right number of ../ bits in your Admin.js attribute. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to delete a table?
On 10/11/07, Greg <[EMAIL PROTECTED]> wrote: ... > Do I need to do this with my sqliteman software Yes. > or ca I do something > like Orders.delete() in my djano command prompt. No. --~--~-~--~~~---~--~~ 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: dict objects are unhashable
On 10/10/07, kevinski <[EMAIL PROTECTED]> wrote: > > Honestly, I do not know what that means. How do I check this? Apologies-- I assumed that the problem had something to do with unicode and localization. http://www.djangoproject.com/documentation/i18n/#if-you-don-t-need-internationalization-in-your-app I now see the problem doesn't have anything to do with that. The problem appears to be with your urlconf. Specifically, it appears that you're providing a dictionary rather than a string for the name parameter (the 4th parameter to an urlpatterns tuple). If you have trouble identifying which one, please include the code from positiontech2.urls so I can point out the problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: dict objects are unhashable
On 10/10/07, kevinski <[EMAIL PROTECTED]> wrote: > > Can someone help me with the following error. It occurs when I restart > Apache and try to load the Admin page. When I refresh, the Admin page > comes up, however the Documentation, Change Password, and Log Out > links call http://localhost/admin/. I reinstalled Django, but it did > not help. >215. if not self._reverse_dict and hasattr(self.urlconf_module, > 'urlpatterns'): >216. for pattern in reversed(self.urlconf_module.urlpatterns): >217. if isinstance(pattern, RegexURLResolver): >218. for key, value in pattern.reverse_dict.iteritems(): >219. self._reverse_dict[key] = (pattern,) + value >220. else: >221. self._reverse_dict[pattern.callback] = (pattern,) >222. self._reverse_dict[pattern.name] = (pattern,) ... >223. return self._reverse_dict >224. reverse_dict = property(_get_reverse_dict) >225. >226. def resolve(self, path): >227. tried = [] >228. match = self.regex.search(path) > ▶ Local vars > Also, please expand local vars and show what the values of self._reverse_dict and pattern.name are. --~--~-~--~~~---~--~~ 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: dict objects are unhashable
On 10/10/07, kevinski <[EMAIL PROTECTED]> wrote: > > Can someone help me with the following error. It occurs when I restart > Apache and try to load the Admin page. When I refresh, the Admin page > comes up, however the Documentation, Change Password, and Log Out > links call http://localhost/admin/. I reinstalled Django, but it did > not help. What locale are you using? --~--~-~--~~~---~--~~ 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: middleware introspection
On 10/5/07, Robin Becker <[EMAIL PROTECTED]> wrote: > can the middleware determine the template used by V0 so that it can be used > automatically to generate V2? Yes. Have a look at django.test.utils.instrumented_test_render and .setup_test_environment. You'll see a way to monkeypatch Template.render to make a signal fire when templates are rendered. You can have your middleware initialize a list on the request object before V0 is called (process_request), add templates to the list when the signal is fired, then do something based on which templates were used (process_response). If you find that signal useful, it may be that such a real-world requirement would drive django.test.signals.template_rendered to be changed to always fire rather than just when monkeypatched by django.test. :) --~--~-~--~~~---~--~~ 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: def __str__(self) error in tutorial part 1
On 10/2/07, rhett <[EMAIL PROTECTED]> wrote: > > Total newbie here to Django and Python. Thanks for any insight. > > 1) I am working in TextMate and copied/pasted below code. In TextMate > the "def __str__(self)" is not indented from the pub_date line - it's > the same indent. I know indents are important - is there a way to set > up TextMate to show correct indentation? Or should I use a different > (Mac) editor? (I have to un-indent to not have a syntax error, but it > seems like it should be indented and the code doesn't execute > correctly). In TextMate, View -> Show Invisibles. Then, at the bottom of your document window, ensure "soft tabs" is checked, and use 4 spaces. In your document, replace any tabs with 4 spaces. Whitespace is significant in Python. Mixing tabs and spaces is a cardinal sin. I think TextMate is a fine editor for Python; you've just gotten unlucky with your cut-and-paste. --~--~-~--~~~---~--~~ 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: Debugging Django scripts problem
On 9/28/07, Jason Witherspoon <[EMAIL PROTECTED]> wrote: > Okay, I'm guessing a Python reload would indeed help, as I've managed to get > the Python debugger to find mysite.drpack.views by forcing the paths into > sys.path: > > >>> sys.path.append('/my/new/path') > > ...rather than via the symlink method. That doesn't really make sense. With the symlink method, can you import mysite? Can you print sys.path with the symlink approach, then try to import, then show the path you were trying to import. Not to be rude, but is it named "mysite" or is it named "site"? That's a common mistake. Django has a built-in site module which is responsible for setting up the python path, including site-packages. It sounds like this is what you're running into. To see what's going on here, try this >>> import sys >>> print sys.modules['site'] Please report the results. >...Seems like this doesn't alter the > sys.path permanently, though, as the paths I append evaporate a bit later > when I leave IDLE & re-check sys.path? That's certainly true. Python has some paths that it has on the path by default, plus those specified in the PYTHONPATH environment variable, plus any paths specified in .pth files, assuming the standard python site module is doing its job. Any changes you make to sys.path affect only the process (and forked children, I guess) in which you make the change. It is, after all, just a python list. > NOW, the problem is I'm getting: > > EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined > (more fully: > OK, this is another common mistake. I'm guessing development, you use ./manage.py runserver with the default settings.py file. manage.py just assumes your settings file is somewhere on the python path (e.g. in the current directory, which is generally in the standard python path) and calls "import settings". If you want to tell django where to load your settings file, and you're not using manage.py, you need to set the DJANGO_SETTINGS_MODULE environment variable. http://www.djangoproject.com/documentation/settings/#using-settings-without-setting-django-settings-module > After doing some research, it seems that manually configuring settings at > runtime might help: > > http://www.djangoproject.com/documentation/settings/#using-settings-without-setting-django-settings-module > That's a fairly unusual approach, which exists for people that are using only a small part of Django and who don't want to mess with configuration much outside their one-off script. Assuming your python path is set up correctly, you should be able to do something like this: DJANGO_SETTINGS_MODULE=mysite.settings python -m pdb ../path/to/mysite/views.py Or, to test your path stuff, you should be able to fiddle with PYTHONPATH on the commandline, like so: PYTHONPATH=/some/path:/another/path/ DJANGO_SETTINGS_MODULE=mysite.settings python -m pdb ../path/to/mysite/views.py Backing up a bit, go to the directory with views.py, and at a standard django prompt, try to import: from mysite.drpack.models import PubMedSummary If not, make sure that drpack has an __init__.py file (which enables drpack to behave as a package, a container for other modules.) You might also show your whole stack trace; it's possible you have a circular import such that drpark.models can't be properly initialized before running into an exception. To understand import better, this might help: http://effbot.org/zone/import-confusion.htm (I disagree with the general advice to always use import rather than from ... import, but his is probably the better opinion.) Cheers, Jeremy --~--~-~--~~~---~--~~ 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: elsif in templates?
On 9/24/07, Giuseppe Ciotta <[EMAIL PROTECTED]> wrote: > > Is there a real reason behind this or just this is to be implemented > in the future? http://www.djangoproject.com/documentation/design_philosophies/#template-system --~--~-~--~~~---~--~~ 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: Chaining custom manager methods on querysets
On 9/21/07, omat <[EMAIL PROTECTED]> wrote: This: > class TagManager(models.Manager) > # ... > def get_query_set(self): > return TagQuerySet Should be this: def get_query_set(self): return TagQuerySet(Tag) And you'll obviously need to implement "my_filter" on TagQuerySet. Also, this: def my_filter(self): # calculate the query set # ... return get_query_set().my_filter(*args, **kwargs Should be this: def my_filter(self): # calculate the query set # ... return self.get_query_set().my_filter(*args, **kwargs) --~--~-~--~~~---~--~~ 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: Poll: is anyone still using the old ordering syntax?
On 9/20/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > Howdy folks -- > > Quick question: is anyone still actually using the old ordering syntax > in order_by? Thanks, you made me go clean out some dead code. ;-) No for us. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: unsupported operand type(s) for *: 'Decimal' and 'Decimal'
On 9/19/07, Landlord Bulfleet <[EMAIL PROTECTED]> wrote: ... > > sum is property of a model object in our database > (models.DecimalField(max_digits=7, decimal_places=2)) & f_c.rate is a > Decimal constructed using Decimal(string) construction (Decimal is imported > with "from decimal import Decimal") > > We have some doubts that this may be a result of the django's python 2.3 > _decimal compatibility. You're using PsycoPG with multiple interpreters. :) http://www.initd.org/tracker/psycopg/ticket/192 http://groups.google.com/group/django-developers/browse_thread/thread/63046b2fca27673c/898dbf8da327ce71 Anyway, I did run into this using psycopg1, but switched to psycopg2 and patched it since 1) it's being maintained and 2) it was easier to fix that way. I emailed the psycopg list a couple weeks ago with a patch but never heard back from them. I don't have rights to add the patch to their ticket tracker, or I'd do that, too. I'm attaching a patch against psycopg2's source code here. This is for r896 on the 2.0.x branch. Alternatively, you could run separate apache processes for each needed interpreter or switch to mod_wsgi. I wasn't prepared to swtich to mod_wsgi in a hurry, so patched psycopg2 instead. Apparently not that many people are using multiple interpreters and decimal fields with psycopg... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- Index: psycopg/psycopg.h === --- psycopg/psycopg.h (revision 896) +++ psycopg/psycopg.h (working copy) @@ -129,8 +129,7 @@ char *pyenc; } encodingPair; -/* the Decimal type, used by the DECIMAL typecaster */ -extern PyObject *decimalType; +extern PyObject *psyco_decimal_type(void); /* some utility functions */ extern void psyco_set_error(PyObject *exc, PyObject *curs, char *msg, Index: psycopg/psycopgmodule.c === --- psycopg/psycopgmodule.c (revision 896) +++ psycopg/psycopgmodule.c (working copy) @@ -62,7 +62,6 @@ PyObject *pyPsycopgTzFixedOffsetTimezone = NULL; PyObject *psycoEncodings = NULL; -PyObject *decimalType = NULL; /** connect module-level function **/ #define psyco_connect_doc \ @@ -330,7 +329,7 @@ #endif #ifdef HAVE_DECIMAL -microprotocols_add((PyTypeObject*)decimalType, NULL, (PyObject*)); +microprotocols_add((PyTypeObject*)psyco_decimal_type(), NULL, (PyObject*)); #endif } @@ -554,27 +553,7 @@ } } -/* psyco_decimal_init - Initialize the module's pointer to the decimal type. */ - -void -psyco_decimal_init(void) -{ -#ifdef HAVE_DECIMAL -PyObject *decimal = PyImport_ImportModule("decimal"); -if (decimal) { -decimalType = PyObject_GetAttrString(decimal, "Decimal"); -} -else { -PyErr_Clear(); -decimalType = (PyObject *)_Type; -Py_INCREF(decimalType); -} -#endif -} - - /** method table and module initialization **/ static PyMethodDef psycopgMethods[] = { @@ -730,7 +709,6 @@ /* other mixed initializations of module-level variables */ psycoEncodings = PyDict_New(); psyco_encodings_fill(psycoEncodings); -psyco_decimal_init(); /* set some module's parameters */ PyModule_AddStringConstant(module, "__version__", PSYCOPG_VERSION); Index: psycopg/typecast_basic.c === --- psycopg/typecast_basic.c (revision 896) +++ psycopg/typecast_basic.c (working copy) @@ -113,6 +113,40 @@ return res; } +/* psyco_decimal_type + + Retrieve the decimal type from the current interpreter. + Can't cache due to each interpreter having separate sys.modules, + which causes isinstance(Decimal(), Decimal) to fail between interpreters. + + //FIXME: dropping refs every time it's called; dangerous if + // there are no other references in interp. + //We should have a pre-compiler + // WITH_MULTI_INTERPRETER to store typecasters per interpreter. +*/ + +PyObject *psyco_decimal_type(void) +{ +#ifdef HAVE_DECIMAL + + PyObject *decimal = PyImport_ImportModule("decimal"); + PyObject *decimalClass; + + if (decimal) { + Py_DECREF(decimal); + decimalClass = PyObject_GetAttrString(decimal, "Decimal"); + Py_DECREF(decimalClass); + } + else { + PyErr_Clear(); + decimalClass = (PyObject *)_Type; + } + return decimalClass; +#endif +} + + + /** DECIMAL - cast any kind of number into a Python Decimal object **/ #ifdef HAVE_DECIMAL @@ -127,7 +161,7 @@ if ((buffer = PyMem_Malloc(len+1)) == NULL)
Re: ORM / Performance
On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I have an app (0.96 so no select_related) that had a large initial To be clear, select_related has existed for quite a while in Django -- 0.91 at least. > I got a lot of mileage by caching just in a dictionary > the foreign keys so that the ORM wasn't doing lots of redundant > queries. Hmm, maybe you'd be interested in this: http://www.davidcramer.net/code/50/django-cachemanager.html#comments --~--~-~--~~~---~--~~ 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: Model.py not creating MYSQL tables.
On 9/4/07, John <[EMAIL PROTECTED]> wrote: > > Thanks. That works. > > Now I'm only getting partial form (NAME AND PHONE INBOX BOX IS > DISPLAYED) with a bunch of html code. The html code > isn't being rendered properly.The submit button isn't being displayed You'll have to show your form, view, and template for me to help with that. Use dpaste.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: Model.py not creating MYSQL tables.
On 9/4/07, John <[EMAIL PROTECTED]> wrote: > > I've created a forms application. After running syncdb without any > errors I thought database connection with MYSQL was working. Django > tables have been created. Ensure that your contacts app is listed in INSTALLED_APPS. --~--~-~--~~~---~--~~ 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 freelance work finder
On 9/4/07, Thomas Badran <[EMAIL PROTECTED]> wrote: > > I assume there are some other people on this list that do the occasional > bit of freelance work. Is there anywhere you would recommend to look for > this sort of work, or software development freelance work in general? > http://code.djangoproject.com/wiki/DevelopersForHire --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to avoid blank content
On 9/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > i have a class which have two field: > author = models.ForeignKey(User) > body = models.TextField(blank=False,null=False) > i found in admin interface, i cannot save a record with blank content > for body,which will rise a error. > but in user interface, i can save it with blank content. > > does someone know how to rise a error for blank body? thx model_instance.validate() --~--~-~--~~~---~--~~ 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: Signals Question - Firing off an email after a save
On 9/3/07, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > save() is method, so it must get at least one parameter - self. > def save( self ): >... Sorry, I was sloppy. :-/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to convert a Django model item to the underlying python object
On 9/3/07, shabda <[EMAIL PROTECTED]> wrote: > > I need to convert a models.datefield to a python type. How can I do > this. In general what is the way to convert the django model data type > to a pure python data type? I'm not sure what you're asking here. If your model is like this: class YourModel(models.Model) a_date = models.DateField() then an instance of YourModel with have an attribute, a_date, which is a Python date object. --~--~-~--~~~---~--~~ 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: Signals Question - Firing off an email after a save
On 9/2/07, Jack E. Wilkinson <[EMAIL PROTECTED]> wrote: ... > I've got a very simple model, two databases and I'm using the admin > interface. What I need is when one of the databases gets a change made > to it, for an email to be sent out to a specific group (the group never > changes, however, the subject and message content should change). > Here is the model I have written. When the Environment class changes is > when I need to send out the email. If you want to send mail when a *specific* model changes, you don't need signals. Note that signals are both single-process and synchronous, so that implementing using a built-in signal like post_save would be roughly the same as just overriding the model's save method. In your model class, just override the save method, and make sure to call the base save. from django.core.mail import send_mail class Environment(models.Model): ... def save(): super(Environment, self).save() send_mail('Subject here', 'Here is the message.', '[EMAIL PROTECTED]', ['[EMAIL PROTECTED]','[EMAIL PROTECTED]']) More: http://www.djangoproject.com/documentation/email/#quick-example --~--~-~--~~~---~--~~ 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: request.path in a context processor
On 9/1/07, Evan H. Carmi <[EMAIL PROTECTED]> wrote: > > Hi, > Here I have a context processor --> http://dpaste.com/18402/ Context processors must return a dictionary. Maybe you want this: return {'base_path': list} ? Also, it's bad form to use variables named the same as builtins (both str and list are builtins). Finally, this doesn't do what you think it does: list[:1] If you're new to Python, have a look at this: http://docs.python.org/tut/tut.html --~--~-~--~~~---~--~~ 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-voting and django-tagging error
On 8/30/07, Kelsey Ruger <[EMAIL PROTECTED]> wrote: > > I just checked out the latest versions of django-voting and django- > tagging. When attempting a syncdb I get the following error - tagging: > 'DatabaseWrapper' object has no attribute 'ops' or voting: > 'DatabaseWrapper' object has no attribute 'ops'. Anyone have an idea > on what this is? > What version of Django are you using? This recently changed on django's trunk: http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Refactoreddatabasebackends ... And this note on django-tagging's homepage: " Post version 0.1, django-tagging requires a recent SVN checkout of Django as it's tracking Backwards Incompatible Changes made to Django since 0.96. " --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: caching and authentication
It's clear to me that the docs involving patch_vary_header, cache_page and the cache middleware need to be improved. I'm using this thread as proof. :) The cache_page decorator is actually just a wrapper around the cache middleware; think of it as view-specific application ofthe cache middleware. In any case, the patch_vary_headers *should* work with the cache_page decorator; the decorator forms the cache key based on the response. This is a separate problem from the unicode issue. Can you provide any info on what isn't working as expected with the patch_vary_headers call? On 8/29/07, patrickk <[EMAIL PROTECTED]> wrote: > > I´ve been too optimistic - the above code doesn´t work. > (This whole caching-issue gives me the willies) > > On 29 Aug., 12:21, patrickk <[EMAIL PROTECTED]> wrote: > > it´s a bit late, but I just wanted to tell that it works with > > patch_vary_headers. > > in my opinion, this could be explained better in the docs. > > > > so, if one uses a page based on user-authentication and wants to cache > > that page using the cache_page decorator, here´s the code: > > > > def my_view(request): > > > > > > response = render_to_response('site/whatever/template.html', { > > ... > > }, context_instance=RequestContext(request) ) > > patch_vary_headers(response, ['Cookie']) > > return response > > my_view = cache_page(may_view, 60 * 15) > > > > thanks, > > patrick > > > > On 8 Jul., 01:18, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > > > > > On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote: > > > > > > I don´t understand why the page_cache is keyed by the vary header and > > > > the view_cache is not. is there a reason for this? > > > > > You mean cache_page rather than page_cache, but what is view_cache? > > > > > I think I may have spotted the problem: the cache_page decorator runs > > > before the Vary header gets patched for the session access. > > > > > As a test, just before you return your HttpResponse, try adding this > > > to one of your auth views, and try to use the cache_page decorator: > > > > > from django.utils.cacheimport patch_vary_headers > > > patch_vary_headers(response, ('Cookie',)) > > > > > (Maye sure to dump yourcachefirst, too.) > > > > > --~--~-~--~~~---~--~~ 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/29/07, Michael Radziej <[EMAIL PROTECTED]> wrote: > > On Wed, Aug 29, patrickk wrote: > > > > > I just changed > > self._cache.set(key, value, timeout or self.default_timeout) > > to > > self._cache.set(smart_str(key), value, timeout or > > self.default_timeout) > > in memcached.py > > and it seems to work. > > > > Don´t know if that´s a proper solution though. > > Me either ;-) It's probably not the full solution. > > But please file a ticket so this doesn't get lost (with reference to this > thread). Well, this is the error I suspected, but it now occurs to me that I'm not sure what version or rev of Django is being used here. Trunk already had this fixed: http://code.djangoproject.com/changeset/5718 patrickk, if you're trying to use unicode (especially urls) without using a version after rev 5609 (0.96 was something like rev 4800), then you're likely to run into other problems. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---