Re: Revision 6391 Admin error

2007-10-26 Thread Jason Sidabras

Thank you for taking my jumbled post and helping me. It seems that
even though I haven't added my new script yet  in my INSTALLED_APPS it
was checking it. Removing the errors in that script cleared up the
problem.

Thank you,

jason

On Oct 26, 7:52 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-10-26 at 15:49 -0700, Jason Sidabras wrote:
> > Hello,
>
> > In an effort to keep up with svn with django I have just upgraded all
> > of my sites to the newest svn revision. The problem is after updating
> > I get the error:
>
> > >NameError at /admin/
> > >name 'PasswordField' is not defined
> > >Request Method:GET
> > >Request URL:  http://xxx/admin/
> > >Exception Type:NameError
> > >Exception Value:   name 'PasswordField' is not defined
> > >Exception Location:
> > >/xxx/django/django_projects/eprbiomed/login/models.py inUserProfile, line 
> > >20
>
> This suggests the exception is being raised form inside your code, not
> Django. It's harder to guess much more, since we can't see the full
> traceback. Fortunately, you can (it's lower down on the debug screen and
> there's even a cut-and-paste version), so you might be able to get more
> information from there.
>
>
>
> > >Python Executable: /xxx/Enviroment/bin/python2.5
> > >Python Version:2.5.0
> > >Template error
>
> > >In template 
> > >/xxx/django/django_src/django/contrib/admin/templates/admin/base.html, 
> > >error at line 28
>
> > Boiling it down I find the last good revision is 6390 for me.
>
> > >Index: base.html
> > >===
> > >--- base.html   (revision 6390)
> > >+++ base.html   (revision 6391)
> > >@@ -22,7 +22,14 @@
> > > {% block branding %}{% endblock %}
> > > 
> > > {% if user.is_authenticated and user.is_staff %}
> > >-{% trans 'Welcome,' %} {% if 
> > >user.first_name %}{{ >user.first_name|escape }}{%
> > >else %}{{ user.username }}{% endif %}. {% block userlinks %} > >href="doc/">{% trans 'Documentation' %}/  > >href="password_change/">{% trans 'Change password' %} /  > >href="logout/">{% trans 'Log out' %}{% endbl   ock 
> > >%}
> > >+
> > >+{% trans 'Welcome,' %} {% if user.first_name %}{{ 
> > >user.first_name|escape }}{% else %}{{ user.userna   me 
> > >}}{% endif %}.
> > >+{% block userlinks %}
> > >+{% 
> > >trans 'Documentation' %}
> > >+/ {% trans 'Change password' %}
> > >+/ {% trans 
> > >'Log out' %}
> > >+{% endblock %}
> > >+
> > >{% endif %}
> > > {% block nav-global %}{% endblock %}
> > > 
>
> So try to work out which line the problem is coming from. Which call to
> the {% url %} tag is hitting the code that is causing the problem. The
> standard approach here would be to comment out most of the lines and
> uncomment them one-by-one until you can cause the error again.
>
> It sounds like you've overridden something and so calling one of these
> url tags ends up calling code that you've written and that code has some
> problem in it somewhere.
>
> Regards,
> Malcolm
>
> --
> Depression is merely anger without 
> enthusiasm.http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python 2.5, Postgres, Psycopg2 on OS X

2007-10-26 Thread girzel

Very sorry, I wasn't having the problem I thought I was having. I
still don't know why the traceback was switching to the old
installation of Python, but at any rate the real problem was that it
couldn't find the settings module - my DJANGO_SETTINGS_MODULE and
PythonPath had an overlapping file-path segment. Never mind!

Sheepishly,
E


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread Malcolm Tredinnick

On Sat, 2007-10-27 at 10:59 +1000, Malcolm Tredinnick wrote:
[...]
> I guess you know what you mean here, Jeremy, but just in case anybody
> hits this in the archives: DEFAULT_CHARSET has nothing to do with the
> internal bytestrings you pass to Django. It *only* affects the output
> from the email generation and template generation functions.

*sigh*

When I said "only", what I meant was "...and also the default assumption
about the encoding used for submitted data (which cna be changed via
request.encoding)." All this is documented, of course, but if I'm going
to be pedantic, being accurate would also be helpful.

Regards,
Malcolm


-- 
Tolkien is hobbit-forming. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 12:30 -0700, mamcxyz wrote:
> I'm in the process to relaunch a django site. I build a dozen test
> (finally!) for it and work correctly before.
> 
> I update django to changeset 6601 and get a lot of errors. I fix
> almost all of them except this:
> 
> self.assertContains(self.response,u'Buscar:')
>   File "D:\Programacion\Python\Python24\lib\site-packages\django\test
> \testcases.py", line 111, in assertContains
> real_count = response.content.count(text)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 162: ordinal not in range(128)

I suspect the problem is the use of .count() here and mixing Unicode and
str objects. You don't mention what the type of 'text' (Jeremy asked
about that, but I didn't see an answer in your reply), but if you do
this in Python:

>>> s = u'\xc5ngstr\xf6m'
>>> s.count('\xc3\x85')

you will get a UnicodeDecodeError because the Python doesn't know the
encoding of the bytestring in the argument to count() but it needs to
convert it to Unicode to compare with the unicode object on the left. So
Python assumes ASCII and everything goes to water.

The solution is probably to do something like this in your test:

real_count = response.content.count(smart_unicode(text))

Basically, make sure that both arguments to count are of the same type
(bytestrings encoded with the same encoding, or both unicode objects).

Regards,
Malcolm

-- 
For every action there is an equal and opposite criticism. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 15:52 -0500, Jeremy Dunck wrote:
> On 10/26/07, mamcxyz <[EMAIL PROTECTED]> wrote:
> >
> > > What's the type and value of "request.content"?  What's the type and
> > > value of "text" ?
> >
> > self.response=
> 
> Err, please give the type and value of request.*content*, not request.  :)
> 
> ...
> > 'content-type': ('Content-Type', 'text/html; charset=utf-8')}
> ...
> >
> > (why is utf8)
> 
> There are several different charsets in play.
> DEFAULT_CHARSET is the encoding sent back to the client.
> FILE_CHARSET is the encoding of the template and initial sql files.
> There's also TEST_DATABASE_CHARSET with is the DB encoding, of course,
> but is only used when the test runner is creating your schema in the
> test DB.
> 
> In any case, your DEFAULT_CHARSET is probably still UTF-8.  This
> should be OK, assuming your internal bytestrings are UTF-8.

I guess you know what you mean here, Jeremy, but just in case anybody
hits this in the archives: DEFAULT_CHARSET has nothing to do with the
internal bytestrings you pass to Django. It *only* affects the output
from the email generation and template generation functions. It's the
encoding used for text we send back to the user. You *must* use UTF-8
bytestrings or Unicode strings inside Django regardless of if
DEFAULT_CHARSET is set to "woolly-elephant" or anything. This is
documented in unicode.txt.


>   The
> problem is clearly before the response, so we can worry about that
> later.  :)
> 
> I dunno what DB you're using, but you might ensure that the DB created
> for testing is using the same charset/encoding as your prod one.
> 
> > > Err, your comment seems to suggest you're just switching the CHARSET
> > > parameter as a guess.  The files really *are* in some specific
> > > charset, and the setting needs to agree.  :-/
> >
> > I click in file properties in komodo and tell me that my files are in
> > utf8. However 2 o 3 (one are part in the response) stick to CP-1252,
> > no matter what I do...

All your template files are going to have to be in the same encoding.
Django trusts FILE_CHARSET and it doesn't change.

Malcolm
-- 
I've got a mind like a... a... what's that thing called? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Revision 6391 Admin error

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 15:49 -0700, Jason Sidabras wrote:
> Hello,
> 
> In an effort to keep up with svn with django I have just upgraded all
> of my sites to the newest svn revision. The problem is after updating
> I get the error:
> 
> >NameError at /admin/
> >name 'PasswordField' is not defined
> >Request Method:  GET
> >Request URL: http://xxx/admin/
> >Exception Type:  NameError
> >Exception Value: name 'PasswordField' is not defined
> >Exception Location:  /xxx/django/django_projects/eprbiomed/login/models.py 
> >inUserProfile, line 20

