Re: current user

2008-10-14 Thread James Bennett
On Tue, Oct 14, 2008 at 3:17 PM, Keith Eberle <[EMAIL PROTECTED]> wrote: > ah yes, threadlocals... i was thinking maybe there was a newer way. > > its nice how you can override the queryset method of a ModelAdmin class > because that gets passed a request. I was hoping there'd be some similar >

Re: RESTful API or SOAP in pre-magic

2008-10-14 Thread James Bennett
On Tue, Oct 14, 2008 at 10:39 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Thank you Malcolm for the feedback. > I would prefer to use REST. So write yourself a REST API. (in other words, the answers you get will be precisely as detailed as the questions you ask) -- "Bureaucrat Conrad,

Re: How to parse an XML file with django.

2008-10-15 Thread James Bennett
On Wed, Oct 15, 2008 at 5:27 PM, JFQueralt <[EMAIL PROTECTED]> wrote: > Being a newbie in django maybe I am just missing something but I don´t > seem to find any information about how to retrieve an XML file and > parse it from django. "Django" does not have any XML-parsing libraries, because Dja

Re: Is there a way to generate an API doc from docstrings?

2008-10-15 Thread James Bennett
On Wed, Oct 15, 2008 at 4:52 PM, barbara shaurette <[EMAIL PROTECTED]> wrote: > I could swear that, pre 1.0 release, I came across a page on auto- > generating documentation from docstrings, but I can't find it in the > Django documentation anymore. The admin would, once upon a time, display the

Re: ManyToManyField with extra content and Django admin

2008-10-15 Thread James Bennett
On Wed, Oct 15, 2008 at 11:21 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote: > The admin no longer shows Sidebar Modules as a fieldset. In fact, it > doesn't show at all. I'm sure this is because you can't use add, > create or assignment to create the relationships, (see > http://docs.djangoproject

Re: How to parse an XML file with django.

2008-10-16 Thread James Bennett
On Thu, Oct 16, 2008 at 2:19 AM, JFQueralt <[EMAIL PROTECTED]> wrote: > There has to be a way to retrieve information fron a file in Django (I > ´ve seen official docs on it). > XML is nothing than a structured data file so there should be a way to > retrieve a value and use it in a template. Onc

Re: Deploy application in bytecode

2008-10-16 Thread James Bennett
On Thu, Oct 16, 2008 at 12:02 AM, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > Why has no one yet mentioned that .pyc files don't really protect your > code? I tend to treat Python bytecode as the "no-right-click script" of the Python world; those sorts of silly JavaScript tricks which "protect"

Re: login_required for imported apps

2008-10-18 Thread James Bennett
On Sat, Oct 18, 2008 at 10:22 AM, Heather <[EMAIL PROTECTED]> wrote: > Well, after trying to work this out a bit more, it looks like a nice > solution is to make a middleware class and use the process_views() but > I'm not quite at the answer yet. Generally, I don't consider the URLs for an appli

Re: auto_add and auto_add_now in admin fieldsets

2008-10-18 Thread James Bennett
On Sat, Oct 18, 2008 at 12:20 PM, Rob Goedman <[EMAIL PROTECTED]> wrote: > I couldn't find this in the ticket list. Has anybody else encountered/ > tried this? This is really sort of intended behavior; auto_now and auto_now_add on a model field implicitly set "editable=False", which means it's no

Re: login_required for imported apps

2008-10-18 Thread James Bennett
On Sat, Oct 18, 2008 at 12:25 PM, Heather <[EMAIL PROTECTED]> wrote: > What do you mean by "set up the urls so you'll have it"? Somewhere in your URL configuration, put URL patterns which point to the views you want at the URLs you want, and wrap the views with login_required there. Remember: UR

Re: what have changed in django.template when we update from 0.96 to 1.0?

2008-10-18 Thread James Bennett
On Sat, Oct 18, 2008 at 9:25 PM, Gmail <[EMAIL PROTECTED]> wrote: > for some reasons ,i put some html fragment if the db and then render them in > the template. > but when i update to django 1.0, > what i get in the rendered html are esceped. > in django 1.0 It's amazing what sort of useful infor

Re: Questions on packaging a project and naming conventions

2008-10-19 Thread James Bennett
On Sun, Oct 19, 2008 at 1:55 AM, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > However, it's important to note that this doesn't preclude the use of > deeper namespaces - it just says that namespacing for an application > shouldn't be tied to the project. One obvious way to satisfy this > would

