Re: Django's documention is horrible

2011-01-10 Thread James Bennett
On Tue, Jan 11, 2011 at 12:44 AM, Sam Lai  wrote:
> This isn't about patches to the existing docs (which are great for
> their purpose). It is about Django missing an API reference manual,
> something like .NET Class Library Reference
> (http://msdn.microsoft.com/en-us/library/gg145045.aspx), PHP's
> Function Reference (http://www.php.net/manual/en/funcref.php) or
> Java's (rather hideous looking) API reference
> (http://download.oracle.com/javase/6/docs/api/).

I've already addressed this point politely, so perhaps it's time to
turn it up a notch:

If your computer is incapable of running pydoc, epydoc or other
similar scripts, how is it simultaneously able to run Django?

Or, not quite so snarkily:

If your computer *is* capable of running pydoc, epydoc, etc., why
aren't you using those tools? And if you're not using them now, why
should I believe you'll make use of epydoc-generated API references if
someone else generates them for you?

(OK, so that was pretty snarky, but I think it's a valid question to ask)

> P.S. what's the short answer to why the current Django docs aren't on
> a wiki site instead of being versioned inside SVN?


There's already a wiki on code.djangoproject.com; it's part of Trac.
If you think wikified documentation would be a good idea, you should
feel free to start putting some up there.

What you'll find pretty quickly, though, is that there's a good reason
why the official docs live in the repo and are maintained by the core
team rather than being on a community-edited wiki: the wiki is where
useful things go to die. It's full of half-baked solutions, code that
only (maybe) runs on Django 0.96, etc., etc., because the nature of a
wiki doesn't really encourage people to make long-term maintenance
commitments. Those of us who have commit bits *have* made such
commitments, and incidentally do a lot more than just committing
documentation patches as they come in; for anything bigger than a typo
fix, there's almost always heavy editing going on for style,
consistency, readability and a bunch of other factors that a wiki can
only manage at the cost of massive bureaucracy and high barrier to
entry (it's no coincidence that Wikipedia is notoriously hard to edit
successfully -- I'm pretty sure they have more documentation on
policies than we have documentation, period).



-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
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: Django's documention is horrible

2011-01-10 Thread Kenneth Gonsalves
On Mon, 2011-01-10 at 22:25 +0100, Simon W wrote:
> Am I the only one who frown upon this?

the documentation is excellent - structure needs revamping as it is very
difficult to find any thing unless one knows the key words. It was far
better uptil circa .96. I have been working on a small scheme on how to
structure it better - because I know how busy the devs are here, I
refrained from criticising without giving a possible solution.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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: Configure LAMPP with Django

2011-01-10 Thread Kenneth Gonsalves
On Mon, 2011-01-10 at 11:12 -0500, Javier Guerra Giraldez wrote:
> Django is not a page-based template system like PHP.  it's a
> long-running application that answers web requests. 

I do not think it is a long running application
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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: Django's documention is horrible

2011-01-10 Thread Sam Lai
On 11 January 2011 13:39, Christophe Pettus  wrote:
>
> On Jan 10, 2011, at 1:25 PM, Simon W wrote:
>
>> For such a good web framework it's a shame that the documention is not 
>> structured well .. at all.
>
> I have no doubt that the project would be more than receptive to doc patches 
> to fix the problem.

This isn't about patches to the existing docs (which are great for
their purpose). It is about Django missing an API reference manual,
something like .NET Class Library Reference
(http://msdn.microsoft.com/en-us/library/gg145045.aspx), PHP's
Function Reference (http://www.php.net/manual/en/funcref.php) or
Java's (rather hideous looking) API reference
(http://download.oracle.com/javase/6/docs/api/).

I'm glad someone brought this up (although 'horrible' seems like too
strong a word). I miss not having these docs in some online form
because once you know enough about Django, you often know that Django
has capability x but you don't remember what class/namespace it is in.
You end up having to google and spend a while locating the info in the
existing docs. Browsing or grepping the code isn't much better (maybe
I'm missing an app or two here).

API docs also tend to be more structured and concise so you can
instantly see what parameters take what, what exceptions might be
thrown, what the return value is/represents etc.

Right now, I almost always have a browser tab open to
code.djangoproject.com for this purpose.

Talk/ideas are cheap, so here's my take on possible API docs for Django -

An API reference site structured in a similar manner to the above
examples, with the ability to easily search; integrated pydocs; links
to relevant sections of the Django docs; a link to see the code of the
function/class/method etc. A wiki-style section for each page would be
nice too to document caveats, tips, tricks, relevant snippets etc.

Of course the dynamic nature of the code makes this harder to do and
will probably require some human intervention to ensure an entry
exists for every parameter, mapped method etc.



P.S. what's the short answer to why the current Django docs aren't on
a wiki site instead of being versioned inside SVN?

There are some minor clarifications here and there that I'd like to
add, but the overhead of producing a patch, creating a ticket,
flagging down a committer, getting a consensus, and finally having the
patch committed is a bit off-putting. I can understand the process for
code, but it just seems a bit over-the-top for docs. Maybe a
compromise would be adding something like the per-paragraph comments
that The Django Book site has; that way the docs stay official, yet
there's still a way for users to add to them.

> --
> -- Christophe Pettus
>   x...@thebuild.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.



Re: Mailing Lists Vs. Forums

2011-01-10 Thread Torsten Bronger
Hallöchen!

Kevin Monceaux writes:

> [...]
>
> My main complaint about Google Groups is that I can't download
> message archives when I join a group.

You can ready it as a newsgroup through Gmane.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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.



Re: Django's documention is horrible

2011-01-10 Thread Christophe Pettus

On Jan 10, 2011, at 1:25 PM, Simon W wrote:

> For such a good web framework it's a shame that the documention is not 
> structured well .. at all.

I have no doubt that the project would be more than receptive to doc patches to 
fix the problem.

--
-- Christophe Pettus
   x...@thebuild.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.



Re: image servers?

2011-01-10 Thread Dustin
I haven't used Rackspace, but i would assume (hope) they support
remote mounting.

I would use sshfs to mount the Rackspace server on your local drive
(on the Django server) and reference that in MEDIA_ROOT

e.g.

sshfs usern...@my.rackspace.domain:/path/to/rackspace/home/dir /mnt/
rackspace

change MEDIA_ROOT to

MEDIA_ROOT = '/mnt/rackspace/'

and MEDIA_URL

MEDIA_URL = 'my.rackspace.domain'

On Jan 10, 6:55 pm, garagefan  wrote:
> so i bit the hype and got myself a rackspace cloud account. i also got
> a rackspace file account for image serving. i would like to write
> something that overrides where all images are saved, regardless of the
> model that requests the save.
>
> what would this be? would i make this a middleware? I assume i need to
> extend and "replace" the default "save file to MEDIA_ROOT directory"
>
> i havent had to extend or replace django's default behavior, so before
> i start digging in to this, i need to know the best place for this...
> which, i assume would be middleware. yes?
>
> thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Django and PIL problem?

2011-01-10 Thread Martin Ostrovsky
What's the value of form.cleaned_data['image']? That IOError is
usually thrown when the contents of what you pass in to open() don't
constitute a valid image.

On Jan 10, 5:26 pm, atcive  wrote:
> I have the same problem:/
> Anyone cah help?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



Database Table Locks/unlocks (for reading, writing or both)

2011-01-10 Thread Jagdeep Singh Malhi
Hi..

Is Django automatically done the table locking /unlocking concept in
case of Mysql/PostGreSQL?

if not how I done this manually?

-- 
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: Mailing Lists Vs. Forums (Was: Django's documention is horrible)

2011-01-10 Thread Kevin Monceaux
On Tue, Jan 11, 2011 at 07:51:55AM +0800, Russell Keith-Magee wrote:
 
> I am yet to meet an online forum interface that doesn't make me want
> to gouge my own eyes out. For my money, email is a vastly preferable
> interface in almost every respect. Google's Groups could certainly
> do with some work, but it's a lot more serviceable than any forum
> interface I've ever used.

I couldn't agree with you more.  I never do well keeping up with
online forums, but I'm on umpteen mailing lists.  My local mail
archives serve me well.  

My main complaint about Google Groups is that I can't download message
archives when I join a group.  That option is available with most
Mailman based mailing lists, and I've even found a script for
downloading Yahoo Groups message archives.  My local archive of this
mailing list only goes back to 2009.  I'd love to have the full
archive of this list at my fingertips.


-- 

Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

What's the definition of a legacy system?  One that works! 
Errare humanum est, ignoscere caninum.

-- 
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: Django's documention is horrible

2011-01-10 Thread Javier Guerra Giraldez
On Mon, Jan 10, 2011 at 6:51 PM, Russell Keith-Magee
 wrote:
> I am yet to meet an online forum interface that doesn't make me want
> to gouge my own eyes out. For my money, email is a vastly preferable
> interface in almost every respect.

wholeheartedly agree.  (and i'm sure not to be the only one)

-- 
Javier

-- 
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: Configure LAMPP with Django

2011-01-10 Thread kRON
I wager that Javier already has the best possible answer, but,
nonetheless, I'll try to elaborate it a just a bit more.

When a client requests a resource from your Web server that's handled
by PHP, what happens is that an instance of PHP is fired that
initializes the request data in the globals (like $_POST, $_SERVER)
and sequentially creates a flattened view of your Web application code
necessary to handle that request.

Take PHP MVC frameworks as a good example. All of your requests (like
'/user/evstevemd/') get rewritten to `index.php?r=/user/evstevemd/`.
`index.php` includes a certain `routing.php` that then figures out
that all requests beginning with `/user/` are handled by a controller
that resides somewhere in `users/controllers.php` and so it includes
that, the code there includes something else and so forth until
there's no more code to execute. The fact remains that you also had
several dozens of other PHP files that were never executed, because
that code was never needed to process the particular request that was
received.

Django is a bit different, but that actually has everything do with
the nature of executing Python applications. To process requests that
Django needs to handle, your Web server will actually be communicating
with an instance of a Python interpreter, through the WSGI protocol.
WSGI is just a very small standard that practically says: because
every Web server that accepts HTTP requests has the liberty of
constructing and processing request data to their preferences, this is
the interface that defines how those requests should be passed to a
Python Web application.

Configuring PHP with your Web server is straightforward and it just
works OOTB instantaneously for all your PHP files. Although it's
execution model is simple and popular, if you acknowledge the
drawbacks there's a lot more to benefit from communicating with a long-
running Python process. First off the top is that after initialization
everything is already loaded into the memory, everything is
precomputed for future requests (such as URL routing) and all the
necessary connections to other parts of the system are created, so
subsequent requests become very cheap and are processed "blazingly"
fast.

I'm not an expert on the topic, but if you already have a LAMP stack,
what I'd do is set up nginx as a reverse proxy (approx. 30-ish lines
of code that's hard to get wrong) to your Apache Web server and a WSGI
server. You get the added benefit of not having to recompile/
reconfigure your Apache instance with mod_wsgi (which can easily be
misconfigured) and you can use a Python WSGI server such a Gunicorn or
Spawning that is more Pythonic (i.e. it works and understands Python
code better than mod_wsgi) to handle your Django Web applications.



On Jan 10, 5:17 pm, Thomas  wrote:
> Am 10.01.2011 um 16:56 schrieb evstevemd:
>
> > I have LAMPP on Ubuntu and I use it fine with PHP. Now I have to add
> > Django so that I can do PHP and Django projects together. I will have
> > more than one Django project. I have read of mod_wsgi but I cannot
> > understand.
>
> what exactly is the problem?
>
> I found these explanations 
> helpful:http://code.google.com/p/modwsgi/wiki/IntegrationWithDjangohttp://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django...
>
> good luck
>
> > In PHP I just put my project as subdirectory of /var/www/
> > and then access them viahttp://localhost/
> > How do I do with Django?
> > Thanks a lot!
>
> > --
> > 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 
> > athttp://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.



Re: Reference Form

2011-01-10 Thread Daniel Corbe
i will try

On 10 January 2011 17:22, Michael  wrote:

> I believe a bound field contains a property pointing to it's form, so
> you'd do something like:
>
> field1.form.field2
>
> --
> Michael 
>
> On Mon, 2011-01-10 at 17:03 -0200, Daniel Corbe wrote:
> > Hi,
> >   How to get reference of one field form from another field form when
> > both are in same form?
> >
> > --
> > Daniel Corbe Hahne Latorre
> > dan...@corbe.com.br
> > 55 48 9618-5115
> > skype: daniel_corbe
> >
> >
> >
> > --
> > 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.
>
>


-- 
Daniel Corbe Hahne Latorre
dan...@corbe.com.br
55 48 9618-5115
skype: daniel_corbe

-- 
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.



image servers?

2011-01-10 Thread garagefan
so i bit the hype and got myself a rackspace cloud account. i also got
a rackspace file account for image serving. i would like to write
something that overrides where all images are saved, regardless of the
model that requests the save.

what would this be? would i make this a middleware? I assume i need to
extend and "replace" the default "save file to MEDIA_ROOT directory"

i havent had to extend or replace django's default behavior, so before
i start digging in to this, i need to know the best place for this...
which, i assume would be middleware. yes?

thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Django's documention is horrible

2011-01-10 Thread Russell Keith-Magee
On Tue, Jan 11, 2011 at 5:49 AM, mrmclovin  wrote:
> Im just curious
> why the django project haven't set up any proper forum?

I'll address this one.

I am yet to meet an online forum interface that doesn't make me want
to gouge my own eyes out. For my money, email is a vastly preferable
interface in almost every respect. Google's Groups could certainly do
with some work, but it's a lot more serviceable than any forum
interface I've ever used.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Django's documention is horrible

2011-01-10 Thread James Bennett
On Mon, Jan 10, 2011 at 3:25 PM, Simon W  wrote:
> For such a good web framework it's a shame that the documention is not
> structured well .. at all. It consists of massive text put on a page with
> some random examples. But examples is all there is. In other languages and
> frameworks I'm used to have at least a well structed API documention listing
> all methods and members of classes with some comment attached to them. They
> also show the class heirachy, quick and simple. I spend more time searching
> for minor stuff in the documention than writing code. The django project
> should look into doxygen or some similar doc generator.

The way I see it, there are two types of documentation:

1. Documentation which must be written by human beings.

2. Documentation which can be generated automatically by software.

The documentation you'll find on docs.djangoproject.com is the first
type. It consists, in large part, of things people want to know about
Django but which can't be worked out automatically by a piece of
software scanning over the code and docstrings. Much of this is in the
form of how-to documents, broad overviews, tutorials, etc. which walk
you through some feature and provide example code for common use
cases; this sort of documentation can only be produced by human beings
who know Django fairly well and put in the time and effort to write.

The second type of documentation seems to be what you're looking for.
Things like big lists of classes and members with docstrings are
useful, certainly, but they're not something which requires human
effort to produce; as others in the thread have pointed out, there are
quite a few good tools for Python which will scan over a codebase and
spit out this information into the output format of your choice. And
since this type of documentation can be generated by software any time
you need it, there's not a whole lot of utility to putting it up on
the site.

So my recommendation for you would be to look at tools like epydoc,
since they do exactly what you appear to be asking for; meanwhile
we'll keep putting the efforts of the Django dev team into producing
the documentation epydoc can't :)


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
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: Django's documention is horrible

2011-01-10 Thread Shawn Milochik

On Jan 10, 2011, at 5:23 PM, mrmclovin wrote:

> Yes, being part of the community is good. But to base help and
> solutions by ask is not good for documentation IMO. I don't
> like to ask questions because then I have to explain the problem, word
> everything right and then wait for an answer. I prefer to find the
> answer quick on my own and only ask as a last resort and I think many
> people agree with this.

I totally agree with this myself. And there are plenty of resources -- the 
Apress books, the official docs, stack overflow, and all the blogs.

If there's something you're lacking in Django education after availing yourself 
of those things, then being a part of the living community embodied in this 
list and DjangoCon is the best way to keep current and learn the clever 
solutions others have developed for common "problems" that haven't been baked 
into Django proper for whatever reason.

Shawn


-- 
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: Admin ignores null=True in ForeignKey

2011-01-10 Thread Daniel Roseman
On Monday, January 10, 2011 8:22:01 PM UTC, David Walker wrote:
>
> If I create a ForeignKey relationship between two Models with null=True, 
> the Admin seems to still insist on there being a foreign object to link to.
>
> For example, I created a very simple ForeignKey relationship from Things to 
> Types:
>
> from django.db import models
>
> class Type(models.Model):
>   name = models.CharField(max_length=30)
>   
> class Thing(models.Model):
>   type_of_thing = models.ForeignKey(Type, null=True)
>   name = models.CharField(max_length=30)
>
> In the console, I can happily create Type-less Things:
>
> >>> from ni.models import *
> >>> x = Thing()
> >>> x.name = 'Untyped thing'
> >>> x.type = None
> >>> x.save()
> >>> all_things = Thing.objects.all()
> >>> print all_things
> []
> >>> print all_things[0].type_of_thing
> None
>
> In the Admin, however, when I try to add a new Thing, or even edit and save 
> the existing Thing, the type_of_thing field is shown as required and saving 
> without setting it causes "This field is required." to be displayed and 
> the Thing not to be saved.
>
> Am I doing something wrong?
>


Yes - you're not reading the documentation correctly. 
>From http://docs.djangoproject.com/en/1.2/topics/db/models/#field-options :

Note that this [blank] is different than 
null
. 
null
 is 
purely database-related, whereas 
blank
 is 
validation-related. If a field has 
blank=True,
 
validation on Django's admin site will allow entry of an empty value. If a 
field has 
blank=False,
 
the field will be required.


So to allow empty entries in the admin, you need to use "blank=True, 
null=True". 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



Flatten template?

2011-01-10 Thread Danny W. Adair
Hi,
I need to get the template source of a template "after inheritance",
i.e. render just the loader tags "include", "extends" and
"block" (incl. variable block.super), so that I end up with one
independent template which is otherwise unrendered.

Has anyone done this before or has pointers?

I'm still undecided whether to work with Node objects (maybe borrowing
some ideas from http://djangosnippets.org/snippets/769/ ) or just use
regex on the source and manually "glue together".

Any help greatly appreciated.

Cheers,
Danny

-- 
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: Django's documention is horrible

2011-01-10 Thread selman kocael
you can see or check the django book . i think it's
excellent. i am new to django also web, i love django with read it. i want
to write a web site immidiately.

2011/1/10 Shawn Milochik 

> Welcome to the community, and congratulations on putting your best foot
> forward!
>
> I am certain that your non-confrontational tone and obvious appreciation
> for all the hard work done for free by volunteers has endeared you to all of
> us.
>
> One minor suggestion: In the community, we like to see people who identify
> room for improvement step up and volunteer their own time to fix the things
> they want fixed. Do you have any spare time?
>
> Shawn
>
>
> --
> 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.



Re: Django's documention is horrible

2011-01-10 Thread Steven Elliott Jr
Ummm... I think thats the first time I've ever heard anyone say that django's 
documentation sucks. 

Sent from my iPhone

On Jan 10, 2011, at 4:25 PM, Simon W  wrote:

> Hey,
> For such a good web framework it's a shame that the documention is not 
> structured well .. at all. It consists of massive text put on a page with 
> some random examples. But examples is all there is. In other languages and 
> frameworks I'm used to have at least a well structed API documention listing 
> all methods and members of classes with some comment attached to them. They 
> also show the class heirachy, quick and simple. I spend more time searching 
> for minor stuff in the documention than writing code. The django project 
> should look into doxygen or some similar doc generator.
> 
> And this mailing list? It's so hard to find any existing answers quick, 
> google doesn't find none. I mean comon .. look at jQuery, you find what 
> you're looking in less than 2 sec using google. Why isn't there a proper 
> forum?
> 
> Am I the only one who frown upon this?
> 
> Cheers
> -- 
> 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.



Re: Django and PIL problem?

2011-01-10 Thread atcive
I have the same problem:/
Anyone cah help?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Django's documention is horrible

2011-01-10 Thread mrmclovin
Yes, being part of the community is good. But to base help and
solutions by ask is not good for documentation IMO. I don't
like to ask questions because then I have to explain the problem, word
everything right and then wait for an answer. I prefer to find the
answer quick on my own and only ask as a last resort and I think many
people agree with this.

On Jan 10, 11:09 pm, Shawn Milochik  wrote:
> I agree that searching the Google group isn't always the most rewarding. 
> There are many blogs maintained by long-time Django users (and developers), 
> but obviously this is no replacement for a consolidated forum. There is the 
> official wiki as well:http://code.djangoproject.com/wiki/
>
> I don't think there's a phpBB-style form anywhere, such as is used by Ubuntu 
> (and a million others). Maybe it would be a good idea, maybe not. Let's 
> discuss!
>
> One thing that strikes me as a member of this list and someone who tries to 
> keep up with the world of Django is that it's always changing. So a forum 
> thread from six months ago might be outdated. The best way is to become a 
> part of the community, answer and ask questions on this list, and eventually 
> you'll just be steeped in it. That's my best recommendation.
>
> And as multiple others have said as I was composing this, check out the code! 
> It's very readable.
>
> Shawn

-- 
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: Django's documention is horrible

2011-01-10 Thread mrmclovin
I usually end up in that way too. But I don't find it convenient.
There's lots of class relations and going back and forth is clumsy.
Also in most cases Im just after the specification of a class or where
it's defined and it takes longer time if you have to scroll down the
source code as well. Have a look at the API doc of a 3D library called
Ogre3d http://www.ogre3d.org/docs/api/html/annotated.html

Do you see what I mean? Fast, simple, clean and online! Very
convenient!

On Jan 10, 10:53 pm, Sam Walters  wrote:
> Hi,
> My approach with regard to:
>
> > frameworks I'm used to have at least a well structed API documention listing
> > all methods and members of classes with some comment attached to them. They
> > also show the class heirachy, quick and simple.
>
> I just look at the source itself for this.
>
> cheers
>
> sam_w

-- 
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: Django's documention is horrible

2011-01-10 Thread Shawn Milochik
I agree that searching the Google group isn't always the most rewarding. There 
are many blogs maintained by long-time Django users (and developers), but 
obviously this is no replacement for a consolidated forum. There is the 
official wiki as well: http://code.djangoproject.com/wiki/

I don't think there's a phpBB-style form anywhere, such as is used by Ubuntu 
(and a million others). Maybe it would be a good idea, maybe not. Let's discuss!

One thing that strikes me as a member of this list and someone who tries to 
keep up with the world of Django is that it's always changing. So a forum 
thread from six months ago might be outdated. The best way is to become a part 
of the community, answer and ask questions on this list, and eventually you'll 
just be steeped in it. That's my best recommendation.

And as multiple others have said as I was composing this, check out the code! 
It's very readable.

Shawn




-- 
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: Django's documention is horrible

2011-01-10 Thread Javier Guerra Giraldez
On Mon, Jan 10, 2011 at 5:02 PM, Ovnicraft  wrote:
>> I just look at the source itself for this.
>
> or use pydoc

right.

i think what Simon means (but still can't articulate) is the
difference between explanations (which are great in the Django docs)
and references (which aren't so good).

but the right tool for Python code references is pydoc, which _is_
very complete in Django.

maybe it would be a nice gesture to add pydoc's output to the online docs?

-- 
Javier

-- 
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: Django's documention is horrible

2011-01-10 Thread Chris Czub
Yup, that is my approach...

The Django sourcecode is eminently readable and well-organized and most of
it has documentation associated with it.

You can jump into a shell and use the help() command to view API
documentation like you requested.

e.g.

>>> help('django.contrib.auth.models.User')

On Mon, Jan 10, 2011 at 5:02 PM, Ovnicraft  wrote:

>
>
> On Mon, Jan 10, 2011 at 4:53 PM, Sam Walters  wrote:
>
>> Hi,
>> My approach with regard to:
>>
>> > frameworks I'm used to have at least a well structed API documention
>> listing
>> > all methods and members of classes with some comment attached to them.
>> They
>> > also show the class heirachy, quick and simple.
>>
>> I just look at the source itself for this.
>>
>
> or use pydoc
>
>>
>>
>> cheers
>>
>> sam_w
>>
>> --
>> 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.
>>
>>
>
>
> --
> Cristian Salamea
> @ovnicraft
>
>  --
> 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.



Re: IndentationError at /polls/addchoice/

2011-01-10 Thread hank23
Possibly so. I will check. Thanks.

On Jan 10, 3:59 pm, Shawn Milochik  wrote:
> Is there a chance you have a mixture of literal tab characters and spaces? 
> That would do 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-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: Django's documention is horrible

2011-01-10 Thread Ovnicraft
On Mon, Jan 10, 2011 at 4:53 PM, Sam Walters  wrote:

> Hi,
> My approach with regard to:
>
> > frameworks I'm used to have at least a well structed API documention
> listing
> > all methods and members of classes with some comment attached to them.
> They
> > also show the class heirachy, quick and simple.
>
> I just look at the source itself for this.
>

or use pydoc

>
>
> cheers
>
> sam_w
>
> --
> 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.
>
>


-- 
Cristian Salamea
@ovnicraft

-- 
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: Django's documention is horrible

2011-01-10 Thread Sam Walters
Hi,
My approach with regard to:

> frameworks I'm used to have at least a well structed API documention listing
> all methods and members of classes with some comment attached to them. They
> also show the class heirachy, quick and simple.

I just look at the source itself for this.


cheers

sam_w

-- 
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: IndentationError at /polls/addchoice/

2011-01-10 Thread Shawn Milochik
Is there a chance you have a mixture of literal tab characters and spaces? That 
would do 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-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.



IndentationError at /polls/addchoice/

2011-01-10 Thread hank23
I'm getting this error:

IndentationError at /polls/addchoice/
unindent does not match any outer indentation level (views.py, line
125)Request Method: POST
Request URL: http://127.0.0.1:8000/polls/addchoice/
Django Version: 1.2.4
Exception Type: IndentationError
Exception Value: unindent does not match any outer indentation level
(views.py, line 125)
Exception Location: C:\Python27\lib\site-packages\django\utils
\importlib.py in import_module, line 35
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path: ['C:\\Users\\hversemann\\djangoprojects\\mysite', 'C:\
\Python\\Lib', 'C:\\Python\\Lib\\site-packages', 'C:\\Users\\hversemann
\\Desktop\\PythonSourceFiles', 'C:\\Users\\hversemann\\djangoprojects\
\mysite', 'C:\\WINDOWS\\system32\\python27.zip', 'C:\\Python27\\DLLs',
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\
\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']
Server time: Mon, 10 Jan 2011 15:46:45 -0600

and here's the code its referring to(3rd line below - def
countpolls(): ):

def addchoice(request):
message = ""
def countpolls():
pollcount = Poll.objects.all().count()
if pollcount > 0 :
message = "Number of polls passed to form was " +
str(pollcount)
else:
message = "No polls passed in to form."

countpolls()
dctnry = {}

if request.method == "POST":
form = AddChoiceform(request.POST)
if form.is_valid():
pollid = form.cleaned_data['pollquestions']
slctdchoice = form.cleaned_data['newchoice']
if isinstance(pollid, int):
newchoice = Choice(poll=pollid, choice=slctdchoice, 
votes=0)
newchoice.save()
confirmmessage = "Choice: " + slctdchoice + " : has 
been save
for poll: " + str(pollid) + "."
dctnry = { 'form': form, 'infomessage': message,
'confirmmessage': confirmmessage }

else:
form = AddChoiceForm()
dctnry = { 'form': form, 'infomessage': message }

return render_to_response('polls/addchoice.html',
  dctnry,
 
context_instance=RequestContext(request))


I've made some changes to this view so there maybe some problems with
the code as a whole but I'm not sure what it doesn't like about my
indentations. Thanks for the help.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Django and PIL problem?

2011-01-10 Thread galago
I get another strange error - this time only while adding article. In 
editing all is fine.
def save_model(self, request, obj, form, change):

if change == False: 

obj.save()

if ('image' in form.changed_data) or (change == False):

 tmp_file = Image.open(form.cleaned_data['image'])


It gives me an error:

Exception Type: IOError Exception Value:

cannot identify image file 

What is wrong in my code? I checked its type() and it's the same when i edit 
model - I'm confused. Type is the same, but in add method it throws an 
error.  

-- 
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: Django's documention is horrible

2011-01-10 Thread mrmclovin
My apologies, didn't mean to sound like an a-hole. I do appreciate
django very much for what it is. The library is beautiful really, but
the documentation is the opposite.

I wish I could spend time to help improve the documentation, but I
have not the time.

Instead I thought I'd make this (not very well expressed obviously)
complaint to bring it up to developers attention and see if there's
anyone else that thinks that I do.

Im not a beginner when it comes to programming and django was very
easy to learn but as soon as you start developing and want to tweak
stuff it's so hard to get fast detail documentation .. Im just curious
why the django project haven't set up any proper forum?

Again sorry for my unfriendly topicstarter.

On Jan 10, 10:30 pm, Shawn Milochik  wrote:
> Welcome to the community, and congratulations on putting your best foot 
> forward!
>
> I am certain that your non-confrontational tone and obvious appreciation for 
> all the hard work done for free by volunteers has endeared you to all of us.
>
> One minor suggestion: In the community, we like to see people who identify 
> room for improvement step up and volunteer their own time to fix the things 
> they want fixed. Do you have any spare time?
>
> Shawn

-- 
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: Django's documention is horrible

2011-01-10 Thread Shawn Milochik
Welcome to the community, and congratulations on putting your best foot forward!

I am certain that your non-confrontational tone and obvious appreciation for 
all the hard work done for free by volunteers has endeared you to all of us.

One minor suggestion: In the community, we like to see people who identify room 
for improvement step up and volunteer their own time to fix the things they 
want fixed. Do you have any spare time?

Shawn


-- 
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.



Django's documention is horrible

2011-01-10 Thread Simon W
Hey,
For such a good web framework it's a shame that the documention is not
structured well .. at all. It consists of massive text put on a page with
some random examples. But examples is all there is. In other languages and
frameworks I'm used to have at least a well structed API documention listing
all methods and members of classes with some comment attached to them. They
also show the class heirachy, quick and simple. I spend more time searching
for minor stuff in the documention than writing code. The django project
should look into doxygen or some similar doc generator.

And this mailing list? It's so hard to find any existing answers quick,
google doesn't find none. I mean comon .. look at jQuery, you find what
you're looking in less than 2 sec using google. Why isn't there a proper
forum?

Am I the only one who frown upon this?

Cheers

-- 
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.



Benefits of Field Hiding versus Field Disabling

2011-01-10 Thread hank23
Can someone tell me whether hiding a text input formfield is better
than just disabling it and which is easier to implement?

-- 
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.



Admin ignores null=True in ForeignKey

2011-01-10 Thread David Walker
If I create a ForeignKey relationship between two Models with null=True, the
Admin seems to still insist on there being a foreign object to link to.

For example, I created a very simple ForeignKey relationship from Things to
Types:

from django.db import models

class Type(models.Model):
  name = models.CharField(max_length=30)

class Thing(models.Model):
  type_of_thing = models.ForeignKey(Type, null=True)
  name = models.CharField(max_length=30)

In the console, I can happily create Type-less Things:

>>> from ni.models import *
>>> x = Thing()
>>> x.name = 'Untyped thing'
>>> x.type = None
>>> x.save()
>>> all_things = Thing.objects.all()
>>> print all_things
[]
>>> print all_things[0].type_of_thing
None

In the Admin, however, when I try to add a new Thing, or even edit and save
the existing Thing, the type_of_thing field is shown as required and saving
without setting it causes "This field is required." to be displayed and the
Thing not to be saved.

Am I doing something 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-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: Django and PIL problem?

2011-01-10 Thread galago
Thanks. It works great :)

-- 
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: Screen/Form/View Problem?

2011-01-10 Thread Daniel Roseman
On Monday, January 10, 2011 2:56:42 PM UTC, hank23 wrote:
>
> This is my first attempt at trying to code a form and use it in a 
> view, so I've probably got something wrong. At this point I just 
> wanted to produce the screen with all of the fields displayed on it, 
> just to see if I have things coded correctly to display the screen the 
> first time. 
>
> I'm not getting any error but I'm also not getting everything on my 
> screen which I think I should be getting. The screen should display a 
> title, then a message, a dropdown box(pollquestions), a button, and 
> finally another message. At least it should as long as I have my html 
> coded properly. My form is defined this way: 
>
> class AddChoiceForm(forms.Form): 
> infomessage = forms.CharField(max_length=200) 
> pollquestions = 
> forms.ModelChoiceField(queryset=Poll.objects.all(), required=True, 
> label='Poll Questions', initial='Please select a poll question', 
> help_text='Select a poll question.', 
> error_messages={'required': 'Please select a poll question!', 
> 'invalid_choice': 'Cannot select initial value!'}, 
> widget=forms.Select(attrs={'name': 'pollquestions', 
> 'id':'pollquestions', 'size':'1', 'type':'select-one' })) 
> confirmmessage = forms.CharField(max_length=200) 
> newchoice = forms.CharField(max_length=200) 
>
>
> my addchoice.html screen is defined this way: 
>
> Add Poll Choice Screen 
>
>  
> {% csrf_token %} 
>
> {{ infomessage }} 
>
>  
>
> {{ pollquestions }} 
>
>  
>  
>  
>
> {{ confirmmessage }} 
>
>  
>
> and my view is coded this way: 
>
> def addchoice(request): 
> polls = Poll.objects.all() 
> pollcount = Poll.objects.all().count() 
> if pollcount > 0 : 
> message = "Number of polls passed to form was " + str(pollcount) 
> else: 
> message = "No polls passed in to form." 
>
> confirm = "Nothing added." 
>
> data = {'pollquestions': polls, 'infomessage': message, 
> 'confirmmessage': confirm } 
> form = AddChoiceForm(data) 
> dctnry = {'form': form, 'data': data} 
> return render_to_response('polls/addchoice.html', 
>   dctnry, 
>   
> context_instance=RequestContext(request)) 
>
>
> I would appreciate any help or suggestions, for figuring this out. 
> Thanks. 
>

There are a number of things wrong here.

You've got two things called 'pollquestions'. One is a field in the form. 
Since you're passing the form into the template context with the key 'form', 
you access it in the template as {{ form.pollquestions }}. The other thing 
called 'pollquestions' is a list of all the polls in your database. You've 
put that inside a dictionary which you're passing into the context under the 
key 'data', so if you wanted to access that, you'd do {{ data.pollquestions 
}} - or, more likely, you'd want to iterate through with {% for poll in 
data.pollquestions %}. However I suspect you are only interested in the form 
field here.

Similarly, you've got two things called 'infomessage' and 'confirmmessage' - 
one is a field, and one is a string with a message. This time, I suspect you 
are interested in the strings - which again are accessed via {{ 
data.infomessage }} and {{ data.confirmmessage }}. If you don't want the 
user to actually be able to enter these, don't define them as fields in the 
form - you can reference them directly in the template as I have shown.

Next, this line:
   form = AddChoiceForm(data) 
should only be used when you have data posted from the user. Since you're 
not doing that yet, just use
   form = AddChoiceForm()

Finally, you're probably overspecifying the pollquestions field in the form. 
Most of what you have is the default anyway, and other things are invalid: 
for example, you can't specify 'initial' as text, it has to be the ID of one 
of the possible options. Just use:
pollquestions = forms.ModelChoiceField(queryset=Poll.objects.all(), 
required=True, label='Poll Questions', help_text='Select a poll question.') 

--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Reference Form

2011-01-10 Thread Michael
I believe a bound field contains a property pointing to it's form, so
you'd do something like:

field1.form.field2

-- 
Michael 

On Mon, 2011-01-10 at 17:03 -0200, Daniel Corbe wrote:
> Hi,
>   How to get reference of one field form from another field form when
> both are in same form?
> 
> -- 
> Daniel Corbe Hahne Latorre
> dan...@corbe.com.br
> 55 48 9618-5115 
> skype: daniel_corbe
> 
> 
> 
> -- 
> 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.



Reference Form

2011-01-10 Thread Daniel Corbe
Hi,
  How to get reference of one field form from another field form when
both are in same form?

-- 
Daniel Corbe Hahne Latorre
dan...@corbe.com.br
55 48 9618-5115
skype: daniel_corbe

-- 
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: Screen/Form Fields

2011-01-10 Thread hank23
Regarding question two from above (displaying messages without text
input boxes): I want to display the fields as informational at least
for now only as a debugging tool, but may keep one of them later after
I've pretty much got the screen format finalized. That's why they
should be label fields only,  instead of text input fields.

On Jan 10, 12:05 pm, Tim Sawyer  wrote:
> > Pay attention to the notice about how this method (highest-ranked
> > answer) doesn't actually remove it from the form, and a malicious user
> > can still POST a value.
>
> Why include it in the form if you can't change the value?  Just pass the
> thing you want to be display only to the page separately and then
> display it using {{ TAG }}.  If you're using a modelform, you can
> specify a list of fields that you want to be included in the form -
> that'll sort the malicious user problem.
>
> Tim.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Screen/Form Fields

2011-01-10 Thread hank23
So in the widget attrs for the dropdown I should define an event and a
javascript function to call whenever the event (like onclick) fires?
So where's a good place to find the javascript code to actually
display the field? So do I make the field I want to display originally
a hidden field and then change the type in the javascript or do I mkae
the field originally a text input field, but somehow set it to be
invisible initially?

On Jan 10, 12:03 pm, Tim Sawyer  wrote:
> On 10/01/11 17:44, hank23 wrote:
>
> > First is it possible to conditionally hide a form field on a screen
> > until an item from a dropdown box has been selected? If so how can
> > that be done?
>
> Yes, but you'll have to use jQuery or similar and script it with
> JavaScript, so that when the droplist changes you fire some javascript
> to change the fields that are displayed.
>
> > Second I have some message fields defined in a form which are
> > basically for information purposes. When I drop them on my screen they
> > are displayed in text boxes, which I do not like. Is it possible to
> > instead display them within label tags or somehow get rid of the boxes
> > surrounding them while also making them non-enterable(right now
> > they're being displayed in text boxes they can be typed over or
> > otherwise altered)? If so how? If not then should I just be displaying
> > them outside of the form portion of the screen then instead of within
> > the form?
>
> Specify each field individually and just output text for the ones you
> want to be readonly.  
> See:http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-fo...
>
> Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Screen/Form Fields

2011-01-10 Thread Tim Sawyer

On 10/01/11 17:44, hank23 wrote:

First is it possible to conditionally hide a form field on a screen
until an item from a dropdown box has been selected? If so how can
that be done?


Yes, but you'll have to use jQuery or similar and script it with 
JavaScript, so that when the droplist changes you fire some javascript 
to change the fields that are displayed.



Second I have some message fields defined in a form which are
basically for information purposes. When I drop them on my screen they
are displayed in text boxes, which I do not like. Is it possible to
instead display them within label tags or somehow get rid of the boxes
surrounding them while also making them non-enterable(right now
they're being displayed in text boxes they can be typed over or
otherwise altered)? If so how? If not then should I just be displaying
them outside of the form portion of the screen then instead of within
the form?


Specify each field individually and just output text for the ones you 
want to be readonly.  See: 
http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template


Tim

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-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: Screen/Form Fields

2011-01-10 Thread Shawn Milochik

On Jan 10, 2011, at 12:54 PM, hank23 wrote:

> Is there something like a label widget available? If so where is it
> defined? I didn't notice it listed in the forms wigdets document at:
> 
> http://docs.djangoproject.com/en/1.2/ref/forms/widgets/
> 

I just found this. Hopefully someone will let us know if there's a better 
method:

http://stackoverflow.com/questions/324477/in-a-django-form-how-to-make-a-field-readonly-or-disabled-so-that-it-cannot-be

Pay attention to the notice about how this method (highest-ranked answer) 
doesn't actually remove it from the form, and a malicious user can still POST a 
value.

Also, see the comment at the bottom about the 'readonly' attr in 1.2. I 
couldn't find it in a quick search of the docs, but I didn't grep the source 
code.

Shawn

-- 
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: Screen/Form Fields

2011-01-10 Thread hank23
Is there something like a label widget available? If so where is it
defined? I didn't notice it listed in the forms wigdets document at:

http://docs.djangoproject.com/en/1.2/ref/forms/widgets/


On Jan 10, 11:46 am, Shawn Milochik  wrote:
> 1. AJAX (try jQuery).
>
> 2. Change the field's widget.

-- 
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: Screen/Form Fields

2011-01-10 Thread Shawn Milochik
1. AJAX (try jQuery).

2. Change the field's widget.


-- 
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: Reconnecting after a database restart

2011-01-10 Thread Jirka Vejrazka
Hi Brennan,

You can force Django to reopen the database connection by:

>>> from django.db import connection
>>> connection.close()

Django will then automatically reconnect to the database when it needs
it. Obviously, it's up to you to figure out where to put this code in
your application (it might be difficult). And, I just realized that I
don't know what happens if the database is down when you call
connection.close(), so you'd have to test it.

 (the code is not multi-db aware, but you can easily adapt that).

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



Screen/Form Fields

2011-01-10 Thread hank23
I have a couple of questions regarding formatting fields on a screen
which are coming from a form.

First is it possible to conditionally hide a form field on a screen
until an item from a dropdown box has been selected? If so how can
that be done?

Second I have some message fields defined in a form which are
basically for information purposes. When I drop them on my screen they
are displayed in text boxes, which I do not like. Is it possible to
instead display them within label tags or somehow get rid of the boxes
surrounding them while also making them non-enterable(right now
they're being displayed in text boxes they can be typed over or
otherwise altered)? If so how? If not then should I just be displaying
them outside of the form portion of the screen then instead of within
the form?

Thanks for the help. It is very appreciated.

-- 
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.



Question on the purpose of specific files on a DB Backend(django-odbc)

2011-01-10 Thread czamb...@gmail.com
I am asking the question here because nobody seems to respond to
tickets or questions on the django-odbc group. I have found a couple
of problems on the django-odbc backend. I fixed one of them, it was
using a column alias in the order by clause which is not supported by
MSSQL,  by making a simple change on query.py but for the second
problem I am finding that I need to update compiler.py which leads me
to my question. What is the difference between query.py and
compiler.py? When is one used as opposed to the other?

-- 
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: post messages to facebook wall

2011-01-10 Thread trương thế linh
Hi every body,
I'm a newbie to django.
please suggest me an app to intergrate with django to do allow me to
post messages to facebook wall.

It is better if there are example for this matter.

i have read on some websites, and knew that we can use
facebook.GraphAPI.put_wall_post

But i didn't see any example.

So, please help me.



Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Reconnecting after a database restart

2011-01-10 Thread Euan Goddard
As far as I know Django maintains a persistent connection to the
database server and restarting the server without restarting the
client isn't possible. We never restart our live database server in
production (we fail over to a secondary server so that the app is
essentially only vulnerable for a few seconds whilst the failover
happens and a subsequent app restart). I think the only thing you can
do is to restart the app as soon as you've restarted the DB server.

All that said, it may be possible to get Django to reconnect, but from
reading the source in the DB layer, I don't recall seeing anything
like that.

On Jan 10, 3:25 pm, Brennan Sellner  wrote:
> Hi folks,
>
> We're using the Django database layer as part of a Twisted application
> [1], and we're having some problems with Django failing to reconnect to
> the database after the database server restarts.  It works great
> otherwise, but once the database server restarts, the Django database
> layer throws exceptions on every database touch.  Is there any way to
> configure Django (or psycopg2) to automatically reconnect?
>
> The traceback we're seeing is below [2].  The problem is reliably
> reproducible by restarting Postgres, then triggering an action in our
> Twisted application that touches the database.  It persists until we
> restart the application.
>
> Versions:
>   Django 1.2.1
>   Psycopg2 2.0.13
>   Postgresql 8.4.5
>   Ubuntu 10.04
>
> Thanks,
>
> -Brennan
>
> [1] We're planning on adding a real Django app in the near future, and
> wanted to maintain the same database abstraction throughout the system.
>
> [2] Traceback:
>
> File "/usr/lib/pymodules/python2.6/gjeter/executive/Executive.py", line
> 164, in robotPair
>    p.save()
>  File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line 435, in 
> save
>    self.save_base(using=using, force_insert=force_insert, 
> force_update=force_update)
>  File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line 528, in 
> save_base
>    result = manager._insert(values, return_id=update_pk, using=using)
>  File "/usr/lib/pymodules/python2.6/django/db/models/manager.py", line 195, 
> in _insert
>    return insert_query(self.model, values, **kwargs)
>  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 1479, in 
> insert_query
>    return query.get_compiler(using=using).execute_sql(return_id)
>  File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 
> 783, in execute_sql
>    cursor = super(SQLInsertCompiler, self).execute_sql(None)
>  File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 
> 727, in execute_sql
>    cursor.execute(sql, params)
>  File "/usr/lib/pymodules/python2.6/django/db/backends/util.py", line 15, in 
> execute
>    return self.cursor.execute(sql, params)
>  File 
> "/usr/lib/pymodules/python2.6/django/db/backends/postgresql_psycopg2/base.py",
>  line 44, in execute
>    return self.cursor.execute(query, args)
> django.db.utils.DatabaseError: server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.

-- 
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: Django and PIL problem?

2011-01-10 Thread Steve McConville
Unlike some of the other methods in PIL "thumbnail" modifies the file
in place and returns None. This will probably do what you expect:

import Image
ARTICLE_LARGE_SIZE = 230,300
tmp_file = Image.open(form.cleaned_data['image'])
tmp_file.thumbnail(ARTICLE_SMALL_SIZE)
tmp_file.save(location + '/small.jpg', 'JPEG')


On 10 January 2011 15:09, galago  wrote:
> I try to create thumbnail via PIL
> import Image
> ARTICLE_LARGE_SIZE = 230,300
> tmp_file = Image.open(form.cleaned_data['image'])
> tmp_file = tmp_file.thumbnail(ARTICLE_SMALL_SIZE)
> tmp_file.save(location + '/small.jpg', 'JPEG')
>
> I get: 'NoneType' object has no attribute 'save'
> WTF?
> When i replace tmp_file.thumbnail to tmp_file.resize all is fine but i loose
> proportions:/
>
> --
> 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.
>



-- 
steve
http://stevemcconville.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.



Re: Configure LAMPP with Django

2011-01-10 Thread Thomas

Am 10.01.2011 um 16:56 schrieb evstevemd:

> I have LAMPP on Ubuntu and I use it fine with PHP. Now I have to add
> Django so that I can do PHP and Django projects together. I will have
> more than one Django project. I have read of mod_wsgi but I cannot
> understand.

what exactly is the problem?

I found these explanations helpful:
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html

good luck


> In PHP I just put my project as subdirectory of /var/www/
> and then access them via http://localhost/
> How do I do with Django?
> Thanks a lot!
> 
> -- 
> 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.



Re: Configure LAMPP with Django

2011-01-10 Thread Javier Guerra Giraldez
On Mon, Jan 10, 2011 at 10:56 AM, evstevemd  wrote:
> In PHP I just put my project as subdirectory of /var/www/
> and then access them via http://localhost/
> How do I do with Django?

Django is not a page-based template system like PHP.  it's a
long-running application that answers web requests.

the difference means a much bigger separation between code and
presentation than in PHP, and implies a totally different deployment
architecture.

if you do the tutorials first, it will make all clear.

-- 
Javier

-- 
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.



Configure LAMPP with Django

2011-01-10 Thread evstevemd
I have LAMPP on Ubuntu and I use it fine with PHP. Now I have to add
Django so that I can do PHP and Django projects together. I will have
more than one Django project. I have read of mod_wsgi but I cannot
understand. In PHP I just put my project as subdirectory of /var/www/
and then access them via http://localhost/
How do I do with Django?
Thanks a lot!

-- 
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: Django and PIL problem?

2011-01-10 Thread Michael
Image.resize returns a new instance of Image of the new size, leaving
the internal data of the original intact, so:

>>  tmp_file = tmp_file.thumbnail(ARTICLE_SMALL_SIZE)

will create a new Image instance based on the original, with the new
size, then it sets the value of the tmp_file variable to the new image
instead of the original.

Image.thumbnail replaces the data in the current instance, it doesn't
return anything, so:

>>  tmp_file = tmp_file.thumbnail(ARTICLE_SMALL_SIZE)

Will change the internal data for tmp_file, then it will set the value
of the tmp_file variable to None (the return value of Image.thumbnail).
If you simply leave out the "tmp_file = " part, it should work the way
you expect:

>>  tmp_file.thumbnail(ARTICLE_SMALL_SIZE)

http://www.pythonware.com/library/pil/handbook/image.htm

-- 
Michael 

On Mon, 2011-01-10 at 07:09 -0800, galago wrote:
> I try to create thumbnail via PIL
> 
> 
> import Image
> 
> ARTICLE_LARGE_SIZE = 230,300
> 
> tmp_file = Image.open(form.cleaned_data['image'])
> tmp_file = tmp_file.thumbnail(ARTICLE_SMALL_SIZE)
> 
> tmp_file.save(location + '/small.jpg', 'JPEG')
> 
> 
> 
> I get: 'NoneType' object has no attribute 'save'
> WTF?
> When i replace tmp_file.thumbnail to tmp_file.resize all is fine but i
> loose proportions:/
> 
> -- 
> 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.



Re: django cms without django admin

2011-01-10 Thread Jonas Obrist
Hi

As already mentioned, this belongs to 
http://groups.google.com/group/django-cms?hl=en

But let me just quickly say that there's no sane way to get the CMS running 
without admin. The whole point in having a CMS is to be able to edit content 
easily, for which you need admin.

I have no idea what kind of security concerns you have, but seeing you want 
to use 2.0.2 they can't be serious, since you'd use 2.1 otherwise.

Jonas

-- 
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.



Reconnecting after a database restart

2011-01-10 Thread Brennan Sellner
Hi folks,

We're using the Django database layer as part of a Twisted application
[1], and we're having some problems with Django failing to reconnect to
the database after the database server restarts.  It works great
otherwise, but once the database server restarts, the Django database
layer throws exceptions on every database touch.  Is there any way to
configure Django (or psycopg2) to automatically reconnect?

The traceback we're seeing is below [2].  The problem is reliably
reproducible by restarting Postgres, then triggering an action in our
Twisted application that touches the database.  It persists until we
restart the application.

Versions:
  Django 1.2.1
  Psycopg2 2.0.13
  Postgresql 8.4.5
  Ubuntu 10.04

Thanks,

-Brennan

[1] We're planning on adding a real Django app in the near future, and
wanted to maintain the same database abstraction throughout the system.

[2] Traceback:

File "/usr/lib/pymodules/python2.6/gjeter/executive/Executive.py", line
164, in robotPair 
   p.save()
 File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line 435, in save
   self.save_base(using=using, force_insert=force_insert, 
force_update=force_update)
 File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line 528, in 
save_base
   result = manager._insert(values, return_id=update_pk, using=using)
 File "/usr/lib/pymodules/python2.6/django/db/models/manager.py", line 195, in 
_insert
   return insert_query(self.model, values, **kwargs)
 File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 1479, in 
insert_query
   return query.get_compiler(using=using).execute_sql(return_id)
 File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 
783, in execute_sql
   cursor = super(SQLInsertCompiler, self).execute_sql(None)
 File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 
727, in execute_sql
   cursor.execute(sql, params)
 File "/usr/lib/pymodules/python2.6/django/db/backends/util.py", line 15, in 
execute
   return self.cursor.execute(sql, params)
 File 
"/usr/lib/pymodules/python2.6/django/db/backends/postgresql_psycopg2/base.py", 
line 44, in execute
   return self.cursor.execute(query, args)
django.db.utils.DatabaseError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

-- 
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.



Django and PIL problem?

2011-01-10 Thread galago
I try to create thumbnail via PIL

import Image
ARTICLE_LARGE_SIZE = 230,300
tmp_file = Image.open(form.cleaned_data['image'])
tmp_file = tmp_file.thumbnail(ARTICLE_SMALL_SIZE)
tmp_file.save(location + '/small.jpg', 'JPEG')

I get: 'NoneType' object has no attribute 'save'
WTF?
When i replace tmp_file.thumbnail to tmp_file.resize all is fine but i loose 
proportions:/

-- 
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.



Screen/Form/View Problem?

2011-01-10 Thread hank23
This is my first attempt at trying to code a form and use it in a
view, so I've probably got something wrong. At this point I just
wanted to produce the screen with all of the fields displayed on it,
just to see if I have things coded correctly to display the screen the
first time.

I'm not getting any error but I'm also not getting everything on my
screen which I think I should be getting. The screen should display a
title, then a message, a dropdown box(pollquestions), a button, and
finally another message. At least it should as long as I have my html
coded properly. My form is defined this way:

class AddChoiceForm(forms.Form):
infomessage = forms.CharField(max_length=200)
pollquestions =
forms.ModelChoiceField(queryset=Poll.objects.all(), required=True,
label='Poll Questions', initial='Please select a poll question',
help_text='Select a poll question.',
error_messages={'required': 'Please select a poll question!',
'invalid_choice': 'Cannot select initial value!'},
widget=forms.Select(attrs={'name': 'pollquestions',
'id':'pollquestions', 'size':'1', 'type':'select-one' }))
confirmmessage = forms.CharField(max_length=200)
newchoice = forms.CharField(max_length=200)


my addchoice.html screen is defined this way:

Add Poll Choice Screen


{% csrf_token %}

{{ infomessage }}



{{ pollquestions }}





{{ confirmmessage }}



and my view is coded this way:

def addchoice(request):
polls = Poll.objects.all()
pollcount = Poll.objects.all().count()
if pollcount > 0 :
message = "Number of polls passed to form was " + str(pollcount)
else:
message = "No polls passed in to form."

confirm = "Nothing added."

data = {'pollquestions': polls, 'infomessage': message,
'confirmmessage': confirm }
form = AddChoiceForm(data)
dctnry = {'form': form, 'data': data}
return render_to_response('polls/addchoice.html',
  dctnry,
 
context_instance=RequestContext(request))


I would appreciate any help or suggestions, for figuring this out.
Thanks.








-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: django cms without django admin

2011-01-10 Thread Joel Goldstick
On Mon, Jan 10, 2011 at 8:06 AM, Shawn Milochik  wrote:

> This is probably a better question for the Django-CMS Google Group than
> this one:
>
> http://groups.google.com/group/django-cms?hl=en
>
> It's always possible to subclass their modelforms and templates. I've used
> Django CMS, but I don't have a grasp of how much work it would be to disable
> the admin.
>
> Two ideas:
>
> You could use the Django admin's user permissions to lock down the stuff
> you don't want them to see.
>
> Also, if you don't use the admin now, why not just leave everything out of
> your admin.py files except for the Django CMS stuff? That way it's not even
> visible for your users, much less editable.
>
> Shawn
>
>
>  --
> 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.
>

admin is turned off by default.  You need to uncomment several things to
even have it work.



-- 
Joel Goldstick

-- 
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: upload files via ajax

2011-01-10 Thread Mauro


On 23 Dic 2010, 23:12, Paul Osman  wrote:
> On Thu, Dec 23, 2010 at 9:39 AM, Mauro  wrote:
> > Hello,
> > is it possible to upload files via ajax?
>
> > I would like to upload multiple files in my application but i have the
> > following exception:
>
> > MultiPartParserError: Invalid boundary in multipart: None
>
> > I'm using django 1.1.
> > The ajax request has the content type header set as mulitpart/form-
> > data
>
> This was recently posted to the Mozilla Webdev blog. Might help you:
>
> http://blog.mozilla.com/webdev/2010/09/17/django-and-ajax-image-uploads/
>
> -Paul

Hi, thanks for replying, but would like to choose the files at once
and then upload them one by one (without flash, only html).  Using an
ajax request, django returns the MultiParseError. Moreover i try to
user request._post_raw_data, but i would like to send also some other
informations together with the files, and i do not to retrieve them
from raw_data,
Any other idea?

-- 
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.



current app problem with inclusion_tag

2011-01-10 Thread Raony Araújo
hi,

i'm having problems with namespace url resolution and inclusion tags,
to say that i have multiple copies of an app deployed, each with its
app_name and reversing urls does work well when the current_app
parameter is set.

also, the {% url %} template tag works well when the current_app is
set on the request context object.

the problem is with templates rendered with inclusion_tags, inside the
Library class code, a new context is created and the current_app is
not preserved in it (it does not matter if the "takes_context" is set)
making further use of {% url %} break, resolving to the default app of
the namespace.

i think this is a bug, but i didn't see it in the django tickets, and
seems this is still happening in the development version.

thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: django cms without django admin

2011-01-10 Thread Shawn Milochik
This is probably a better question for the Django-CMS Google Group than this 
one:

http://groups.google.com/group/django-cms?hl=en

It's always possible to subclass their modelforms and templates. I've used 
Django CMS, but I don't have a grasp of how much work it would be to disable 
the admin.

Two ideas:

You could use the Django admin's user permissions to lock down the stuff you 
don't want them to see. 

Also, if you don't use the admin now, why not just leave everything out of your 
admin.py files except for the Django CMS stuff? That way it's not even visible 
for your users, much less editable. 

Shawn


-- 
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: Class based views and form processing

2011-01-10 Thread Justin Murphy
Thanks, Łukasz. I looked into overriding that method too, but it seems like 
there should be a cleaner way. I almost feel like the ``ModelFormMixin`` 
should have an API similar to a ``ModelAdmin`` where one could override a 
``save_model()`` method on the subclass.

The ``form_valid()`` method does a lot of work that could be separted out 
(granted I don't know if more methods to override is a good thing!). The 
docs say that the method "saves the form instance, sets the current object 
for the view, and redirects to 
get_success_url()
."[1]

This might just be semantics, but in my mind the validation of the form and 
the saving of the form should be separated. Let's see if anybody else has 
some input and if not then I will bring this over to django-developers 
and/or IRC.

[1] 
http://docs.djangoproject.com/en/dev/ref/class-based-views/#django.views.generic.edit.ModelFormMixin.form_valid

Thanks,
Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



order of columns in table after syncdb with abstract models

2011-01-10 Thread Rahalevich (Kavalevich) Mila
Hi.

Is there any way to specify columns order on syncdb for models?
Example:

class D(models.Model):
date = ...
title = ...
class Meta:
abstract = True

class Blog(D):
username = ...
entry = ...
theme = ...

table will looks like :
date, title, username, entry, theme
but I would like:
date, username, title, entry, theme
Thanks.
-- 
Best Regards,
Mila

-- 
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.



Admin save_model and ImageField (upload_to)

2011-01-10 Thread galago
Is there any way to get the full path of file, which will be uploaded?
in save_model action i can get obj.image but it gives me only the file name. 
I want to get path with upload_to from model.
Is it possible?

I need it, because I want to make resizing on my image and make its name 
with hash to custrom folder.

-- 
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.



Best model layout for option variance

2011-01-10 Thread Dustin
I am building an interface that consists of several fields, mostly
drop down boxes (menus).  Depending on the menu item (option) selected
in each menu, however, there may be a unique set of "properties" that
the user should be presented with.  e.g. "Option A may have the
customizable properties Quantity and Size, Option B may have the
property Radius only, and still Option C may have no properties at
all." and properties may be text input, or perhaps another menu
altogether.

I am trying to determine the best method of setting this up in
Django.  Here are my two ideas:

IDEA #1: Use a class for each set of menu items, a class for each set
of options, and store the possible properties in a dict.

class MenuItem(models.Model):
  item = models.CharField(max_length=200, unique=True)

class Option(models.Model):
  key = models.CharField(max_length=200)
  value = models.CharField(max_length=200)

class Category(models.Model):
  selection = models.ForeignKey(MenuItem)
  options = models.ManyToManyField(Option, null=True)
  OPTION_DICT = {
'Option A': {
  'quantity': {
'type': 'text',
  },
  'size': {
'type': 'menu',
'options': ('1 inch', '2 inches', '3 inches'),
  }
},
'Option B': {
  'radius': {
'type': 'text',
  },
},
  }

class MyForm(models.Model):
  category = models.ForeignKey(Category)
  ...


This is obviously a generic layout.  In reality, there will be
Category, MenuItem, and Option base classes, and  copies (inherited)
of all 3 for each category with an specific option rules needed.
Initial data would obviously have to be put in the DB before this
would work at all.


IDEA #2:  Put the whole set of categories, options and rules in a
dictionary and scrap the Category, MenuItem, and Option models all
together.  I figure performance would be marginally better this way,
and also easier to code/modify (maybe).


Is there another solution I'm missing here?  I want to weigh all
options before fully committing.  It's a fairly large project and I'd
like to get it right the first time.

-- 
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: Curious 500 errors

2011-01-10 Thread Justin Murphy
Hi Conor,

You might be running into a CSRF protection error. Django expects a
CSRF token for all POST requests and the MailChimp webhooks aren't
sending one. You will need to decorate your views as @csrf_exempt in
order for them to work. Just make sure that you do some extra
validation on your part for security issues.

Example:
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def handle_mailchimp_callback(request):
   ...

Here is a link to the Django CSRF documentation:
http://docs.djangoproject.com/en/dev/ref/contrib/csrf/?from=olddocs#exceptions

-Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Error on Production Server (TemplateSyntaxError: Caught ImportError while rendering: No module named testapp)

2011-01-10 Thread Thomas M
I've found the problem.
The Configuration was correct. The only problem was that the user
running the apache service couldn't access the app directory. :(

On 7 Jan., 15:24, Thomas M  wrote:
> I have to correct myself:
>
> It still doesnt find "testapp", so nothing has changed :(
>
> On 7 Jan., 14:53, Thomas M  wrote:
>
>
>
> > Ok, I've called the sittings file with "bellcher.settings" and moved
> > it into the projects root folder.
> > Now there are no Error Mesages anymore but django still wont work.
>
> > If I access theserver'sIP I am getting a "500 - InternalServer
> > Error"
> > I've posted myServerConfiguration above. Do you have any Ideas?
>
> > BTW: the testapp doesnt do very much, it just returns a HttpResponse
> > so I can test theserver.
>
> > Thanks, Thomas
>
> > On 7 Jan., 14:39, Tonton  wrote:
>
> > > hello i am not sure if i can help you but from my config
> > > use
>
> > > os.environ["DJANGO_SETTINGS_MODULE"] = "bellcher.settings"  (like in
> > > installed apps)
>
> > > or mv django.wsgi in /Bellcher
> > > WSGIScriptAlias / /www/django/bellcher/django.wsgi
>
> > > regards
>
> > > On Fri, Jan 7, 2011 at 2:26 PM, Thomas M  wrote:
> > > > Hi,
>
> > > > I've just set up aserverwith apache2 and mod_wsgi.
> > > > Now I want to run django on thisServerbut it crashes with this error
> > > > message:
> > > > "TemplateSyntaxError: Caught ImportError while rendering: No module
> > > > named testapp"
>
> > > > I've configured theServerthis way:
> > > > My django code is in:
>
> > > > /www/django/bellcher/
>
> > > > so the app "testapp" is in /www/django/bellcher/testapp and has an
> > > > __init__.py
>
> > > > My WSGI Script:
>
> > > > #!/usr/local/bin/python
> > > > import os, sys
> > > > sys.path.append("/www/django/")
> > > > sys.path.append("/www/django/bellcher/")
> > > > os.environ["DJANGO_SETTINGS_MODULE"] = "settings"
> > > > os.environ["PYTHON_EGG_CACHE"] = "/tmp"
>
> > > > import django.core.handlers.wsgi
>
> > > > application = django.core.handlers.wsgi.WSGIHandler()
>
> > > > And my Apache configuration:
>
> > > > 
> > > >        Order deny,allow
> > > >        Allow from all
> > > > 
>
> > > > 
> > > >        AllowOverride All
> > > >        Order deny,allow
> > > >        Allow from all
> > > > 
>
> > > > Alias /media/ /www/django/bellcher/media/
> > > > ServerAdmin t...@gmx.de
> > > > ErrorLog "/var/log/apache2/django_error.log"
> > > > CustomLog "/var/log/apache2/django_access.log" common
>
> > > > WSGIScriptAlias / /www/django/bellcher/apache/django.wsgi
>
> > > > I dont think that myserverconfiguration causes the problem, because
> > > > I've tried configuring theserverwith the help of several tutorials.
> > > > And every try ended up with this error.
>
> > > > Can somebody please help me with this issue?
>
> > > > Much thanks in advance,
> > > > Thomas M
>
> > > > --
> > > > 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.



Re: A few beginner questions

2011-01-10 Thread derek
Just one point of clarity - the intention is clearly for apps to be
small and focused and "do one thing well".  Like much of Python, of
course, you as a developer can abuse this to your heart's content and
create humugenous and unwieldy code bases.  (Pinax, incidentally, is
not an "app", but a bundled collection of apps that aim to make it
easier to start developing certain types of sites.)

On Jan 8, 3:50 pm, Mike Ramirez  wrote:
> On Saturday, January 08, 2011 02:07:22 am Ondřej Mirtes wrote:
>
> > Thank you all for your responses.
>
> > I have one more question - what is the purpose of "apps" in
> > "projects" (when I create new app in a project via manage.py
> > startapp)? Are they something like sections of a web (articles, forum,
> > user administration?) or are they rather something like modules,
> > reusable across projects? How big should be an app?
>
> They are really both, see django-registration, djangobb, pinax, and many other
> django-apps (search google code and github).
>
> > How should I solve typical scenario when my site consists of a small
> > frontend presentation and a complex API service?
>
> This is really a question best left upto you to answer. Looking at existing
> apps, some are small providing specific functionality (django-email-
> notifiation iirc is another), others really huge providing a whole slew of
> things (see djangobb and pinax). Others have made apps that just hold template
> tags, to one app for the whole site (which most new django developers do).
>
> My suggestion to you is to build it the way that makes it easy to maintain the
> site, for you and developers after you. If some functionality that you come up
> with can be of use to others, then it's worthwhile to make it it's own app and
> release it into the wild via your fav license.
>
> Mike
>
> --
> Death comes on every passing breeze,
> He lurks in every flower;
> Each season has its own disease,
> Its peril -- every hour.
>         --Reginald Heber

-- 
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: A few beginner questions

2011-01-10 Thread derek
Apps vs Projects

There is probably no one better to address this topic than James
Bennet - see:
http://www.b-list.org/weblog/2008/feb/11/integrity/
(e.g. "when Django first appeared I was playing with Rails, and the
available options for this sort of reusable functionality in Rails
all, frankly, sucked: engines and plugins and what-have-you, and none
of it was really elegant.")

But you really need to watch this video.  Its long but James is very
very focused and clearly highlights the key concepts and their
practical demonstration:
http://www.youtube.com/watch?v=A-S0tqpPga4

On Jan 8, 12:07 pm, Ondřej Mirtes  wrote:
> Thank you all for your responses.
>
> I have one more question - what is the purpose of "apps" in
> "projects" (when I create new app in a project via manage.py
> startapp)? Are they something like sections of a web (articles, forum,
> user administration?) or are they rather something like modules,
> reusable across projects? How big should be an app?

-- 
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.