This suggests the exception is being raised form inside your code, not
Django. It's harder to guess much more, since we can't see the full
traceback. Fortunately, you can (it's lower down on the debug screen and
there's even a cut-and-paste version), so you might be able to get more
information from there.

> >Python Executable:   /xxx/Enviroment/bin/python2.5
> >Python Version:  2.5.0
> >Template error
> >
> >In template 
> >/xxx/django/django_src/django/contrib/admin/templates/admin/base.html, error 
> >at line 28
> 
> Boiling it down I find the last good revision is 6390 for me.
> 
> >Index: base.html
> >===
> >--- base.html   (revision 6390)
> >+++ base.html   (revision 6391)
> >@@ -22,7 +22,14 @@
> > {% block branding %}{% endblock %}
> > 
> > {% if user.is_authenticated and user.is_staff %}
> >-{% trans 'Welcome,' %} {% if 
> >user.first_name %}{{ >user.first_name|escape }}{%
> >else %}{{ user.username }}{% endif %}. {% block userlinks %} >href="doc/">{% trans 'Documentation' %}/  >href="password_change/">{% trans 'Change password' %} /  >href="logout/">{% trans 'Log out' %}{% endbl   ock 
> >%}
> >+
> >+{% trans 'Welcome,' %} {% if user.first_name %}{{ 
> >user.first_name|escape }}{% else %}{{ user.userna   me 
> >}}{% endif %}.
> >+{% block userlinks %}
> >+{% 
> >trans 'Documentation' %}
> >+/ {% 
> >trans 'Change password' %}
> >+/ {% trans 
> >'Log out' %}
> >+{% endblock %}
> >+
> >{% endif %}
> > {% block nav-global %}{% endblock %}
> > 

So try to work out which line the problem is coming from. Which call to
the {% url %} tag is hitting the code that is causing the problem. The
standard approach here would be to comment out most of the lines and
uncomment them one-by-one until you can cause the error again.

It sounds like you've overridden something and so calling one of these
url tags ends up calling code that you've written and that code has some
problem in it somewhere.

Regards,
Malcolm

-- 
Depression is merely anger without enthusiasm. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Limiting foreign key choices

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 19:01 +, myahya wrote:
> I have two models: products and catregories. A product can belong to
> exactly one category. To make navigation easier, I use nested
> categories. I want to limit the admin's ability to add a product only
> to the leaf categories (those with no children). So if I the following
> structure
> Electronics > Mobile Phones > Nokia
> Electronics > Cameras
> The admin can add product to the Nokia or Cameras categories.

By itself, the admin application isn't designed to handle this. You'll
need to write some Javascript to control the options (and remember to
re-validate them in the save() method of your model).

Regards,
Malcolm

-- 
I don't have a solution, but I admire your problem. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: object persistence

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 15:57 +, Luke wrote:
> In one of my django apps, I need to access another database that is
> unrelated to django's db.  We are using psycopg to access this.  There
> is some code running some calculations inside the db as a shared
> object, and it is tied to a connection, so we need to keep it open and
> not make a new connection each time the web page is accessed.
> Therefore, we need a place to store a psycopg connection object
> persistently.  I know there are sessions, but I think that would still
> mean the destructor gets called and the connection gets closed when
> the handler returns.

This sounds a bit fragile, since even if you tied the connection to the
mod_python process, it could be killed off and restarted periodically
(based on Apache's MaxRequestsPerChild, for example).

If you need the connection to persist, tying it to anything
webserver-related feels like the wrong approach.

One alternative would be to create a daemon process that holds the
connection. You can connect to the daemon using a named pipe or socket
connection if you need to talk to it (although why not just have the
daemon manage the long-running connection completely). But, at the base
level, try to remove the need to hold the connection in the
web-interaction portions of your code. You simply don't have enough
control over their lifetimes.

Regards,
Malcolm

-- 
Remember that you are unique. Just like everyone else. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Large Admin Areas

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 13:31 +, Zenom wrote:
> Let's say we had a bunch of legacy schemas in postgresql. Currently we
> have like 6 schemas if we were to re-write our admin interface from
> php to django we would need to write 6 projects 1 for each schema
> essentially (if I apply the postgresql schema patches etc, but that's
> beside the point).
> 
> My question would be this: Is it possible to maintain a login state
> across all 6 projects, if they were situated at mysite.com/admin1
> mysite.com/admin2 etc etc.  This way we could code each piece into
> it's own admin?

Natively, Django can't do what you want, since the login state is part
of the session, which is referenced via a cookie, so you have
cross-domain restrictions. You might be able to get somewhere with a
custom authentication backend (see the authentication docs) and passing
a token around as part of the URL, but it would take some investigation.

Essentially, you're asking for single sign-on, which is a difficult
problem in general because of the cross-domain requirements. But that's
the area to look in.

Regards,
Malcolm

-- 
I don't have a solution, but I admire your problem. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Variable available to All users (static class?)

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 20:47 +, SmileyChris wrote:
> Sounds like you want something like threading.local
> It's not my area of expertise, but you may be able to pick up some
> hints on how to use it from 
> http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

That will only work if everything is in the same process. If your
webserver launches multiple Django applications as different processes,
you need to use some for of persistence. Either save it to the database
or a file (normally the solution would include "or use shared memory",
but there isn't a standard shm module in Python, unfortunately).

Regards,
Malcolm

-- 
I don't have a solution, but I admire your problem. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: i18n/setlang no longer support GET

2007-10-26 Thread Marc Garcia

That's not a big problem, you can just do something like that:

#language {
  background-color: transparent;
  border-style: none;
  cursor: pointer;
}


  


  


That have too few lines than a link, but follows standards, is
probably clearer, ans looks exactly the same way.

See you!
  Marc Garcia
  http://vaig.be/category/it/applications/django/

On Sep 26, 7:39 pm, "Antoni Aloy" <[EMAIL PROTECTED]> wrote:
> 2007/9/21, James Bennett <[EMAIL PROTECTED]>:
>
> > The HTTP specification says that GET requests should not take any
> > action other than retrieving a resource; in other words, a GET request
> > which modifies state on the server or has other side effects should
> > not be allowed.
>
> That's true, but this makes i18n/setlangunworth for usual
> applications, so I would prefer to have the option to be a bad boy and
> use the GET request.
> --
> Antoni Aloy López
> Binissalem - Mallorcahttp://www.trespams.com
> Soci de Bulma -http://www.bulma.cat


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Revision 6391 Admin error

2007-10-26 Thread Jason Sidabras

Hello,

In an effort to keep up with svn with django I have just upgraded all
of my sites to the newest svn revision. The problem is after updating
I get the error:

>NameError at /admin/
>name 'PasswordField' is not defined
>Request Method:GET
>Request URL:   http://xxx/admin/
>Exception Type:NameError
>Exception Value:   name 'PasswordField' is not defined
>Exception Location:/xxx/django/django_projects/eprbiomed/login/models.py 
>in UserProfile, line 20
>Python Executable: /xxx/Enviroment/bin/python2.5
>Python Version:2.5.0
>Template error
>
>In template 
>/xxx/django/django_src/django/contrib/admin/templates/admin/base.html, error 
>at line 28

Boiling it down I find the last good revision is 6390 for me.

>Index: base.html
>===
>--- base.html   (revision 6390)
>+++ base.html   (revision 6391)
>@@ -22,7 +22,14 @@
> {% block branding %}{% endblock %}
> 
> {% if user.is_authenticated and user.is_staff %}
>-{% trans 'Welcome,' %} {% if 
>user.first_name %}{{ >user.first_name|escape }}{%else 
>%}{{ user.username }}{% endif %}. {% block userlinks %}href="doc/">{% trans 'Documentation' %}/ href="password_change/">{% trans 'Change password' %} / href="logout/">{% trans 'Log out' %}{% endbl   ock 
>%}
>+
>+{% trans 'Welcome,' %} {% if user.first_name %}{{ 
>user.first_name|escape }}{% else %}{{ user.userna   me 
>}}{% endif %}.
>+{% block userlinks %}
>+{% trans 
>'Documentation' %}
>+/ {% 
>trans 'Change password' %}
>+/ {% trans 'Log 
>out' %}
>+{% endblock %}
>+
>{% endif %}
> {% block nav-global %}{% endblock %}
> 


Is there something I'm missing? No changes are made in
django.contrib.auth.views between 6390 and 6391.

Thanks.

jason


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread Jeremy Dunck

On 10/26/07, mamcxyz <[EMAIL PROTECTED]> wrote:
>
> > What's the type and value of "request.content"?  What's the type and
> > value of "text" ?
>
> self.response=

Err, please give the type and value of request.*content*, not request.  :)

...
> 'content-type': ('Content-Type', 'text/html; charset=utf-8')}
...
>
> (why is utf8)

There are several different charsets in play.
DEFAULT_CHARSET is the encoding sent back to the client.
FILE_CHARSET is the encoding of the template and initial sql files.
There's also TEST_DATABASE_CHARSET with is the DB encoding, of course,
but is only used when the test runner is creating your schema in the
test DB.

In any case, your DEFAULT_CHARSET is probably still UTF-8.  This
should be OK, assuming your internal bytestrings are UTF-8.  The
problem is clearly before the response, so we can worry about that
later.  :)