Re: is it possible to run 0.96 and 1.0 in parallel?

2008-10-19 Thread James Bennett
On Sun, Oct 19, 2008 at 4:55 PM, Rachel Willmer <[EMAIL PROTECTED]> wrote: > It doesn't seem possible to run Django 1.0 and 0.96 concurrently on the same > machine AFAICS - am I going to have to set up another machine to work on the > 1.0 upgrade while I maintain the 0.96 release? It's actually p

Re: login_required for imported apps

2008-10-19 Thread James Bennett
On Sun, Oct 19, 2008 at 2:10 PM, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > Indeed. But , OTHO, having to copy/paste a whole urls.py just to a add > a simple decorator on the view functions is not really DRY. Personally, I don't agree; writing code to do what you want, even if it starts wit

Re: Custom Template Tag with {% end... %} tag

2008-10-19 Thread James Bennett
On Sun, Oct 19, 2008 at 4:20 PM, Erik Allik <[EMAIL PROTECTED]> wrote: > In the compilation function of your template tag, you can force the > parser to parse until tag named "endyourcustomtag" by calling nodelist > = parser.parse(("endyourcustomtag", ). This will return the contents > of your blo

Re: render_to_response failed to render media files in base.html

2008-10-20 Thread James Bennett
On Mon, Oct 20, 2008 at 9:30 PM, Chuck22 <[EMAIL PROTECTED]> wrote: > Adding context_instance=RequestContext(request) to the method fixed > the problem. Seems this should be done by default for > render_to_response method. Thank you. It would be technically impossible to do this; render_to_respon

Re: Best practices: database connection over SSL?

2009-02-03 Thread James Bennett
On Tue, Feb 3, 2009 at 9:22 PM, Jeff Hammerbacher wrote: > I could modify the call to Database.connect() in > django/db/backends/mysql/base.py, but that's not the most elegant > implementation. Does anyone have ideas on how to proceed in a > Django-approved fashion? http://docs.djangoproject.com

Re: Overriding admin template: index.html

2009-02-04 Thread James Bennett
On Wed, Feb 4, 2009 at 2:35 AM, knight wrote: > Thanks for the fast reply. > I read this but I still cannot find the view that renders index.html. You do not need to do anything to the view function. The view you're looking for is designed so that you can place your own custom template (named ap

Re: Adding project revision number to templates.

2009-02-08 Thread James Bennett
On Sun, Feb 8, 2009 at 5:21 PM, Russell Keith-Magee wrote: > 1) Look at django.utils.version.get_svn_revision(). This method tells > you Django's SVN revision. Make a copy of this method and modify it to > point at your own code, telling you the version of your clients SVN > checkout. The second

Re: FreeBSD 6.2 trouble using postgresql_psycopg2

2009-02-09 Thread James Bennett
On Mon, Feb 9, 2009 at 7:38 AM, rihad wrote: > This is no surprise, as django always attempts to install databases/py- > psycopg, and not databases/py-psycopg2, since the former is hardcoded > in its port Makefile. Any ideas? Django's documentation lists all available values for the DATABASE_ENG

Re: Changing Image in admin deletes the rest - expected behaviour?

2009-02-09 Thread James Bennett
On Mon, Feb 9, 2009 at 6:39 AM, phoebebright wrote: > In admin, if I change the content of one pic it blanks the rest. Is > this expected behaviour? Generally, when you think you've found a bug, searching the Django bug tracker will turn up useful information, as in this case: http://code.djan

Re: Documentation for Download?

2009-02-11 Thread James Bennett
On Wed, Feb 11, 2009 at 9:01 PM, Tim Johnson wrote: > I installed from the tarball, and I see the docs directory beneath the > initially extracted directory and a makefile. So now my questions is: > What is Sphinx and where do I get it? The documentation covers this: http://docs.djangoproject.

Re: How to set the right PostGIS path to PostgreSQL 'share' directory

2009-02-13 Thread James Bennett
On Fri, Feb 13, 2009 at 3:32 AM, Rhoel_in_Asia wrote: > > Also, when the ./confure does run, it stops with the error > > checking for iconv.h... yes > checking build system type... i686-pc-linux-gnu > checking host system type... i686-pc-linux-gnu > checking for pg_config... /usr/bin/pg_config >

Re: blank=True on Char/TextFields