I dunno what DB you're using, but you might ensure that the DB created
for testing is using the same charset/encoding as your prod one.

> > Err, your comment seems to suggest you're just switching the CHARSET
> > parameter as a guess.  The files really *are* in some specific
> > charset, and the setting needs to agree.  :-/
>
> I click in file properties in komodo and tell me that my files are in
> utf8. However 2 o 3 (one are part in the response) stick to CP-1252,
> no matter what I do...

That's very interesting.  Perhaps you should get a text editor that
doesn't lie to you, or a hex editor that tells you what the text
editor is trying to do?  :)

> > ...And what rev were you at before 6601?
>
> Kick me, but I not take note on that :(. I'm sure was after the
> unicode branch merge and before changeset 5152 because my test break
> for the new "next" setting.

OK.  :)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Variable available to All users (static class?)

2007-10-26 Thread SmileyChris

Sounds like you want something like threading.local
It's not my area of expertise, but you may be able to pick up some
hints on how to use it from 
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

On Oct 27, 8:53 am, "William Battersea" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I'm probably describing this poorly because I've never done this and I come
> from a PHP background, but...
>
> Is there anyway that I can have some variable available to all the user
> sessions without resorting to a database.
>
> E.g. I suppose I want a variable 'busy'. If any user initiates a piece of
> code, it sets busy to 1, and when the process is over, it sets it to 0. If
> another user attempts to initiate the process while busy is 1, some other
> action is taken.
>
> I don't want to have to use a database to do this.
>
> And it might sound like a weird problem, but basically I have django
> triggering a physically process with a microcontroller (via serial
> communication).
>
> If I'm totally going about this the wrong way, please let me know.
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.10/1091 - Release Date: 10/24/2007
> 2:31 PM


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to write regex to parse "http://127.0.0.1:8000/user/login/?next=/user/1/add/"

2007-10-26 Thread SmileyChris

On Oct 27, 3:36 am, Brightman <[EMAIL PROTECTED]> wrote:
> thank u.
> how can i get it in request.POST?

By changing your form to 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread mamcxyz

> What's the type and value of "request.content"?  What's the type and
> value of "text" ?

self.response=

Doing a self.response.__dict__ I see this relevant values:
'content-type': ('Content-Type', 'text/html; charset=utf-8')}
META:{'CONTENT_LENGTH': None,
 'CONTENT_TYPE': 'text/html; charset=utf-8',
 'SERVER_PROTOCOL': 'HTTP/1.1'}>}]]], '_is_string': True, '_charset':
'utf-8', 'request':
 {'CONTENT_LENGTH': None, ...
  'CONTENT_TYPE': 'text/html; charset=utf-8'}, 'client':