2009-02-13 Thread James Bennett
On Fri, Feb 13, 2009 at 6:31 AM, Lee Braiden wrote: > What exactly is the reasoning behind this advice? It seems to me that > one would very rarely want to store an empty string. For example, if > a user doesn't enter a surname, that does not mean that their surname > is "", unless they're Cher

Re: Exceptions and SET client_encoding to 'UNICODE'

2009-02-14 Thread James Bennett
Everything is happening in a Postgres transaction; at the first error the transaction aborts and you must issue a ROLLBACK to the DB before continuing. Consult Django's transaction dogs for information on how to do this. On 2/14/09, 83...@gmx.de <83...@gmx.de> wrote: > > Hi Folks, > > I'd like t

Re: 1.0 branch?

2009-02-17 Thread James Bennett
On Tue, Feb 17, 2009 at 11:54 PM, Lloyd Budd wrote: > Super minor suggestion, it looks like trunk is where 1.1 work is > happening, for maintaining my own project using 1.0 it might be handy > if there was django/branches/1.0/ . That way I could just do a check > out there and svn up if/when nece

Re: broken url error in admin

2009-02-21 Thread James Bennett
On Sat, Feb 21, 2009 at 11:52 PM, Jlcarroll wrote: > What is the best way to fix this? What if someone wants to enter a > broken url in an admin page? What if the url isn't broken, just > requires a login? Please read the documentation for URLField, which explains how to control this validation

Django 1.1 alpha 1 released

2009-02-23 Thread James Bennett
As we run up to Django 1.1 (due in April), we've started the process of alpha and beta preview packages with Django 1.1 alpha 1, released tonight. As always, alpha and beta packages are *not* for production use, but if you'd like to try out the new features or go bug-hunting in a safe environment,

Re: Problems specifying fields for admin inline

2009-02-25 Thread James Bennett
On Thu, Feb 26, 2009 at 2:30 AM, jeff wrote: > Wow, that's much simpler. They should list that option on the admin > documentation page. Many thanks! http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-options "The InlineModelAdmin class is a subclass of ModelAdmin so it in

Re: Serious Sessions Flaw/Bug/Error Discovered

2009-02-28 Thread James Bennett
On Sun, Mar 1, 2009 at 2:21 AM, James Mowery wrote: > This code fails to work properly. There are numerous issues with even > this example, and I could probably simply the code further, but here > are some of the errors: Note that the subject of this message is misleading; if there were such ser

Re: Why do some shared hosting providers support Django and others don't?

2009-03-02 Thread James Bennett
On Mon, Mar 2, 2009 at 6:25 PM, Wiiboy wrote: > I'm with a shared hosting company called Lunarpages.  They tell me > Django, by itself, even with Fast CGI, because it is a framework, is > too resource intensive for them to allow.  But many other shared > hosting providers allow Django.  So, how d

Re: continuously gathering feeds