,
  'template': [,
   ,
,
],
'_container': [u'\n Err, your comment seems to suggest you're just switching the CHARSET
> parameter as a guess.  The files really *are* in some specific
> charset, and the setting needs to agree.  :-/

I click in file properties in komodo and tell me that my files are in
utf8. However 2 o 3 (one are part in the response) stick to CP-1252,
no matter what I do...

> ...And what rev were you at before 6601?

Kick me, but I not take note on that :(. I'm sure was after the
unicode branch merge and before changeset 5152 because my test break
for the new "next" setting.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread Jeremy Dunck

On 10/26/07, mamcxyz <[EMAIL PROTECTED]> wrote:
>
> self.assertContains(self.response,u'Buscar:')
>   File "D:\Programacion\Python\Python24\lib\site-packages\django\test
> \testcases.py", line 111, in assertContains
> real_count = response.content.count(text)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 162: ordinal not in range(128)

What's the type and value of "request.content"?  What's the type and
value of "text" ?

> I must note that:
>
> settings.py have:
>
> LANGUAGE_CODE = 'es-CO'
> FILE_CHARSET = 'iso-8859-1' //with utf-8 I get a lot more

Err, your comment seems to suggest you're just switching the CHARSET
parameter as a guess.  The files really *are* in some specific
charset, and the setting needs to agree.  :-/

...And what rev were you at before 6601?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ANN: Security fix to i18n framework

2007-10-26 Thread Jacob Kaplan-Moss

Hello folks --

Today we're releasing a fix for a security vulnerability discovered in
Django's internationalization framework. The complete details are below,
but the executive summary is that you should updated to a fixed version
of Django immediately.

We are releasing point-releases of all effected Django versions. You can
download them at http://www.djangoproject.com/download/. Those tracking
trunk development should "svn update" as soon as possible.

Please direct any questions about this release to django-users
(http://groups.google.com/group/django-users).

Thanks!

Jacob Kaplan-Moss

Description of vulnerability


A per-process cache used by Django's internationalization ("i18n") system to
store the results of translation lookups for particular values of the HTTP
Accept-Language header used the full value of that header as a key. An
attacker could take advantage of this by sending repeated requests with
extremely large strings in the Accept-Language header, potentially causing a
denial of service by filling available memory.

Due to limitations imposed by web server software on the size of HTTP header
fields, combined with reasonable limits on the number of requests which may
be handled by a single server process over its lifetime, this vulnerability
may be difficult to exploit. Additionally, it is only present when the
"USE_I18N" setting in Django is "True". Nonetheless, all users of affected
versions of Django will be encouraged to update.

Affected versions
-

* Django trunk prior to revision [6608].
* Django 0.96
* Django 0.95 (including 0.95.1)
* Django 0.91

Resolution
--

New versions of Django containing this fix have been released today which
lter this caching mechanism to store shortened, normalized values and to
reject improperly-formatted headers.

These versions are called:

* Django 0.96.1 (replaces Django 0.96)
* Django 0.95.2 (replaces Django 0.95.1)
* Django 0.91.1 (replaces Django 0.91.1)

Anyone using a stable Django release should upgrade to one of these point
releases immediately. These fixed versions have already been provided to
maintainers of Django packages for various OS distributions and should be
released shortly.

Anyone tracking Django's trunk development should use Subversion to update
to at least revision [6608].

Additionally, these fixes have been committed to the various "bugfixes"
branches:

* http://code.djangoproject.com/svn/django/branches/0.91-bugfixes/
* http://code.djangoproject.com/svn/django/branches/0.95-bugfixes/
* http://code.djangoproject.com/svn/django/branches/0.96-bugfixes/

Anyone running custom versions of Django should download and apply the
patches directly. These patches are available at
http://media.djangoproject.com/patches/2007-10-26-security-fix/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Variable available to All users (static class?)

2007-10-26 Thread William Battersea

Hi,

I'm probably describing this poorly because I've never done this and I come
from a PHP background, but...

Is there anyway that I can have some variable available to all the user
sessions without resorting to a database.

E.g. I suppose I want a variable 'busy'. If any user initiates a piece of
code, it sets busy to 1, and when the process is over, it sets it to 0. If
another user attempts to initiate the process while busy is 1, some other
action is taken. 

I don't want to have to use a database to do this.

And it might sound like a weird problem, but basically I have django
triggering a physically process with a microcontroller (via serial
communication).

If I'm totally going about this the wrong way, please let me know.



No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.15.10/1091 - Release Date: 10/24/2007
2:31 PM
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Lost in why "UnicodeDecodeError" on changeset 6601

2007-10-26 Thread mamcxyz

I'm in the process to relaunch a django site. I build a dozen test
(finally!) for it and work correctly before.

I update django to changeset 6601 and get a lot of errors. I fix
almost all of them except this:

self.assertContains(self.response,u'Buscar:')
  File "D:\Programacion\Python\Python24\lib\site-packages\django\test
\testcases.py", line 111, in assertContains
real_count = response.content.count(text)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
162: ordinal not in range(128)

I must note that:

settings.py have:

LANGUAGE_CODE = 'es-CO'
FILE_CHARSET = 'iso-8859-1' //with utf-8 I get a lot more

I check that all the html files are encoded as utf-8 (I'm using the
komodo editor for this), and the site work fine when I browse it.

Only running the test fail.

The string with problems is:

"Búsqueda"

I don't know what todo to fix the root cause of this. Of course I can
html encode all the strings, but then what is the point of having
unicode?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: geodjango and MySQL

2007-10-26 Thread Justin Bronn

Greg,

A preliminary MySQL spatial backend was added last week in r6527.  The
documentation for the MySQL database API may be found at:
http://code.djangoproject.com/wiki/GeoDjangoDatabaseAPI#MySQL

You should be aware of MySQL's spatial limitations: (1) all spatial
queries are restricted to the MBR's (Minimum Bounding Rectangles) of
the geometries; (2) MySQL is completely ignorant of coordinate systems
and transformations; and (3) spatial indexes are only supported with
MyISAM tables (no transactions!).

Thus, all of if you're doing any sort of 'serious' GIS, you should
consider migrating to PostgreSQL/PostGIS as you will certainly run
into a wall trying to coerce MySQL's limited offerings into something
more.

-Justin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Limiting foreign key choices

2007-10-26 Thread myahya

I have two models: products and catregories. A product can belong to
exactly one category. To make navigation easier, I use nested
categories. I want to limit the admin's ability to add a product only
to the leaf categories (those with no children). So if I the following
structure
Electronics > Mobile Phones > Nokia
Electronics > Cameras
The admin can add product to the Nokia or Cameras categories.

Here is the code for my models (I got the Category model from a link
on this list):
**
from django.db import models

# Create your models here.
class Category(models.Model):
name = models.CharField(core=True, maxlength=200)
slug = models.SlugField(prepopulate_from=('name',))
parent = models.ForeignKey('self', blank=True, null=True,
related_name='child')
description = models.TextField(blank=True,help_text="Optional")

class Admin:
list_display = ('name', '_parents_repr')

def __str__(self):
p_list = self._recurse_for_parents(self)
p_list.append(self.name)
return self.get_separator().join(p_list)


def __unicode__(self):
p_list = self._recurse_for_parents(self)
p_list.append(self.name)
return self.get_separator().join(p_list)

def get_absolute_url(self):
if self.parent_id:
return "/tag/%s/%s/" % (self.parent.slug, self.slug)
else:
return "/tag/%s/" % (self.slug)

def _recurse_for_parents(self, cat_obj):
p_list = []
if cat_obj.parent_id:
p = cat_obj.parent
p_list.append(p.name)
more = self._recurse_for_parents(p)
p_list.extend(more)
if cat_obj == self and p_list:
p_list.reverse()
return p_list

def get_separator(self):
return ' :: '

def _parents_repr(self):
p_list = self._recurse_for_parents(self)
return self.get_separator().join(p_list)
_parents_repr.short_description = "Tag parents"

def save(self):
p_list = self._recurse_for_parents(self)
if self.name in p_list:
raise validators.ValidationError("You must not save a 
category in
itself!")
super(Category, self).save()



class product(models.Model):
name = models.CharField(core=True, maxlength=200)
slug = models.SlugField(prepopulate_from=('name',))
category = models.ForeignKey(Category, related_name='product
category')
description = models.TextField(blank=True,help_text="Optional")

class Admin:
list_display = ('name', 'category')

def __str__(self):
return self.name
*

I really appreciate 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: floatformat filter rendering problem

2007-10-26 Thread [EMAIL PROTECTED]

Thanks Karen it works now :-) .

On Oct 26, 6:50 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> Ah, looks like you are hitting an incompatibility between the new template
> variable resolution system (went into revision 6399, on 9/20) and the
> comment-utils code.  It's been reported against the comment-utils project:
>
> http://code.google.com/p/django-comment-utils/issues/detail?id=13
>
> ubernostrum notes that yes comment-utils needs to be updated but he's
> waiting to make sure the new API has settled.  In the meantime there is a
> (very simple) patch for comment-utils posted on that page that you can try
> to see if it fixes your problem.
>
> Karen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How would you cache a view that will never change?

2007-10-26 Thread Benjamin

You could also just create the page, and save it as static HTML and
then serve it via Apache, et. al.  If it never changes, this would
probably be the most efficient.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: accessing verbose_name and other field meta data

2007-10-26 Thread Luke

Thanks! I've been wondering how to access the individual fields, and
didn't know the objects implement a dictionary to get to them.  That
will be handy for the future.

On Oct 26, 11:36 am, "Phil Davis" <[EMAIL PROTECTED]> wrote:
> On 26/10/2007, Luke <[EMAIL PROTECTED]> wrote:
>
>
>
> > I am processing a form that is built from a model using
> > form_for_model.  In the model I specified a verbose_name for each
> > field.  I can, of course, get the form values through
> > form.cleaned_data when it is returned, but I cannot figure out where
> > verbose_name is located.  I need this to produce the output, and do
> > not want to repeat myself, since it is already defined in the model.
>
> See the section entitled "Complex template output" in newforms.txt
> documentation file which explains this very case.
>
> The answer is use {{form.FIELDNAME.label_tag}} in your template.
>
> Cheers,
>
> --
> Phil Davis


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: floatformat filter rendering problem

2007-10-26 Thread Karen Tracey
Ah, looks like you are hitting an incompatibility between the new template
variable resolution system (went into revision 6399, on 9/20) and the
comment-utils code.  It's been reported against the comment-utils project:

http://code.google.com/p/django-comment-utils/issues/detail?id=13

ubernostrum notes that yes comment-utils needs to be updated but he's
waiting to make sure the new API has settled.  In the meantime there is a
(very simple) patch for comment-utils posted on that page that you can try
to see if it fixes your problem.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: accessing verbose_name and other field meta data

2007-10-26 Thread Phil Davis

On 26/10/2007, Luke <[EMAIL PROTECTED]> wrote:
>
> I am processing a form that is built from a model using
> form_for_model.  In the model I specified a verbose_name for each
> field.  I can, of course, get the form values through
> form.cleaned_data when it is returned, but I cannot figure out where
> verbose_name is located.  I need this to produce the output, and do
> not want to repeat myself, since it is already defined in the model.

See the section entitled "Complex template output" in newforms.txt
documentation file which explains this very case.

The answer is use {{form.FIELDNAME.label_tag}} in your template.

Cheers,

-- 
Phil Davis

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



accessing verbose_name and other field meta data

2007-10-26 Thread Luke

I am processing a form that is built from a model using
form_for_model.  In the model I specified a verbose_name for each
field.  I can, of course, get the form values through
form.cleaned_data when it is returned, but I cannot figure out where
verbose_name is located.  I need this to produce the output, and do
not want to repeat myself, since it is already defined in the model.

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newbie: user proile in models

2007-10-26 Thread dunia

Gigs_ wrote:
> how do you people create user profile in models?
> i want to created user profile for users to register
> i have don it like this, but i have feeling that it could be better
>
> class PlayersProfile(models.Model):
> user = models.ForeignKey(User)
> first_name = models.CharField(maxlength=20)
> last_name = models.CharField(maxlength=20)
> email = models.EmailField()
> # some more models field
>
> def __unicde__(self):
> return self.first_name
>
> class Admin:
> pass
>
>
> >
>
>   
take a look at this:
http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
http://www.stonemind.net/blog/2007/04/13/django-registration-for-newbies/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: floatformat filter rendering problem

2007-10-26 Thread [EMAIL PROTECTED]

Okay this is the portion of the for loop in my template :

-
{% for object in latest %}

{{ object.headline|escape 
}}
 Posted on {{ object.pub_date|
date:"F j, Y" }} by {{ object.author }}
{{ object.summary }}
Read More

{% get_public_free_comment_count for blog.entry
object.id as comment_count %}
{{comment_count}} Comment{{comment_count|pluralize}}
|
Tagged with:
{% tags_for_object object as tag_list %}
{% for tag in tag_list %}
{{ tag }} 
{% endfor %}
---
And this is the traceback
-
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/template/__init__.py" in
render_node
  810. result = node.render(context)
File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py"
in render
  135. nodelist.append(node.render(context))
File "/usr/lib/python2.5/site-packages/comment_utils/templatetags/
comment_utils.py" in render
  21. object_id = template.resolve_variable(self.context_var_name,
context)
File "/usr/lib/python2.5/site-packages/django/template/__init__.py" in
resolve_variable
  643. return Variable(path).resolve(context)
File "/usr/lib/python2.5/site-packages/django/template/__init__.py" in
__init__
  677. self.literal = float(var)

  TypeError at /blog/
  float() argument must be a string or a number


On Oct 26, 5:24 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> A few more clues on this could help people help you.  What's latest?  What's
> the traceback associated with the exception?
>
> Karen
>
> On 10/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm running the svn version when django start rendering the template
> > it keeps raise this exception : float() argument must be a string or a
> > number , at line 11 and line 11 is {% for object in latest %}  I don't
> > understand what is the cause of this problem . any help ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



object persistence

2007-10-26 Thread Luke

In one of my django apps, I need to access another database that is
unrelated to django's db.  We are using psycopg to access this.  There
is some code running some calculations inside the db as a shared
object, and it is tied to a connection, so we need to keep it open and
not make a new connection each time the web page is accessed.
Therefore, we need a place to store a psycopg connection object
persistently.  I know there are sessions, but I think that would still
mean the destructor gets called and the connection gets closed when
the handler returns.

Is there any place we can create an object that never gets destroyed
and stays in memory as long as the django server is up and running (or
apache/mod_python, whatever).  Is this possible?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



hai wanna chat

2007-10-26 Thread puja





**FREE pics download**
Earnfre.blogspot.com







**FREE SONGS DOWNLOADS***



Earnfre.blogspot.com


**FREE SONGS DOWNLOADS***



Earnfre.blogspot.com



**FREE MOBILE SOFTWARE DOWNLOADS***

Earnfre.blogspot.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python 2.5, Postgres, Psycopg2 on OS X

2007-10-26 Thread Eric Abrahamsen
I had everything (Apache, mysql, mod_python etc) installed through  
macports but was still using Python from the built-in framework. That  
was giving me trouble, so I tried to switch over to using the  
macports Python installation, which came down as a dependency for  
Apache/mod_python.

Needless to say, now neither works. When I start apache and try to  
start my django project, I get a mod_python error. There's a long  
traceback, and halfway through the traceback the Python calls go from  
the opt/local installation (macports) back to the original Library/ 
Frameworks installation. Here's where it crosses over:

File "/opt/local/lib/python2.5/site-packages/django/core/handlers/ 
modpython.py", line 151, in __call__
 self.load_middleware()

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ 
site-packages/django/core/handlers/base.py", line 22, in load_middleware

The offending self.load_middleware(), on line 151, comes shortly  
after a os.environ.update(req.subprocess_env) call, and I suspect  
that that's somehow resetting the path to the old Python  
installation. I don't want to start poking things randomly, does this  
ring a bell for anyone?

Hopefully,
Eric


On Oct 26, 2007, at 9:19 PM, David Reynolds wrote:

>
>
> On 26 Oct 2007, at 2:37 am, Kristinn Örn Sigurðsson wrote:
>
>> Sorry if I wasn't clear about what I was talking about. :-)
>>
>> I'm using Darwin ports. They work similar to BSD ports (completely
>> different but the idea is probably from there). With that you can
>> install alot of *nix applications. The homepage for Darwin ports is
>> http://darwinports.com/. Darwin ports installs everything to a new
>> location, /opt/local, so it won't interrupt the base MacOSX system.
>> Fink which is an apt-get workalike is also a good package manager.
>> You can probably install everything from there as well. Fink
>> installs everything under /sw (you can change it).
>
> Macports [0] is, I think the more up to date version of that.
>
> [0] - http://www.macports.org/
>
> -- 
> David Reynolds
> [EMAIL PROTECTED]
>
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scaling the server

2007-10-26 Thread Michel Thadeu Sabchuk

Hi again Simon,

> @ Michel: I think the best approach is to use a separate IP for Lighttpd to
> listen on, but it should be equally easy to have Lighttpd listen on
> for example port 81.

Hum, understood. The last one question (I think :-P). The use of
apache to redirect connections to lighttpd through mod_proxy isn´t
appropriated, is it? I want to do some action now and this is the
easiest way to act, so I can have some time to install a server with
apache worker, python with shared libraries and maybe mod_wsgi...

Very thanks to all help, guys!
Best regards,


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: floatformat filter rendering problem

2007-10-26 Thread Karen Tracey
A few more clues on this could help people help you.  What's latest?  What's
the traceback associated with the exception?

Karen

On 10/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> I'm running the svn version when django start rendering the template
> it keeps raise this exception : float() argument must be a string or a
> number , at line 11 and line 11 is {% for object in latest %}  I don't
> understand what is the cause of this problem . any help ?
>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scaling the server

2007-10-26 Thread simonbun

@ Malcolm: I know, I didn't mean you'd need 31 separate Apache
processes at once. Most browsers only download a few files at once per
subdomain, but that usually still involves spawning new Apache
processes. How many is dependent on many factors of course. In the end
I still believe that KeepAlive should be on if Apache serves static
content.

@ Graham: Indeed, I should have mentioned that this is only for the
first request made by the client due to browser caching.

@ Michel: That's possible, but it's hard to tell from here. Monitoring
your system closely while it's under load should give you the answer.
Again, I can't tell from here if you need a second physical server,
but I would at least try running Lighttpd alongside Apache. Personally
I think the best approach is to use a separate IP for Lighttpd to
listen on, but it should be equally easy to have Lighttpd listen on
for example port 81.

regards,
Simon


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newbie: user proile in models

2007-10-26 Thread Gigs_

how do you people create user profile in models?
i want to created user profile for users to register
i have don it like this, but i have feeling that it could be better

class PlayersProfile(models.Model):
user = models.ForeignKey(User)
first_name = models.CharField(maxlength=20)
last_name = models.CharField(maxlength=20)
email = models.EmailField()
# some more models field

def __unicde__(self):
return self.first_name

class Admin:
pass


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to write regex to parse "http://127.0.0.1:8000/user/login/?next=/user/1/add/"

2007-10-26 Thread Brightman

thank u.
how can i get it in request.POST?

On Oct 26, 6:34 pm, Tomi Pievil inen <[EMAIL PROTECTED]> wrote:
> > but in python ,there is no problem
>
> That's because Django doesn't give you the whole URI, just the path
> component. "?" is a reserved character used to signal the start of
> the
> query component (seehttp://www.ietf.org/rfc/rfc2396.txt). In Django
> you
> access the query component through the request object 
> (seehttp://www.djangoproject.com/documentation/request_response/#querydic...).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How would you cache a view that will never change?

2007-10-26 Thread Kai Kuehne

Hi!

On Oct 26, 2007, at 4:07 AM, [EMAIL PROTECTED] wrote:

>
>> maybe I'm a bit confused (or tired) but
>> how would you go and cache a view that will *never*
>> change depending on a request on my application?
>
> Is the output something difficult for the view to generate?

No, it's just a massive amount of views. (14k)

> If not,
> you could just specify a very long cache expiration and let it
> regenerate itself as needed. If you're using memcached, it's going to
> be stored in RAM and is subject to being wiped out if the process
> restarts, so you really can't rely on  it being there. If it is an
> expensive view to process, the next request after the cache expiry
> would be an unlucky visitor; this may not be a great option in that
> case.

I thought about memcache too, but I have limited ram space and a lot
(14k) records that needs to be cached.

>
>> If I read the manual right, I have to give a timeout to
>> all the cache functions that are available. In my case I have
>> a view that will never change... so I don't really
>> know how to do this.
>
> If you *really* need it to write once, you could write a couple of
> methods that will write and load the output to/from the file system.

Ok, I think I really have to do that.

> At the beginning of your view, you could use the getter method to look
> on the filesystem for the file the same way the cache api does a
> lookup. (Keep in mind that filesystem lookups are going to incur more
> I/O latency than Memcached)

I don't think that memcached is faster than file io.
I may be wrong, but Fredrik Lundh stated that it's not the case [1]
(at least for his effbot page).

>
> FWIW, If you do follow this route, I'd suggest putting the filesystem
> path in your settings file to make the application more portable.
>
> Hope this helps.

Helps in the case that I was on the right road, thanks. :)
I thank you for your response. So it seems that I
do have to create it on my own.

If anyone did something like this before or has
performance tips or something else please share.

[1]: http://effbot.org/zone/zone-django-notes.htm

Greetings :)
Kai




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: which Django version to use for live site to be released in end of february 2008

2007-10-26 Thread web-junkie

We are running a production site with trunk. No problems so far. Just
watch any updates and update regularly.

On Oct 23, 5:00 pm, ydjango <[EMAIL PROTECTED]> wrote:
> I am working on product which will be released end of february. I am
> planning to use Django for building the site. I am new to Django
>
> Which version should I use - SVN or 0.96?
>
> If I use 0.96, I am worried migration to 1.0 will be very painful and
> time consuming.
> If I use SVN version , I am not sure how stable it is?
> Are there any production sites using the svn version.
> Can some one please recommend?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Large Admin Areas

2007-10-26 Thread Zenom

Let's say we had a bunch of legacy schemas in postgresql. Currently we
have like 6 schemas if we were to re-write our admin interface from
php to django we would need to write 6 projects 1 for each schema
essentially (if I apply the postgresql schema patches etc, but that's
beside the point).

My question would be this: Is it possible to maintain a login state
across all 6 projects, if they were situated at mysite.com/admin1
mysite.com/admin2 etc etc.  This way we could code each piece into
it's own admin?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python 2.5, Postgres, Psycopg2 on OS X

2007-10-26 Thread David Reynolds


On 26 Oct 2007, at 2:37 am, Kristinn Örn Sigurðsson wrote:

> Sorry if I wasn't clear about what I was talking about. :-)
>
> I'm using Darwin ports. They work similar to BSD ports (completely  
> different but the idea is probably from there). With that you can  
> install alot of *nix applications. The homepage for Darwin ports is  
> http://darwinports.com/. Darwin ports installs everything to a new  
> location, /opt/local, so it won't interrupt the base MacOSX system.  
> Fink which is an apt-get workalike is also a good package manager.  
> You can probably install everything from there as well. Fink  
> installs everything under /sw (you can change it).

Macports [0] is, I think the more up to date version of that.

[0] - http://www.macports.org/

-- 
David Reynolds
[EMAIL PROTECTED]



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: authentication on generic views

2007-10-26 Thread Marty Alchin

On 10/26/07, Hugh Bien <[EMAIL PROTECTED]> wrote:
> I haven't really used generic views that often, but I know you could always
> extend them by creating your own views.
>
> Inside your views.py:
>
>
> from django.views.generic.list_detail import object_list
>
> @login_required
> def my_list(*args, **kwargs):
> return object_list(*args, **kwargs)

Or even just:

from django.views.generic.list_detail import object_list
from django.contrib.auth.decorators import login_required

my_list = login_required(object_list)

And now my_list is a login-protected version of object_list. This is
also more compatible with older versions of Python, in case the app is
ever distributed.

Also note that this can be done either in views.py, or directly in
urls.py. It's your call.

-Gul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Newbie forms question:

2007-10-26 Thread schlam

so I am using the code from the Django documentation to processes
information from a form  with the code :

def edit_place(request, place_id):
try:
manipulator = Place.ChangeManipulator(place_id)

place = manipulator.original_object

if request.method == 'POST':
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
manipulator.do_html2python(new_data)
if not errors:
manipulator.save(new_data)

return HttpResponseRedirect("/places/edit/%i/" % place.id)
else:
errors = {}
new_data = manipulator.flatten_data()

form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('places/edit_form.html', {'form': form,
'place': place})

However in my post data from my form I don't return data for all the
values in my model. This is because I don't want the user to be able
to change some of these, only to see them. I am not sure how to fill
the new_data dict with the old values (ones not being returned from
the form in the post method) when saving to the db.
 I have tried using a value old_data=manipulator.flatten_data() and
making a comparison and but have got a error

argument of type 'long' is not iterable

Help?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: save() datefield

2007-10-26 Thread Thomas Guettler

Am Freitag, 26. Oktober 2007 10:53 schrieb äL:
> I use Django to manage addresses. To publish the data I have a list
> and a detailed view. In the detail view I can change the name,
> address, phone, etc. of the person. To do that I created an edit
> form.
>
> Now, everythin is fine. Only if I try to change and save the birthday
> (witch is a datefield) it doesn't work. Everthing else is no problem.
> Does anybody know why I cannot save datefields?

What mean "doesn't work"? Nothings happens? Do you get a traceback?

[cut]
> ## views.py ##
> def Karateka_save(request, karateka_id):
> from kav.info.models import Karateka, Country, Location, Dojo
> karateka = Karateka.objects.get(id = karateka_id)
>
> try:
> karateka.person.nameLast  = request['nameLast']
> karateka.person.nameFirst = request['nameFirst']
> karateka.person.address   = request['address']
> karateka.person.phone = request['phone']
> karateka.person.birthdate = request['birthdate']
> karateka.comment  = request['comment']
>
> karateka.save()
> karateka.person.save()
> except:
> return HttpResponseRedirect("/info/karateka-%d/edit" %
> int(karateka_id))
>
> return HttpResponseRedirect("/info/karateka-%d/" %
> int(karateka_id) )
> ## end views.py ##

this looks very strange. I guess you are new to python programming.

Some hints:

- don't catch all exceptions ("except:")
- keep only few (at best one line) between "try" and "except".
- birthday is of type datetime.date. You set it to a string.
- Have a look at newforms. form_for_model and form_for_instance
  might help you. You should use forms.DateField for the birthday.

 Thomas


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



LEARN FREE GET FREE

2007-10-26 Thread RATISH KAKKAD

Register with a2zlearning and get: * More than 1000 electronic book *
Lecture notes for Arts, Commerce, Science, Management * Multiple
Choice Questions for Competitive Exams * Case Studies for Management
Aspirants * Slide Shows on various subjects * Kids Games, Software,
Comic books etc

CLICK ON WWW.A2ZLEARNING.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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: management.call_command dumpdata does not return datastring

2007-10-26 Thread Ulf Kronman

Hi Jacob,

> The mangement modules are designed for use from the command-line, so
> this is expected behavior.

OK. But the peculiar thing is that I'm almost certain that I had it
working before (2 months ago) with the command:
str_datadump = management.call_command('dumpdata', str_application,
format='json', indent=2)

Apparently, things have changed since then, and if this is expected
behavior, I have to adhere to it.

I found a (somewhat silly) workaround by calling manage.py as a shell
command within my own script:
str_shell_command = './manage.py dumpdata ' + str_application + ' > '
+ str_output_file + ' --format=json --indent=2'
bool_result = commands.getstatusoutput(str_shell_command)

> If you're looking to convert data into a
> string, you'll want to use the serialization APIs directly, 
> seehttp://www.djangoproject.com/documentation/serialization/.

Aha, but this seems to be an unnecessary advanced way to do a simple
thing as just dump the contents of a whole application. But I see that
you may do narrower model selections with this command, so it's a good
tip for future use.

Thanks for your help,
Ulf


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scaling the server

2007-10-26 Thread Michel Thadeu Sabchuk

Hi again guys!

> > No, this isn't correct. No sane web browser requests every single URL at
> > once -- there is a maximum number of parallel connections they will open
> > for precisely this reason.
>
> And browser caching of static stuff like css files and images should
> hopefully ensure that such stuff isn't requested every time anyway.

And this explain why my server stucked last time. I changed the most
requested static files (a header used on online game pages), when I
changed it, the browser cache expired and tons of users have reloaded
the static file, then I hit 50 concurrent apache processes and my
server have stucked, could am I right?

Simon, do you tell me you don´t think I need a second phisical server
to use lighttpd. If I use the same server I can use different
approaches: have a second IP address and have lighttpd listen on this
another IP on port 80 or have a proxy application (could be the Pound
as Graham suggests me) or even have Apache redirecting media files
through mod_proxy (but this one I think is useless :-P). An
alternative IP address is the best approach, isn´t it?

I´ll read the other posts and follow your suggestions!
Thanks all help!
Best regards,

--
Michel Thadeu Sabchuk
MisterApe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to append a array for JSON use,thanks!

2007-10-26 Thread [EMAIL PROTECTED]

thanks very much, it is what i wanted.

On 10月26日, 下午4时54分, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> You want: '''{"version":...}''' this means you need to
> pass a dictionary to simplejson.dumps()
>
> mydict={"version":...,
>  "markers": content,
>  }...
> ..dumps(mydict)
>
> Am Freitag, 26. Oktober 2007 10:09 schrieb [EMAIL PROTECTED]:
>
>
>
> > i just want to use JSON in gmap, here is an alterative method for
> > UTF-8 character,
>
> > s = Suburb.objects.all()
>
> > contents = []
> > for ss in s.iterator():
> >contents.append({'html': ss.name,
> >  'label': ss.slug,
> > 'lat':ss.lat,
> > 'lng':ss.lng})
>
> > json = simplejson.dumps(contents, ensure_ascii=False)
> > return HttpResponse(json)
>
> > and the reslut is:
> > [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> > "sydney"},
> >  {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> > "chatswood"}]
>
> > i want the result as:
> > {"version":"1.0","encoding":"UTF-8",
> > "feed":{"xmlns":"http://www.w3.org/2005/Atom";,
> > "xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/";,
> > "xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended";,
> > "id":{"$t":"http://spreadsheets.google.com/feeds/list/
> > o16162288751915453340.4402783830945175750/od6/public/values"},
> > "updated":{"$t":"2007-04-03T18:28:50.311Z"},
> > "markers":
>
> >  [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> > "sydney"},
> >  {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> > "chatswood"}]
>
> > }}
>
> > how to write the code to append string in to   contents = []
>
> > thanks!- 隐藏被引用文字 -
>
> - 显示引用的文字 -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to write regex to parse "http://127.0.0.1:8000/user/login/?next=/user/1/add/"

2007-10-26 Thread AniNair

Are you trying to submit a html form?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: translation and flatpages

2007-10-26 Thread AniNair

Hi... Thanks for the help.Btw, Isn't 17 hours n 24 min 'a bit more
than' 16 hours? If not, then how much is 'bit more'? Please ignore if
you don't know. Do a google search?lol.Thanks all the same.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to write regex to parse "http://127.0.0.1:8000/user/login/?next=/user/1/add/"

2007-10-26 Thread Tomi Pievil inen

> but in python ,there is no problem

That's because Django doesn't give you the whole URI, just the path
component. "?" is a reserved character used to signal the start of
the
query component (see http://www.ietf.org/rfc/rfc2396.txt). In Django
you
access the query component through the request object (see
http://www.djangoproject.com/documentation/request_response/#querydict-objects).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to write regex to parse "http://127.0.0.1:8000/user/login/?next=/user/1/add/"

2007-10-26 Thread Brightman

for example:
in urls.py, i use " (r'^login/\?next=(?P.+)/$', 'login') " to
parse this url
http://127.0.0.1:8000/user/login/?next=/user/1/add/
but i can't get the value of variable 'next '  in login function

but in python ,there is no problem.
>>> import re
>>> a="login/?next=/user/1/add/"
>>> b=r'^login/\?next=(?P.+)/$'
>>> g=re.compile(b).match(a)
>>> g.group(1)
'/user/1/add'
>>> g.group('next')
'/user/1/add'


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: template variables

2007-10-26 Thread fisher

On Oct 13, 8:09 am, Goon <[EMAIL PROTECTED]> wrote:
> can you use variables in django's templates?
>
> so like {% for x in y %}
>
> and then something like
>
> {% int x =3; x++ %}

Recently I found some handy django snippet which can be usefull for
you.

http://www.djangosnippets.org/snippets/9/

--
Łukasz


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: authentication on generic views

2007-10-26 Thread Hugh Bien
I haven't really used generic views that often, but I know you could always
extend them by creating your own views.
Inside your views.py:

from django.views.generic.list_detail import object_list

@login_required
def my_list(*args, **kwargs):
return object_list(*args, **kwargs)

- Hugh

On 10/25/07, Mike Maravillo <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
> I'm using the django.views.generic.list_detail.object_list generic view
> because of the handy pagination.  However, I need to have the user accessing
> the page to be authenticated first.  Is there any other way than doing the
> check on the template?  Thanks very much.
>
> Mike
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to append a array for JSON use,thanks!

2007-10-26 Thread Thomas Guettler

You want: '''{"version":...}''' this means you need to
pass a dictionary to simplejson.dumps()

mydict={"version":...,
 "markers": content,
 }...
..dumps(mydict)

Am Freitag, 26. Oktober 2007 10:09 schrieb [EMAIL PROTECTED]:
> i just want to use JSON in gmap, here is an alterative method for
> UTF-8 character,
>
> s = Suburb.objects.all()
>
> contents = []
> for ss in s.iterator():
>   contents.append({'html': ss.name,
>  'label': ss.slug,
>'lat':ss.lat,
>'lng':ss.lng})
>
> json = simplejson.dumps(contents, ensure_ascii=False)
> return HttpResponse(json)
>
> and the reslut is:
> [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> "sydney"},
>  {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> "chatswood"}]
>
> i want the result as:
> {"version":"1.0","encoding":"UTF-8",
> "feed":{"xmlns":"http://www.w3.org/2005/Atom";,
> "xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/";,
> "xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended";,
> "id":{"$t":"http://spreadsheets.google.com/feeds/list/
> o16162288751915453340.4402783830945175750/od6/public/values"},
> "updated":{"$t":"2007-04-03T18:28:50.311Z"},
> "markers":
>
>  [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> "sydney"},
>  {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> "chatswood"}]
>
> }}
>
> how to write the code to append string in to   contents = []
>
> thanks!
>
>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



save() datefield

2007-10-26 Thread äL

I use Django to manage addresses. To publish the data I have a list
and a detailed view. In the detail view I can change the name,
address, phone, etc. of the person. To do that I created an edit
form.

Now, everythin is fine. Only if I try to change and save the birthday
(witch is a datefield) it doesn't work. Everthing else is no problem.
Does anybody know why I cannot save datefields?

Here is my code:

### CODE ###

## models.py ##
class Person(models.Model):
nameLast  = models.CharField ('Nachname', maxlength = 31)
nameFirst = models.CharField ('Vorname', maxlength = 31)
address   = models.CharField ('Adresse', maxlength = 63)
birthdate = models.DateField ('Geburtsdatum',   blank = True, null
= True,)
phone = models.CharField ('Telefon', blank = True, null =
True, maxlength = 47)

def __str__(self):
return "%s, %s " % (self.nameLast, self.nameFirst)

class Admin:
list_display = ('nameLast', 'nameFirst', 'address',
'location')
fields = (
('Personalien',{'fields': ('nameLast',
'nameFirst', 'address', 'location', 'birthdate', 'nation')}),
)

class Meta:
ordering = ('nameLast', 'nameFirst',)
verbose_name= "Person"
verbose_name_plural = "Personen"

class Karateka(models.Model):
person= models.ForeignKey   (Person, verbose_name = 'Person',
core = True)
comment   = models.TextField('Bemerkung', blank = True, null =
True)

def __str__(self):
return "%s" % (self.person)

class Admin:
list_display = ('person', 'bsc', 'skr', 'dojo')

def name_last(self):
return "%s" % (self.person.nameLast)

class Meta:
ordering = ('person',)
verbose_name= 'Karateka'
verbose_name_plural = 'Karatekas'
## end models.py ##

## views.py ##
def Karateka_save(request, karateka_id):
from kav.info.models import Karateka, Country, Location, Dojo
karateka = Karateka.objects.get(id = karateka_id)

try:
karateka.person.nameLast  = request['nameLast']
karateka.person.nameFirst = request['nameFirst']
karateka.person.address   = request['address']
karateka.person.phone = request['phone']
karateka.person.birthdate = request['birthdate']
karateka.comment  = request['comment']

karateka.save()
karateka.person.save()
except:
return HttpResponseRedirect("/info/karateka-%d/edit" %
int(karateka_id))

return HttpResponseRedirect("/info/karateka-%d/" %
int(karateka_id) )
## end views.py ##


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to append a array for JSON use,thanks!

2007-10-26 Thread [EMAIL PROTECTED]

l1 = [1, 2]
l1 += [3, 4]
[-1, 0] + l1

Regards,
Gustaf

On Oct 26, 10:09 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> i just want to use JSON in gmap, here is an alterative method for
> UTF-8 character,
>
> s = Suburb.objects.all()
>
> contents = []
> for ss in s.iterator():
> contents.append({'html': ss.name,
>  'label': ss.slug,
>  'lat':ss.lat,
>  'lng':ss.lng})
>
> json = simplejson.dumps(contents, ensure_ascii=False)
> return HttpResponse(json)
>
> and the reslut is:
> [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> "sydney"},
>  {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> "chatswood"}]
>
> i want the result as:
> {"version":"1.0","encoding":"UTF-8",
> "feed":{"xmlns":"http://www.w3.org/2005/Atom";,
> "xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/";,
> "xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended";,
> "id":{"$t":"http://spreadsheets.google.com/feeds/list/
> o16162288751915453340.4402783830945175750/od6/public/values"},
> "updated":{"$t":"2007-04-03T18:28:50.311Z"},
> "markers":
>
>  [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> "sydney"},
>  {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> "chatswood"}]
>
> }}
>
> how to write the code to append string in to   contents = []
>
> thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scaling the server

2007-10-26 Thread Graham Dumpleton


On Oct 26, 6:38 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-10-26 at 05:06 +, simonbun wrote:
> > > Well, I have another server available now ;)
>
> > And you're using it for serving static content I hope? Your previous
> > setup with Apache serving everything with KeepAlive off can bring many
> > a server to its knees. If you serve a html page with for example 30
> > css, js and image files, you make a single request that needs 31 free
> > Apache processes.
>
> No, this isn't correct. No sane web browser requests every single URL at
> once -- there is a maximum number of parallel connections they will open
> for precisely this reason.

And browser caching of static stuff like css files and images should
hopefully ensure that such stuff isn't requested every time anyway.

Graham


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: weird "can't adapt" error

2007-10-26 Thread sandro dentella

On 26 Set, 12:59, Sandro Dentella <[EMAIL PROTECTED]> wrote:
> Hi,
>
>   I'm meeting a weird problem in a django application.
>   It works w/o any problem from my pc connecting remotely to my customer's
>   apache but is not working inside the lan.
>
>   I'm connecting from firefox/ubuntu they're connecting from firefox/XP.
>
>   the weird part is that:
>
> 1. they have being working w/o probelms for 10 days and no modifications
>where made
>
> 2. the error complains "can'tadapt" as if trying to insert wrong types
>into the db, but the error trace shows the values are correct
>
> 3. a restart of apache fixes the problem
>
> 4. this is the second time the error happens...
>
>   Any hints?
>   TIA
>   sandro
>   *:-)

Hi,

  once again I stumble into this problem. This time I gathered some
more
  info so I describe them.

  I try to insert a record it fails from a Windows pc with Firefox
(and
  IE). It works from linux (firefox or galeon).

  When it fails the error message is "can't adapt" but

  1. the params in the log are:
  ('2007-10-26 08:50:03.651993', '2007-10-26 08:50:03.652039', 1, 17,
  '2007-10-26', u'2', Decimal("100"), 'h', u'prova in fi'

  2. from my linux box I print params before a *working* insert and I
get:
  ['2007-10-26 09:17:44.744656', '2007-10-26 09:17:44.744682', 1, 17,
'2007-10-26', u'2', Decimal("100"), 'h', u'prova']

   Not realy different

  3. When it fails the database is not hit. Db is postgres and I
switched on
 statement log on every log:

 log_min_duration_statement = 0

  4. If I restart apache the error is fixed

  I'm running mod_wsgi

What should I do, next time it happens to better investigate. It's
already
happened 4 times in 2 months and I cannot just accept it...

Thanks for any possible help

sandro
*:-)