2009-03-08 Thread James Bennett
On Sun, Mar 8, 2009 at 9:08 PM, adelevie wrote: > I am building an app that uses the python-twitter module (a python > library for twitter's api). I want to gather data from the public > timeline which is updated about every minute. I have a function that > given a feed will store it in the db. W

Re: Does Django 1.1 support mulitple primary_key ?

2009-03-09 Thread James Bennett
On Mon, Mar 9, 2009 at 4:47 AM, K*K wrote: > Because the > requirements wrote all of database code should implemented with ORM > code and can not use RAW SQL, and the interactive designer do not want > to make concession. The person responsible for this decision should be fired, incidentally: te

Re: rank newbie - working thru 2.0 Book- basic template Tags give 'syntax error' on {%

2009-03-10 Thread James Bennett
On Tue, Mar 10, 2009 at 1:58 PM, Jonquille wrote: > What am I missing please, and thank you. You're missing the idea that templates are not Python code and are not typed at a Python prompt -- they're placed in template files and templates are loaded and rendered according to the documentation.

Re: Django-Registration help

2009-03-13 Thread James Bennett
On Fri, Mar 13, 2009 at 5:02 AM, Bastien wrote: > I will answer my own question since I found the answer, may be it can > help someone: Unfortunately you found the wrong answer; if you're making changes to the code that came with django-registration, you're doin' it wrong. The "register" view t

Re: sandbox install of Django?

2009-03-18 Thread James Bennett
On Wed, Mar 18, 2009 at 3:00 PM, bob wrote: > Is there an option to install Django into a sandbox area, and if so, > would it work? Python's distutils module is configurable in a variety of ways, including where it puts the packages it installs. You can use either one-off command-line options to

Re: Sort of OT on the django book

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 1:55 AM, Gour wrote: > Don't ask this question. I asked him on #django (several times), and > found out that such sort of inquiry is not very welcome ;) Well, what's not welcome is being asked the same question over and over again when the publication date's listed on the

Re: Value proposition of Rails

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 2:17 AM, Torsten Bronger wrote: > I've always wondered why anybody uses something non-Java for Web > applications.  Given that Java is faster than PHP, Python etc., this > also means that you need less computing power in your server farm. > On the long run, this should *al

Re: Value proposition of Rails

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 2:35 AM, Torsten Bronger wrote: > I think is *is* a nightmare to maintain.  At least, Jva and PHP play > in the same league of maintainability, whereas assembly is *far* > away from that. OK, then, why not write everything in C? Hard to get faster than C without doing ass

Re: Value proposition of Rails

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 2:53 AM, Torsten Bronger wrote: > Okay, C.  Well, most of the library and framework stuff is missing > but I assume that this could be done, given that the financial > benefit is there.  But actually I still don't get your analogy. You asked, basically, "since Java is fas

Re: Installing Django for rapidsms

2009-03-21 Thread James Bennett
On Sat, Mar 21, 2009 at 2:07 PM, dbbarua wrote: > Hi , >    I am trying to use Django for rapidsms , i get the following error > when i run > r...@portable:/usr/local/rapidsms-dev/rapidsms/rapidsms# python > manage.py syncdb ...snip... > TypeError: __init__() got an unexpected keyword argument

Re: cannot import name ugettext

2009-03-23 Thread James Bennett
On Mon, Mar 23, 2009 at 4:43 AM, dbbarua wrote: > It works with Django-1.0 and gives me the site ...but some fields are > not enabled in the website...is that related to django or the rapidsms > code? I'd very strongly suggest that you contact the developers of the application you're using,

Re: IBM Dataservers backend support in Django application Framework.

2009-06-19 Thread James Bennett
> Feedback/Suggestions/Issues > > You can provide us feedback/suggestions, or report a bug/defect, or > ask for help by using any of the following channels: > 1. Mailing us at open...@us.ibm.com > 2. Opening a new issue at http://code.google.com/p/ibm-d

Re: Why why why not write a search module for Django user?

2009-06-19 Thread James Bennett
On Fri, Jun 19, 2009 at 6:49 PM, poop wrote: > It is not, but it is not much of a web application framework if it > doesn't already have a rich set of tools to work with. It does. Of course, your issue seems to be not that Django lacks certain tools, but that it doesn't already provide every tool

Re: Permissions

2009-06-19 Thread James Bennett
On Fri, Jun 19, 2009 at 6:35 PM, poop wrote: > Basically, I have a small CMS/publishing web app I have been working > on for a few weeks.  It is coming together nicely (though getting > LaTeX to play nice took longer than I expected).  Anyway, there is a > notion of a "published" article, a "draft

Re: Extending Django User model using add_to_class()

2009-06-22 Thread James Bennett
On Mon, Jun 22, 2009 at 4:01 PM, pr wrote: > Is it a good way to extend Django User model using add_to_class()? > I have to add only two extra fields to the User model and I think that > using Profile Model to do this is unnecessary. No, it's a very bad method. Consider what happens if two people

Re: Extending Django User model using add_to_class()

2009-06-22 Thread James Bennett
On Mon, Jun 22, 2009 at 5:30 PM, pr wrote: > Yes, I know what you mean, but It's small project with one programmer. > I want to know about speed and stability in production mode above > rules of 'programming-tao' :-) Well, there's also the fact that: 1. Using a profile means relying on documente

Re: psycopyg setup error: no build_ext

2009-06-23 Thread James Bennett
On Tue, Jun 23, 2009 at 2:33 PM, James Martin wrote: > I was never able to get psycopg2 to compile on osx I recommend > using sqlite for development or another database.  If you must use > psycopg2, you may want to try to get it through something like > darwinports. I've gotten it to compile

Re: Mysql->postgres migration. Now id not auto incrementing/being added at all

2009-06-28 Thread James Bennett
On Sun, Jun 28, 2009 at 3:56 PM, Wayne Koorts wrote: > In your case you'll probably have to drop the id columns and recreate > them.  I'm not sure how Postgres will deal with adding a serial column > to an existing table, but see how it goes (make backups first of > course). It works fine. The on

Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread James Bennett
On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones wrote: > What is the python Magic going on here to make this possible? So, you want to read up on how Python descriptors work. One application of a descriptor is the ability to create something which behaves like a "normal" attribute, but under the hoo

Re: Any way to save the output of a template filter to another variable?

2009-07-08 Thread James Bennett
On Wed, Jul 8, 2009 at 7:01 AM, Adam Stein wrote: > In my specific example, I would like to save the output value from the > 'length' template filter so that I can send it to the 'expr' tag (expr > is a tag that allows you to effectively execute python statements and > save the result to another t

Re: Model methods remember parameters?

2009-07-08 Thread James Bennett
On Wed, Jul 8, 2009 at 5:04 PM, derefed wrote: > How is it that the method's local variables are being remembered? My > problem is solved by clearing the list at the end of the method, but > I'd like to know why it acts like this is the first place. This is a common thing encountered by new Pytho

Re: Fresh project, tests fail?

2009-07-12 Thread James Bennett
On Sun, Jul 12, 2009 at 6:17 AM, Tim Chase wrote: > I didn't notice anything in the testing docs[2] that warns about > this, and the tutorial adds django.contrib.admin but elides the > detail that omitting the admin (described as optional[3]) causes > test failure. I tend to view it a bit differe

Re: passing request.user.id to a template tag

2009-07-16 Thread James Bennett
On Thu, Jul 16, 2009 at 11:01 PM, Kenneth Gonsalves wrote: > how do I pass request.user.id to a templatetag. if I do: > > {% get_menu request.user.id %} > > the string 'request..user.id' gets passed. You handle this by using the standard variable-resolution mechanism inside your tag's Node subcla

Re: model name ending with an 's'

2009-07-18 Thread James Bennett
Also, just as a general bit of style advice: the usual convention is that a model name should be the singular form. For more information, consult: http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style http://www.python.org/dev/peps/pep-0008/ -- "Bureaucrat Conrad, you are

Re: django-registration .missing templates?

2009-07-20 Thread James Bennett
On Mon, Jul 20, 2009 at 9:10 AM, zayatzz wrote: > If you are going to test django registration, then remember, that it > sends info by email with activation key. I had to turn that off, > because i could not find free SMTP server and my ISP is blocking ports > used by my own SMTP server. If sendin

Django 1.1 release candidate now available

2009-07-21 Thread James Bennett
Hi folks! Tonight we've pushed out the Django 1.1 release candidate, which is hopefully the last stepping-stone to the final 1.1 release. If you'd like to try it out, here's where you'll want to look: * Download instructions: http://www.djangoproject.com/download/ * Release notes: http://docs.dja

Re: Database connection closed after each request?

2009-07-23 Thread James Bennett
On Thu, Jul 23, 2009 at 9:50 PM, Glenn Maynard wrote: > In this case, that's a terrible-performance-by-default approach. > (It's also not a default, but the only behavior, but I'll probably > submit a patch to add a setting for this if I don't hit any major > problems.) Please do a bit more resea

Re: Database connection closed after each request?

2009-07-24 Thread James Bennett
On Fri, Jul 24, 2009 at 1:31 AM, Glenn Maynard wrote: > I see no need for a complex connection pooling service.  You're making > this sound much more complicated than it is, resulting in people > needing to use configurations much more complicated than necessary. Except this is what it turns into

Re: Database connection closed after each request?

2009-07-24 Thread James Bennett
On Fri, Jul 24, 2009 at 7:03 PM, Glenn Maynard wrote: > What I need is sensible, simple and faster, but since someone else > might want to turn it into something complex and unnecessary, it > shouldn't be done? While the specific thing you personally are asking for might not be that much, we can'

Re: Database connection closed after each request?

2009-07-24 Thread James Bennett
On Fri, Jul 24, 2009 at 7:55 PM, Glenn Maynard wrote: > There are lots of requests for ways to build specific types of > queries, too.  You can't really commit a QuerySet method for one thing > and then... So, let's walk through this logically. Suppose we start with a patch which does the sort o

Re: Database connection closed after each request?

2009-07-26 Thread James Bennett
On Sun, Jul 26, 2009 at 9:17 PM, Amitay Dobo wrote: > So to sum up: I vote up connection pooling. Where do I sign up? On some other project's mailing list? Connection pooling doesn't belong in Django. I've outlined one reason for that above. Google a bit for things like "django connection pool"

ANN: Security updates released

2009-07-28 Thread James Bennett
Tonight the Django team has issued two releases related to a security issue reported to us. These releases are Django 1.0.3 and Django 0.96.4. Full information is available on the Django project weblog: http://www.djangoproject.com/weblog/2009/jul/28/security/ These releases are strongly recomm

ANN: Django 1.1 released!

2009-07-28 Thread James Bennett
Tonight we're extremely proud to announce the release of Django 1.1, the latest major milestone in Django's development. To learn about the new release: * Blog post: http://www.djangoproject.com/weblog/2009/jul/29/1-point-1/ * Release notes: http://docs.djangoproject.com/en/dev/releases/1.1/ * D

Re: Django file upload. 'None'

2009-08-04 Thread James Bennett
On Tue, Aug 4, 2009 at 7:08 AM, Martje wrote: > This seem ok, since I only used field 3 and 1. But when I look at > request.FILES, I get: > > > > It shouldn't be empty, should it? If you've forgotten to set the 'enctype' attribute of the HTML element properly, you won't get any files sent. The

Re: python md5

2009-08-06 Thread James Bennett
On Thu, Aug 6, 2009 at 1:16 PM, Asinox wrote: > Thanks Alex Gaynor :) is working :) It's very important to note that the documentation for this module would have given you the same information. In general, you should be doing your best to read and familiarize yourself with documentation so that y

Re: python md5

2009-08-06 Thread James Bennett
On Thu, Aug 6, 2009 at 7:20 PM, Kenneth Gonsalves wrote: > is it not deprecated? The documentation covers that question, too. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message becaus

Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread James Bennett
On Sat, Aug 8, 2009 at 9:03 PM, strotos wrote: > In my update the "query" variable is added to the list myList, but a u > is appended which seams to be the url of the app, is there a way to > remove this u, or is there a better way to share data like a dict or > list between views? It sounds like

Re: AUTH_PROFILE_MODULE in "Definitive Guide" Second Edition?

2009-08-11 Thread James Bennett
On Tue, Aug 11, 2009 at 7:16 PM, Watts Martin wrote: > I've noticed with some mild consternation that there's absolutely no > documentation for using AUTH_PROFILE_MODULE in the new edition of > _Definitive Guide to Django,_ nor is there any indication of something > else I should be using instead

Re: Class Meta discovery

2009-08-16 Thread James Bennett
On Sun, Aug 16, 2009 at 10:14 PM, aa56280 wrote: > Not sure how well known this is but I thought I'd share seeing as how > it cost me a lot of time and I can't find any discussion of it: This is a well-known aspect of Python which is usually covered by any good introductory Python tutorial. --

Re: django template language issue