the insert statement that worked follows:

INSERT INTO
"timereport_report" 
("date_create","date_last_modify","status","user_id","date","job_id","qty","unit","description")
VALUES ('2007-10-26 10:09:07.721575','2007-10-26 10:09:07.721619',
1,17,'2007-10-26','2',100,'h','prova in fi2')


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scaling the server

2007-10-26 Thread Malcolm Tredinnick

On Fri, 2007-10-26 at 05:06 +, simonbun wrote:
> > Well, I have another server available now ;)
> 
> And you're using it for serving static content I hope? Your previous
> setup with Apache serving everything with KeepAlive off can bring many
> a server to its knees. If you serve a html page with for example 30
> css, js and image files, you make a single request that needs 31 free
> Apache processes.

No, this isn't correct. No sane web browser requests every single URL at
once -- there is a maximum number of parallel connections they will open
for precisely this reason.

Regards,
Malcolm

-- 
A clear conscience is usually the sign of a bad memory. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



******FREE DOWNLOADS***********

2007-10-26 Thread kumar

**FREE DOWNLOADS***



Earnfre.blogspot.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



how to append a array for JSON use,thanks!

2007-10-26 Thread [EMAIL PROTECTED]

i just want to use JSON in gmap, here is an alterative method for
UTF-8 character,