2009-08-17 Thread James Bennett
On Mon, Aug 17, 2009 at 5:39 AM, Adonis wrote: > My problem is that even if the 'projects' queryset is empty, it still > includes the projects.html > Is there another way to do it? Consult the documentation: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for-empty -- "Bureaucrat

Re: Possible to use Django & MySQL with Python 2.6?

2009-08-17 Thread James Bennett
On Mon, Aug 17, 2009 at 10:20 AM, Streamweaver wrote: > It works fine for me with Python 2.6 on Linux (with the errors > mentioned above) .  Windows is a bit of a problem as the mysql-python > library doesn't yet support 2.6. Since this has come up several times in different threads recently...

ANN: Django 0.96.5 released

2009-08-19 Thread James Bennett
Due to an issue with a misapplied patch in the recent Django 0.96.4 security release, tonight the Django project has issued Django 0.96.5. Full information is available here: http://www.djangoproject.com/weblog/2009/aug/19/bugfix/ Please note that this will be the *final* release in the Django

Re: request.FILES empty... only with IE!

2009-08-24 Thread James Bennett
On Mon, Aug 24, 2009 at 5:07 AM, OnCEL wrote: > This is a form created dynamically in JS and it contains only a file > input and a submit button (also created dynamically). > The entire form creating code is: I would wonder whether security restrictions in the browser are causing this; I know tha

Re: Django templates have lexical scope!?

2009-08-25 Thread James Bennett
On Tue, Aug 25, 2009 at 9:26 PM, stevedegrace wrote: > I suppose this is easy enough to fix by doing the binding in the view > when the context is first constructed which would probably have been > easier in the first place, but now I'm curious and want to know what's > happening. If you want som

Re: Internationalization in commands (cron usage)

2009-08-26 Thread James Bennett
On Wed, Aug 26, 2009 at 4:03 AM, Tomáš Drenčák wrote: > I'd like to send mass email from custom command which will be called > by cron. Problem is that each email could be in different language. > How can I change actual language so ugettext and template rendering > will return correct localized s

Re: Return custom view depending on user

2009-08-26 Thread James Bennett
On Wed, Aug 26, 2009 at 9:43 AM, Sandra Django wrote: > I have a group, where all users that belongs to this groups only can access > to a form, and I want that when anyone is logged, go directly to that form, > not to Django view by default. How I can do it? Depending on the group, > return that

Re: Django scalability with files

2009-08-28 Thread James Bennett
On Thu, Aug 27, 2009 at 2:22 PM, Rafael Ferreira wrote: > The queue idea is a good one, and you can use Gearman to do that really > easily. Another, even simpler, way to handle this is to use some kind of > shared NFS mount for the storage. All things being equal, scaling a filer or > SAN will be

Re: Problem with content type creation order and data recovery scheme

2009-09-04 Thread James Bennett
On Fri, Sep 4, 2009 at 7:35 AM, Joshua Russo wrote: > The reason I was looking at the dump data instead of a MySQL backup is > because it was more obvious to automate. I'm going to take a closer look at > the MySQL backup though. I run on PostgreSQL rather than MySQL, but for what it's worth my b

Re: What is the best way to extend the User Model

2009-04-04 Thread James Bennett
On Fri, Apr 3, 2009 at 1:17 PM, Dave Fowler wrote: > Great, thanks guys!  Just wanted to make sure I wasn't missing > anything. If some new 'official' method appeared, the documentation would update to reflect that: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-informatio

Re: .96 Tutorial maxlength/max_length confusion.

2009-04-07 Thread James Bennett
On Tue, Apr 7, 2009 at 9:33 AM, garyrob wrote: > I'm doing the .96 tutorial because my company is using version 96.1 > for now. Well, first things first, you should upgrade both yourself and your company to 0.96.3, because there have been security updates in the 0.96 series. > TypeError: __init

Re: registration and profile must save at a time

2009-04-08 Thread James Bennett
On Thu, Apr 9, 2009 at 12:27 AM, Praveen wrote: > Thank you so much Malcolm but to display extra fields on sign up we > will have to customize the django.contric.auth.forms then that form is > generated from the user models i am so much confused whether i will > have to add extra field in user mo

Re: trying to use the aggregate functions

2009-04-10 Thread James Bennett
On Fri, Apr 10, 2009 at 4:05 AM, chris wrote: > So I want to find out how many characters do occur in which edition > and I get the result as expected.  However, instead of the edition > objects, what I get back are the pk values of the edition. This is expected behavior; when you use values() y

Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread James Bennett
On Sat, Apr 11, 2009 at 5:13 PM, codecowboy wrote: > I've followed some examples from around the Django community and that > is why I use the reverse() method at all.  What is the point of using > the reverse() method? Well, there's a problem you'll run into fairly often. Suppose, for example,

Re: Question about administration

2009-04-12 Thread James Bennett
On Sun, Apr 12, 2009 at 9:31 PM, Joshua Williams wrote: > That was the nugget I was looking for.  I think that my use case falls > into the latter, which is currently not available.  Good news is, as > long as i only support 1 "working area" i should be ok. It's true that there's no "push this b

Re: How do you retrieve a username that is not in the URL?

2009-04-14 Thread James Bennett
On Tue, Apr 14, 2009 at 5:12 PM, stkpoi wrote: >    if form.is_valid(): >      submission = Submission.objects.get_or_create( >      title=form['title'], >      link=form['link'], >      user=request.user.username >      ) And right there's your problem. The value to put into a ForeignKey is the

Re: Random Syntax Errors on Download

2009-04-14 Thread James Bennett
On Tue, Apr 14, 2009 at 11:59 AM, AliasXNeo wrote: > The problem is intriguing, and I attempted to download and install the > official release 3 more times and then proceeded to get the latest > develepor release from SVN only to get the same exact problem. I'm > running the latest version of Pyt

Re: Authenication for django.views.generic Views