s = Suburb.objects.all()

contents = []
for ss in s.iterator():
contents.append({'html': ss.name,
 'label': ss.slug,
 'lat':ss.lat,
 'lng':ss.lng})

json = simplejson.dumps(contents, ensure_ascii=False)
return HttpResponse(json)

and the reslut is:
[{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
"sydney"},
 {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
"chatswood"}]

i want the result as:
{"version":"1.0","encoding":"UTF-8",
"feed":{"xmlns":"http://www.w3.org/2005/Atom";,
"xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/";,
"xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended";,
"id":{"$t":"http://spreadsheets.google.com/feeds/list/
o16162288751915453340.4402783830945175750/od6/public/values"},
"updated":{"$t":"2007-04-03T18:28:50.311Z"},
"markers":

 [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
"sydney"},
 {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
"chatswood"}]

}}

how to write the code to append string in to   contents = []

thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



floatformat filter rendering problem

2007-10-26 Thread [EMAIL PROTECTED]

I'm running the svn version when django start rendering the template
it keeps raise this exception : float() argument must be a string or a
number , at line 11 and line 11 is {% for object in latest %}  I don't
understand what is the cause of this problem . any help ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: AsianAirfares.com Beats Closest Competitor 6 Out of 10 in International Travel Comparison

2007-10-26 Thread Ben van Staveren

>>
> The django-users list spam abuse has become nearly intolerable. As a
> subscriber to numerous other technically oriented mailing lists, I  
> very
> rarely have to deal with any spam whatsoever. Google Groups may be  
> free,
> but it is apparently not without cost.
>
> Cl

Next time, try to, you know, edit before you hit send. Quoting the  
entire spam just to add an observation that everyone already realised  
is quite useless. 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: AsianAirfares.com Beats Closest Competitor 6 Out of 10 in International Travel Comparison

2007-10-26 Thread Carl Holm

[EMAIL PROTECTED] wrote:
>  AsianAirfares.com Beats Closest Competitor 6 Out of 10 in
> International Travel Comparison
>
>
> AsianAirfares.com Beats Closest Competitor 6 out of 10 in
> International Travel Comparison (Car Rentals, Hotels, Air Tickets,
> Cruises).
>
> New York, NY, October 24, 2007 --(PR.com)-- AsianAirfares.com,
> http://www.asianairfares.com/ the recently launched Web site for low
> prices in international Travel, today released results from an
> independent, third party audit of online travel sites.
>
> The study reported AsianAirfares.com as having some of the lowest
> international travel deals on Car Rentals, Hotels, Airfares and
> Cruises versus top Asian US and European Internet travel web sites.
>
> AsianAirfares.com returned a lower Car Rentals, Hotels Rates and
> International Airfares nearly twice as its closest competition.
>
> Global air traffic is set to be boosted in the next three years by a
> rise in travel between US, Europe and Asia, thanks to growth in both
> China and India.
>
> The booming economies of China and India are set to fuel growth in
> passenger numbers. We are seeing the emergence of India and China as
> the major economic forces in the region. They will lead the next surge
> in travel.
>
> AsianAirfares.com is already providing its Global Consumers with a
> different kind of travel website experience and saving them time and
> money with a quick and easy way when booking.
>
> Book your next travel with AsianAirfares.com and make your new
> experience as pleasant as possible
>
> About Asianairfares.com
> AsianAirfares.com http://www.asianairfares.com/ invites you to
> discover their new online travel reservation system designed to save
> time and money. Now visitors to AsianAirfares.com can shop 24/7 for
> the best possible travel deals on hotel rooms, last-minute vacation
> packages, car rentals, cruises, airline tickets, and travel insurance.
>
> Travelers can select from over 55,000 hotels and resorts worldwide
> including 12,000+ Hot Rate hotels, 28 car rental companies, all major
> cruise lines and hundreds of airlines to book travel services
> instantly and securely.
>
> Through broad choices, low prices and excellent customer service,
> AsianAirfares.com and its wholly- owned subsidiaries -
> IndianAirfares.com, ValueAirtickets.com, AsianAirtickets.com,
> ValueAirlines.com , and NewAirtickets.com- (currently in Development)
> Can take you to where you want to go.
>
>
> >
>
>   
The django-users list spam abuse has become nearly intolerable. As a 
subscriber to numerous other technically oriented mailing lists, I very 
rarely have to deal with any spam whatsoever. Google Groups may be free, 
but it is apparently not without cost.

Cl



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---