2009-04-17 Thread James Bennett
On Thu, Apr 16, 2009 at 3:04 PM, Col Wilson wrote: > Thanks all. I have some reading to do, but I have also noticed in the > meantime that generic views docs (http://docs.djangoproject.com/en/dev/ > ref/generic-views/#ref-generic-views) have a hook into the auth > system. Look for 'login_required

Re: Webpy vs Django [and how to ask questions the smart way]

2009-04-22 Thread James Bennett
On Wed, Apr 22, 2009 at 3:04 PM, Phil Mocek wrote: > That depends on how you look at things.  I've been referencing Eric S. > Raymond's essay, "How to Ask Questions the Smart Way" [2], on this list > recently, because I'm not used to such poorly-worded or lazy questions > being asked on a technic

Re: auth.contrib silently catching TypeError. Bug?

2009-04-22 Thread James Bennett
On Mon, Apr 20, 2009 at 4:20 AM, Tamas Szabo wrote: > As you can see the code catches and silently ignores all TypeError exceptions: > The problems with this approach are: >    - Why not fail as early as possible if one of the authentication > backends configured in settings.py has a wrong signat

Re: how to handle database down time gracefully?

2009-04-24 Thread James Bennett
On Fri, Apr 24, 2009 at 7:51 AM, realfun wrote: > I build a website(fayaa.com) on Bluehost using Django, but this month > database down 3 times, during that period, user can only see an > "Unexpected Exception" message, is there a way to redirect to a 404 > page instead? If you don't mind doing

Re: Django DB strange behavior

2009-04-25 Thread James Bennett
On Sat, Apr 25, 2009 at 5:07 AM, Aaron Lee wrote: > So is there some InnoDB specific thing in Django that does some "smart" > caching? Unless you explicitly enable Django's caching system, and explicitly make use of it, Django does no caching of any sort whatsoever. Personally I would suspect t

Re: What Postgresql driver does Django use? Async API?

2009-04-25 Thread James Bennett
On Sat, Apr 25, 2009 at 7:37 AM, Continuation wrote: > What Postgresql driver does Django use? This question is answered by Django's documentation, which covers the database adapter modules used by each of the built-in database backends. > And does it support the async API ( > http://www.postg

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread James Bennett
On Mon, Apr 27, 2009 at 10:49 PM, Tamas Szabo wrote: > I'm new to Python so I might not understand how keyword arguments work, BUT > you do assume that authenticate will always be called with keyword > arguments which isn't true. If you look at how django.contrib.auth.authenticate is implemented

Re: How to deal with problem about ForeignKey

2009-04-29 Thread James Bennett
On Wed, Apr 29, 2009 at 3:59 AM, Daniel Roseman wrote: > You could try defining the foreign key with null=True. >    a = models.ForeignKey(A, null=True) Not really, since there's no support whatsoever for ON DELETE triggers in the ORM. -- "Bureaucrat Conrad, you are technically correct -- the

Re: Email CC List

2009-05-06 Thread James Bennett
On Wed, May 6, 2009 at 8:37 PM, matt barto wrote: > I am a novice django user, and I am curious why there is no ability to > send emails with a CC list?  If there is, how is this done?  The > current documentation only talks about a Bcc list which is not what I > want. Django provides a couple o

Re: Run context processor conditionally?

2009-05-07 Thread James Bennett
On Thu, May 7, 2009 at 2:44 AM, Jani Tiainen wrote: > How you do that? Everywhere I look, documentation states that view is a > "function" (well there is few places where is mentioned "callable"). You may want to consult some Python documentation; writing a class whose instances are callable is

Re: How to disable deletion af a model instance

2009-05-09 Thread James Bennett
On Sat, May 9, 2009 at 7:49 PM, George Song wrote: > I think if you want to know definitively if your `delete()` method is > being called or not, your debug statement should go in that method. I > wouldn't be surprised if Django is sending pre and post delete signals > even during bulk deletion.

Re: How do I execute a python module within the context of a Django project?

2009-05-09 Thread James Bennett
On Sat, May 9, 2009 at 9:52 PM, Roberto Cea wrote: > Here's a fairly basic question: how do I execute an arbitrary python > module within the context of a given Django project, with access to > its models, etc.? Currently, I load it from a "manage.py shell" > session, but I'm sure there's a more

Re: environment variable DJANGO_SETTINGS_MODULE is undefined

2009-05-11 Thread James Bennett
On Mon, May 11, 2009 at 9:45 AM, bconnors wrote: > there must be something I don't have. do i have to install something? You seem to be in need of a basic Python tutorial, one which will teach you about things like how to import modules before using them (because, for example, you seem to be hun

<    1   2   3   4   5   6   7   8   9   10   >