Re: excellent slides

2011-01-06 Thread Cal Leeming [Simplicity Media Ltd]
This looks very useful! Good job.

On Fri, Jan 7, 2011 at 7:55 AM, Thomas  wrote:

>
> Just to share it with other newbies ...
>
> Today I have found these excellent slides (accompanied with explanations :)
> ), which could be helpful to bring some light to the darkness.
>
> quick example:
>
> http://toys.jacobian.org/presentations/2007/oscon/tutorial/images/django-master-class.032.png
>
> http://toys.jacobian.org/presentations/2007/oscon/tutorial/
> http://toys.jacobian.org/presentations/2008/softwaresummit/tutorial/
>
> have fun,
> TR
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



excellent slides

2011-01-06 Thread Thomas

Just to share it with other newbies ...

Today I have found these excellent slides (accompanied with explanations :) ), 
which could be helpful to bring some light to the darkness.

quick example:
http://toys.jacobian.org/presentations/2007/oscon/tutorial/images/django-master-class.032.png

http://toys.jacobian.org/presentations/2007/oscon/tutorial/
http://toys.jacobian.org/presentations/2008/softwaresummit/tutorial/

have fun,
TR


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



Re: list of lists in template

2011-01-06 Thread Subhranath Chunder
On Fri, Jan 7, 2011 at 12:22 PM, gintare  wrote:

>
> in view.py
> ...
> Ltarp.append([item.Wordword, item.WordTranslEn, item.WordNotesGram,
> item.WordConcl])
> ..
> Lans.append([sen.Sent, sen.SentTransl, Ltarp ] )
>
> in template.html
> {% if Lans %}
>
> {%  for smth in Lans %}
> 
>   {{smth.0}} 
>
>{%  for Ltarp in  smth.3 %}
>

Change this to:
{%  for Ltarp in  smth.2 %}

I think this is what you are trying to do.



>
> {{Ltarp.0}} 
>
>
>{% endfor %}
>
> 
> {% endfor %}
>
> {% endif %}
>
> ###
>
> the rows from smth.0 are shown
> the rows from  Ltarp in  smth.3, i.e. {{Ltarp.0}} are not shown.
>
> I tried also:Ltarp, Ltarp[0], smth.Ltarp.0
>
> nothing works in the second for cycle where i need to get items from
> list built in third item of list in the first for cycle.
>
> Could you please help with syntax, when i need to dislay item from
> list in another list in template
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
Thanks,
Subhranath Chunder.

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



Re: form handling in views.py

2011-01-06 Thread gintare
Thanks a lot, i just wanted to know how to use variables from query
directly. If you could advice, please write me.

I read Django documentation on beginning of 2010 and understood only
now on 2011 where forms are used. I mean if smbd never programmed
webpages the use of templates and forms is totally unclear from
Documentation, afterwards it is very useful when one understands how
web-pages are generated from them (There could be some chapter for
beginners - full working example: model, view, templates, forms ).

On Jan 4, 10:19 pm, Daniel Roseman  wrote:
> On Tuesday, January 4, 2011 6:31:30 PM UTC, gintare wrote:
>
> > Maybe smbd could give advice how data submitted from custom.html to
> > views.py are handled further?
>
> >    custom.html  with method  search1 ##
>
> >  
> > {% if Lp %}
> > {%  for item in Lp %}
> > 
> > 
>
> > 
> >  
>
> >   > value="{{ query.0|escape}}"> {{item.Word}}   
>
> >  
> > {{item.dateWord}}   
>
> > 
> > 
> > 
> > {% endfor %}
> > {% endif %}
> > 
>
> >    views.py  with method  search1 ##
>
> > def search1(request):
> >     request.encoding='utf-8'
> >     query = request.GET.get( 'q','')
>
> > The code above works when i have one button and one text area.
>
> > I do not understand
> >  how to find out which input was selected and
> >  how to read text from many text areas (how to relate several text
> > areas in row with single button in that row ) .
>
> > regards,
> > gintare
>
> Don't do any of that. Instead, read the excellent documentation about the
> very nice forms framework:http://docs.djangoproject.com/en/1.2/topics/forms/
> --
> DR.

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



list of lists in template

2011-01-06 Thread gintare

in view.py
...
Ltarp.append([item.Wordword, item.WordTranslEn, item.WordNotesGram,
item.WordConcl])
..
Lans.append([sen.Sent, sen.SentTransl, Ltarp ] )

in template.html
{% if Lans %}

{%  for smth in Lans %}

  {{smth.0}} 

{%  for Ltarp in  smth.3 %}

 {{Ltarp.0}} 


{% endfor %}


{% endfor %}

{% endif %}

###

the rows from smth.0 are shown
the rows from  Ltarp in  smth.3, i.e. {{Ltarp.0}} are not shown.

I tried also:Ltarp, Ltarp[0], smth.Ltarp.0

nothing works in the second for cycle where i need to get items from
list built in third item of list in the first for cycle.

Could you please help with syntax, when i need to dislay item from
list in another list in template

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



Re: new user having trouble connecting django to postgres with psycopg2

2011-01-06 Thread Subhranath Chunder
I guess you'll have to set it to 'Australia/ACT Australia/Canberra
Australia/NSW Australia/Sydney' in your settings.py instead.

Thanks,
Subhranath Chunder.


On Fri, Jan 7, 2011 at 6:22 AM, Mark Brazil  wrote:

> hi,
>
> I've been trying to find the answer to this for a bit, but haven't
> found anything suitable.
>
> I have postgresql 9.01, django 1.2.3 psycopg2 on ubuntu10.10
>
> When I try to use syncdb i get an error as follows
>
> "psycopg2.DataError: unrecognized time zone name"
>
> I currently have my settings.py set to "Australia/Sydney".
>
> I logged into postgres and set the TZ variable to AEST and started the
> database.
>
> But still get this.
>
> I'm guessing it is something simple, but cannot find the answer.
>
> Any ideas would be great,
> Thanks,
> Mark.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: User model being included by default

2011-01-06 Thread Subhranath Chunder
Firstly, I think this should be posted to the
django-us...@googlegroups.comgroup instead.
So, just make sure to post queries on using Django to there only.


Coming back to your question.
If you are using your own user model then, I hope you are using the not
using the import
'from django.contrib.auth.models import User' when try to '
User.objects.anymethod()'.
Make sure that you are using something like 'from yourapp.models import
User'.
And also make sure that the custom db tables for your app is properly
synced.

And when using some custom authentication backend in your application, I
think you'll probably want to specify and use it in your settings.py
as something probably like the following:
AUTHENTICATION_BACKENDS = (
'yourapp.backends.YourCustomBackend',
)

So, you'll also need to have the custom backend written too.

Thanks,
Subhranath Chunder.

On Fri, Jan 7, 2011 at 3:15 AM, Antony Vennard wrote:

> Hello all,
>
> For various reasons a client of mine requested that, other than using a
> framework of their choice, I implement an authentication system
> following their spec. I used Django and implemented my own app which
> contains the usual models.py which implements a user object and so on.
>
> Django has been updated via my package manager several times since I
> last tested my code. I've now come back to that and what was previously
> working is breaking like so:
>
> DatabaseError at /
> column auth_user.first_name does not exist
> LINE 1: SELECT "auth_user"."id", "auth_user"."username", "auth_user"...
>
> This happens when I import my own models.py and try to
> User.objects.anymethod()
>
> Now, my model "User" doesn't contain the same fields as Django's
> obviously, so the conclusion is that Django's User model is being
> included when I've not asked it to be.
>
> Relevant parts from Settings.py:
>
> TEMPLATE_LOADERS = (
>'django.template.loaders.filesystem.Loader',
>'django.template.loaders.app_directories.Loader',
>'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
>'django.middleware.common.CommonMiddleware',
>'django.contrib.sessions.middleware.SessionMiddleware',
>'django.middleware.csrf.CsrfViewMiddleware',
>'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> ROOT_URLCONF = 'Testbed.urls'
>
> TEMPLATE_DIRS = (
>"/var/www/Django/Testbed/testapp/templates",
>"/var/www/Django/Testbed/authadmin/templates",
> )
>
> AUTHENTICATION_BACKENDS = ('')
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>"vxd.auth.contexts.Authentication",
> )
>
> INSTALLED_APPS = (
>'django.contrib.contenttypes',
>'django.contrib.sessions',
>'django.contrib.sites',
>'reversetag',
>'markitup',
>'vxd.auth',
>'Testbed.authadmin',
>'Testbed.testapp',
> )
>
> Can anyone please explain what's changed?
>
> Likewise, I get various strange errors on a similar project using my
> system when I try to access the request.session["username"] key.
>
> An alternative is a project-wide rename; still, this isn't ideal.
>
> Thanks,
>
> A
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

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



Re: Japanese Text Sort Order

2011-01-06 Thread Keishi Katoux
Hi, James

This is supplementation of what Morimoto-san wrote.
I'm Japanese too.

You must use readings for ordering.
Japanese dictionary ordering is by pronunciation, not by alphabetical
order.
In English, 'food' is put at nearby 'foot'.
In Japanese, 'quick'(kwik) is put at nearby 'cuisine'(kwizi:n).
(Mmm, this is not good example...)

And the most important thing is something else.
Japanese people also can NOT get correct pronunciation only by string
written in kanji characters.
It may sounds funny, but it is true. (as same problem as James
mentioned about 大きい and 大学)

For example, '角田 純子'(woman name) has many readings.
Last name(角田) can be read Kakuta/Kakuda/Sumita/Tsunoda (and maybe
more!!).
First name(純子) can be read Junko/Sumiko.
And pairs of these Last/First name are ...

The standard (Morimoto-san mentioned) is very complicated.
Many of Japanese people doesn't know about this and some dictionary
publisher has another style. :-(

If you can get and use reading string in hiragana (or katakana),
its result is not so far off by unicode ordering.

And if your OS has correct locale, use locale.strcoll() simplly with
reading string.
I tested on Windows XP(Japanese codepage 932 console) and FreeBSD
7(Japanese UTF-8 locale console).
WinXP is OK and FreeBSD is NG on Japanese string.
WinXP is NG and FreeBSD is OK on German string with umlaut.
The result is attached last part of this mail.

FYI, I made loose translation of method in wikipedia entry Morimoto-
san mentioned.

1. convert kanji character or alphabetical word (loan word) to kana
reading
2. make character replacement
  i. replace small characters by base characters (ex.「ぁ」to「あ」, 「ゃ」 to
「や」 「っ」 to 「つ」)
 ii. replace consonants(some plosives and fricatives) by base
characters
 (ex. 「が」[ga] to 「か」[ka], 「ば」[ba]and「ぱ」[pa] to 「は」ha)
3. replace long sound「ー」 by pronunced character according to preposing
character
 if preposing character is
「あ」「か」「さ」「た」「な」「は」「ま」「や」「ら」「わ」 then 「あ」
「い」「き」「し」「ち」「に」「ひ」「み」「り」「ゐ」 then 「い」
「う」「く」「す」「つ」「ぬ」「ふ」「む」「ゆ」「る」 then 「う」
「え」「け」「せ」「て」「ね」「へ」「め」「れ」「ゑ」 then 「え」
「お」「こ」「そ」「と」「の」「ほ」「も」「よ」「ろ」「を」 then 「お」
「ん」 then 「ん」
 otherwise keep 「ー」
 (ex. 「あーるぬーぼー」[a-runu-bo-](aka. art nouveau)->「ああるぬうぼお」)

4. replace repeat character「ゝ」 with same character as preposing
character
  if preposing character exists and preposing character is not 「ー」
(long sound)

5. sort string in the followin order
「あ」「い」「う」「え」「お」「か」「き」「く」「け」「こ」「さ」「し」「す」「せ」「そ」「た」「ち」「つ」「て」「と」「な」「に」
「ぬ」「ね」「の」「は」「ひ」「ふ」「へ」「ほ」「ま」「み」「む」「め」「も」「や」「ゆ」「よ」「ら」「り」「る」「れ」「ろ」「わ」「ゐ」
「ゑ」「を」「ん」「ゝ」「ー」
6. if sort order value in step 5 is same priority, use rule below
  i. consonant order: unvoiced(ksth) > voiced(gzdb) > half voiced(p)
(ex. 「は」>「ば」>「ぱ」 similar to diacritical mark: 'Kloster' and
'Klöster')
  ii. long sound > small character > repeat character > other
character
  iii. hiragana > katakana

locale test result is below
On FreeBSD 7(Japanese utf-8 locale console)
> python
Python 2.5.4 (r254:67916, Oct  8 2009, 15:59:07)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1')
'de_DE.ISO8859-1'
>>> locale.strcoll(u'Kloster', u'Klöster')
-4
>>> locale.strcoll(u'Klosteranlage', u'Klöster')
97
(OK: Kloste ->Klöster->Klosteranlage)
>>> locale.setlocale(locale.LC_ALL, 'ja_JP.UTF-8')
'ja_JP.UTF-8'
>>> locale.strcoll(u'ウエット',u'ウェット')
1
>>> locale.strcoll(u'ウエット',u'ウェッド')
1
>>> locale.strcoll(u'ウエット',u'ウェッン')
1
>>> locale.strcoll(u'ウエット',u'ウェッタ')
1
>>> locale.strcoll(u'ウエット',u'うえっと')
96
(NG)

on WindowsXP(Japanese Shift_JIS locale commandline)
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'German_Germany.1252')
'German_Germany.1252'
>>> locale.strcoll(u'Kloster', u'Klöster')
1
>>> locale.strcoll(u'Klosteranlage', u'Klöster')
1
>>> locale.strcoll(u'Klosteranlage', u'Kloster')
1
>>> locale.strcoll(u'Klost', u'Kloster')
-1
>>> locale.strcoll(u'Klost', u'Klöster')
1
(NG on ''Japanese(ShiftJIS) codepage'' Windows: Klöster->Klost-
>Kloster->Klosteranlage )

>>> locale.setlocale(locale.LC_ALL, 'Japanese_Japan.932')
'Japanese_Japan.932'
>>> locale.strcoll(u'ウエット',u'ウェット')
1
>>> locale.strcoll(u'ウエット',u'ウェッド')
-1
>>> locale.strcoll(u'ウエッド',u'ウェット')
1
>>> locale.strcoll(u'ウエッド',u'ウェッド')
1
(OK: ウェット->ウエット->ウェッド->ウエッド)

>>> locale.strcoll(u'ウエット',u'ウェッン')
-1
>>> locale.strcoll(u'ウエット',u'ウェッタ')
1
(OK: ウェッタ->ウエット->ウェッン)

>>> locale.strcoll(u'ウエット',u'うえっと')
-1
>>> locale.strcoll(u'ウエッド',u'うえっと')
1
>>> locale.strcoll(u'ウエット',u'うえっど')
-1
>>> locale.strcoll(u'うえっと',u'うえっど')
-1
>>> locale.strcoll(u'ウエッド',u'うえっど')
-1
(almost OK:ウエット->うえっと->ウエッド->うえっど  hiragana/katakana in reverse from
standard?)

HTH

Keishi Katoux


On Jan 6, 10:39 pm, Tetsuya Morimoto 

Re: Retrieving data from Oracle DB table with column name containing special character

2011-01-06 Thread Ian
On Jan 6, 6:14 pm, Vikram  wrote:
> Hi,
>
> I have an existing table in my Oracle db called Sess. Few columns in
> this table have names that end with the character '#'. I am unable to
> run the command syncdb.
>
> Steps I did so far:
> 1. python manage.py inspectdb > models.py
> 2. Spruced up models.py to reflect only single table called Sess.
> 3. Running python manage.py syncdb

syncdb is only used to create tables.  If the table already exists,
then there is no reason to run it.

>   File "D:\Vikram\Personal\Python\django\database\monitor\models.py",
> line 15, in Sess
>     serial# = models.DecimalField(null=True, max_digits=10,
> decimal_places=2, blank=True)
> NameError: name 'serial' is not defined

The '#' symbol is not allowed in Python identifiers.  Python
interprets the statement above as being just the identifier 'serial',
and the rest of the line is interpreted as a comment.

You need to name the field as something that does not include the '#'
symbol and use the 'db_column' option to tell Django that the name of
the column in the database is different.  For example:

serial = models.DecimalField(null=True, max_digits=10,
decimal_places=2, blank=True, db_column='serial#')

Cheers,
Ian

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



Re: Beginner Django Person in Need of Help

2011-01-06 Thread Lachlan Musicman
On Fri, Jan 7, 2011 at 09:13, Fel  wrote:
> I'm a beginner Django person and I've written my first app...It's a
> products App that has 4 attributes: Name, Slug URL, Description and
> Image.
>
> I built my model, I have an ADMIN for it so I can add products via
> the /admin and now I want to create a view that shows all the products
> and when I click on one I want to see more of (has it's own url
> generated /products/PRODUCT_NAME) I want to only access that product
> on that page(Did that sentence make sense?)
>
> I'm running the latest version of django and python 2.6 on windows 7
> and i am also using WAMP server.

You haven't described your problem? You have explained what you want
to see, but not what you are seeing?

cheers
L.



-- 
"... imagine a puddle waking up one morning and thinking, 'This is an
interesting world I find myself in - an interesting hole I find myself
in - fits me rather neatly, doesn't it? In fact it fits me
staggeringly well, must have been made to have me in it!' This is such
a powerful idea that as the sun rises in the sky and the air heats up
and as, gradually, the puddle gets smaller and smaller, it's still
frantically hanging on to the notion that everything's going to be
alright, because this world was meant to have him in it, was built to
have him in it; so the moment he disappears catches him rather by
surprise."
Douglas Adams

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



new user having trouble connecting django to postgres with psycopg2

2011-01-06 Thread Mark Brazil
hi,

I've been trying to find the answer to this for a bit, but haven't
found anything suitable.

I have postgresql 9.01, django 1.2.3 psycopg2 on ubuntu10.10

When I try to use syncdb i get an error as follows

"psycopg2.DataError: unrecognized time zone name"

I currently have my settings.py set to "Australia/Sydney".

I logged into postgres and set the TZ variable to AEST and started the
database.

But still get this.

I'm guessing it is something simple, but cannot find the answer.

Any ideas would be great,
Thanks,
Mark.

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



Beginner Django Person in Need of Help

2011-01-06 Thread Fel
Hi All

I'm a beginner Django person and I've written my first app...It's a
products App that has 4 attributes: Name, Slug URL, Description and
Image.

I built my model, I have an ADMIN for it so I can add products via
the /admin and now I want to create a view that shows all the products
and when I click on one I want to see more of (has it's own url
generated /products/PRODUCT_NAME) I want to only access that product
on that page(Did that sentence make sense?)

I'm running the latest version of django and python 2.6 on windows 7
and i am also using WAMP server.

Thanks :)


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



Retrieving data from Oracle DB table with column name containing special character

2011-01-06 Thread Vikram
Hi,

I have an existing table in my Oracle db called Sess. Few columns in
this table have names that end with the character '#'. I am unable to
run the command syncdb.

Steps I did so far:
1. python manage.py inspectdb > models.py
2. Spruced up models.py to reflect only single table called Sess.
3. Running python manage.py syncdb

The step 3 fails with error:
__
  File "D:\Vikram\Software\PythonEncode\lib\site-packages\django\db
\models\loading.py", line 78, in load_app
models = import_module('.models', app_name)
  File "D:\Vikram\Software\PythonEncode\lib\site-packages\django\utils
\importlib.py", line 35, in import_module
__import__(name)
  File "D:\Vikram\Personal\Python\django\database\monitor\models.py",
line 12, in 
class Sess(models.Model):
  File "D:\Vikram\Personal\Python\django\database\monitor\models.py",
line 15, in Sess
serial# = models.DecimalField(null=True, max_digits=10,
decimal_places=2, blank=True)
NameError: name 'serial' is not defined
__

The code is as below:
__
from django.db import models

class Sess(models.Model):
saddr = models.TextField(blank=True) # This field type is a guess.
sid = models.DecimalField(null=True, max_digits=10,
decimal_places=2, blank=True)
serial# = models.DecimalField(null=True, max_digits=10,
decimal_places=2, blank=True)
audsid = models.DecimalField(null=True, max_digits=10,
decimal_places=2, blank=True)
paddr = models.TextField(blank=True) # This field type is a guess.
user# = models.DecimalField(null=True, max_digits=10,
decimal_places=2, blank=True)
__

Please advise how the '#' has to be interpreted here.

Thanks in advance,
Vikram

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



RE: an error happened to apache2and wsgi

2011-01-06 Thread Sells, Fred
I've seen similar errors if I left in  print >>sys.stderr  statements,
although that was using mod_python.

 

From: django-users@googlegroups.com
[mailto:django-us...@googlegroups.com] On Behalf Of Graham Dumpleton
Sent: Thursday, January 06, 2011 2:23 AM
To: django-users@googlegroups.com
Subject: Re: an error happened to apache2and wsgi

 

Which generally indicates that the HTTP client closed the connection
before all of the response could be written back.

 

There is no traceback because it is occurring after Django has returned
the response and mod_wsgi is trying to write/flush it back to HTTP
client.

 

By rights the 'Exception occurred' message should come before the
IOError line. I haven't looked yet why it isn't. :-(

 

Graham

On Thursday, January 6, 2011 5:48:44 PM UTC+11, CCC wrote:

site has runned based on apache and wsgi for a long time very well,but 
recently happened an error like this: 
[Sun Jan 02 20:41:02 2011] [error] [client ] IOError: failed to write 
data 
[Sun Jan 02 20:41:02 2011] [error] [client ] mod_wsgi (pid=2716): 
Exception occurred processing WSGI script '/usr/local/src/config/ 
mywsgi.wsgi'. 




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

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



Re: automated testing: how to generate human-verifiable views?

2011-01-06 Thread Jennifer Bell

Sorry if I confused people... I'm still looking for some feedback.
Really, I guess I just want to streamline CSS/layout/language/browser
testing so problems that commonly occur aren't discovered on the final
round of staging testing.

I imagine a test series like:

[ {
  series_name: payroll_screens,
  urls:  [ url1,url2... ]
  fixtures: payroll.json, employees.json
  },
...
]

And through a test url that puts a 'next/prev' widget somewhere like a
top bar, iterates through the urls (in an iframe?) while loading and
unloading fixtures.

Is this a really weird thing to want to do?  You can TDD almost
everything else in django through TestClient except for the end result
of how stuff looks.

Jennifer


On Jan 4, 6:21 pm, Jennifer Bell  wrote:
> OK, to elaborate: I have a open source project with consistent pain
> points around css and browser testing.  Example concrete issues for
> this project are a) multi-language support, as varying text length
> will often throw off the aesthetics of the layout, and b) recently, a
> mysterious failure in geodjango google-map drawing where in some
> corner-cases, the map silently fails to draw.
>
> Really, I'm looking for a framework for a human tester to be able to
> look at a sequence of html pages generated with different test data in
> the database.  I want the tester to be able make a 'pretty/ugly/
> horribly wrong' call without having to do a bunch of clicking or data
> entry.  Ideally, they would just click 'next' on some widget, which
> would pull up the next URL/test db combination.
>
> Jennifer
>
> On Jan 4, 5:18 pm, Nick Stinemates  wrote:
>
> > Can you elaborate a bit?
>
> > Are you interested in having the ui render and generate a screen shot
> > for human review? That's how I interpreted your question. If that's
> > the case, look in to generating a screenshot by leveraging a tool that
> > generates a png from HTML.
>
> > I am eager to hear what others think.
>
> > Nick
>
> > On Tuesday, January 4, 2011, Jennifer Bell  wrote:
> > > Hi,
>
> > > I'm trying to figure out the best way of doing something I'd like
> > > to partially automate staging testing by generating a sequence of
> > > human verifiable views, with the goal of making sure my app views/css/
> > > 3rd-party javascript etc. are drawing the way they ought to in more
> > > complicated scenarios.    While back end code can easily be tested
> > > with TestClient, failures in the 'final mile' of rendering are really
> > > annoying.
>
> > > It would be nice to have a 'view test mode' that allows a tester to
> > > click through a series of database configuration / URL pairs in a
> > > relatively painless way.
>
> > > Is there a standard way of doing this, or any existing modules I could
> > > use to achieve this?
>
> > > Jennifer
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=en.

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



Re: Django with PostgreSQL on Debian.

2011-01-06 Thread Thomas

for me it is working too

settings.py:
 "ENGINE": "django.db.backends.postgresql_psycopg2",


# aptitude search python-psycopg2 
i   python-psycopg2 - Python module for PostgreSQL  
  


good luck,
TR

Am 06.01.2011 um 17:36 schrieb Tonton:

> on my ubuntu 
> in the settings . py 
> 
> 'ENGINE': 'django.db.backends.postgresql_psycopg2', 
> 
> i've seen works with 
> 
> 'ENGINE': 'postgresql_psycopg2', 
> 
> On Thu, Jan 6, 2011 at 5:32 PM, Peter L. Berghold  wrote:
> Having gotten through the first few obstacles, I am now trying to build
> an app on a Debian based (Linux Mint, actually) and I am running into
> the following message when running the development server:
> 
> django.core.exceptions.ImproperlyConfigured: Error loading psycopg
> module: No module named psycopg
> 
> 
> If I am translating that correctly, Python is trying to tell me it is
> missing a module to talk to PostgreSQL.I've attempted to resolve
> this on my own by loading the following packages:
> 
> python-psycopg
> (obsolete package?)
> python-psycopg2
> 
> 
> Still getting the same error.  Can anybody steer me to the correct
> package?
> 
> 
> --
> Peter L. Berghold 
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: Iterating over dictionaries in template not working in Django 1.2.3

2011-01-06 Thread jeff aigner
I've solved the issue. The problem is that I was trying to iterate
over a ValidationError instead of it's message_dict. The changed code
for the view is below:

>  46                     try:
>  47                         u.full_clean()
>  48                         u.save()
>  49                     except ValidationError, e:
>  50                         unsaved_users.append([u,e.message_dict])

On Jan 6, 11:58 am, jeff aigner  wrote:
> I'm trying to create a page for mass user creation, and I'm having
> troubles iterating over the error dictionaries in the template. The
> dictionary I am trying to iterate over looks like this:
>
> {'username': [u'User with this Username already exists.']}
>
> But rather than iterating over this single item, the for loop in the
> template jumps right to the {% empty %} tag, despite the dictionary
> clearly having items in it.
>
> Here's what is in the view:
>
>  46                     try:
>  47                         u.full_clean()
>  48                         u.save()
>  49                     except ValidationError, e:
>  50                         unsaved_users.append([u,e])
>
> Where u is a User object
>
> Here's what is in the template:
>
>  9 {% for user, errors in unsaved_users %}
>  10 {{ user }} was not saved:
>  11     
>  12         {% for key,value in errors.items %}
>  13             {{ key }}: {{ value }}
>  14         {% empty %}
>  15             Django thinks I'm empty...
>  16         {% endfor %}
>  17     
>  18 {% endfor %}
>
> Any idea what's going on here? The only thing I can come up with is
> that the template language can't handle nested search of a list and
> then a dictionary.

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



OpenToken Spec & Single Sign On

2011-01-06 Thread Justin Murphy
Hello group,

Does anybody have experience with the OpenToken specification? It is
an authentication token that some (not many) applications use for SSO.

I found existing Perl module that encrypts and decrypts the token but
I need a Python version to use in a Django project. Not much luck
finding one on Google, so I am asking this group to see if anybody has
done this before so I don't need to re-create the wheel.

Here is a link to the specification - website will automatically try
and download PDF, sorry :(
http://www.pingidentity.com/support-and-downloads/download.cfm?item=11703

OpenToken Perl module on GitHub:
https://github.com/bleargh45/crypt-opentoken/

I appreciate your help!

Thanks,
Justin

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



Creating a System that allow to create sub-systems

2011-01-06 Thread Arruda
Hi there, I'm new here and kind of new to Django too, but after
messing with other things like Java, I was impressed in the agility
and facility that Django does things.

So here is the deal, I'm trying to create a site that allow the users
to have something like a small personal system.
And each sub-system can't talk to another, neither can access
functions from the main system(this one is just something that will
control all the sub-systems).

A friend of mine said something about using different threads for each
sub-system, how is that? Where can I start from to do a nice work?

Thanks!

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



Iterating over dictionaries in template not working in Django 1.2.3

2011-01-06 Thread jeff aigner
I'm trying to create a page for mass user creation, and I'm having
troubles iterating over the error dictionaries in the template. The
dictionary I am trying to iterate over looks like this:

{'username': [u'User with this Username already exists.']}

But rather than iterating over this single item, the for loop in the
template jumps right to the {% empty %} tag, despite the dictionary
clearly having items in it.

Here's what is in the view:

 46 try:
 47 u.full_clean()
 48 u.save()
 49 except ValidationError, e:
 50 unsaved_users.append([u,e])

Where u is a User object

Here's what is in the template:

 9 {% for user, errors in unsaved_users %}
 10 {{ user }} was not saved:
 11 
 12 {% for key,value in errors.items %}
 13 {{ key }}: {{ value }}
 14 {% empty %}
 15 Django thinks I'm empty...
 16 {% endfor %}
 17 
 18 {% endfor %}

Any idea what's going on here? The only thing I can come up with is
that the template language can't handle nested search of a list and
then a dictionary.

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



Re: manage.py makemessages doesn't create .po files

2011-01-06 Thread skazhy
Nope, the same as above, no .po files.

On 6 Janv., 19:00, maclin kallat  wrote:
> Try using the -e option for adding the extensions.
>
> django-admin.py makemessages -l=lv -e=html,htm
>
> 
> From: skazhy 
> To: Django users 
> Sent: Thu, 6 January, 2011 16:45:59
> Subject: Re: manage.py makemessages doesn't create .po files
>
> I tried running it with the djang-admin.py, same errors as with
> manage.py.
>
> Karlis
>
> On 6 Janv., 18:30, Shawn Milochik  wrote:
>
> > It appears that 'makemessages' is meant to be run with django-admin.py,
> > not manage.py.
>
> >http://docs.djangoproject.com/en/dev/topics/i18n/localization/
>
> > Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



I get an error when I used urllib2.urlopen() to open a remote file in a ftp server

2011-01-06 Thread Ariel
Hi everybody:

I get an error when I used urllib2.urlopen() to open a remote file in a ftp
server, what I am trying to do is to make a view to force the browser to
download a file to disk instead of playing or displaying it. My code is the
following:

file = 'ftp:/16.168.250.14:2189/RTVE/VIDEOS/Thisisit.wmv'
mydata = urllib2.urlopen(file)
response = HttpResponse(mydata, mimetype='video/mpeg')
response['Content-Disposition'] = 'attachment; filename=video.wmv'
response['url'] = file
return response

But I get an error 'no host given':

  File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
  File "/usr/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
  File "/usr/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 1316, in ftp_open
raise URLError('ftp error: no host given')
URLError: 

Any idea how to solve this ? Could you help me please ?
Regards
Ariel

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



Re: manage.py makemessages doesn't create .po files

2011-01-06 Thread maclin kallat
Try using the -e option for adding the extensions.

django-admin.py makemessages -l=lv -e=html,htm




From: skazhy 
To: Django users 
Sent: Thu, 6 January, 2011 16:45:59
Subject: Re: manage.py makemessages doesn't create .po files

I tried running it with the djang-admin.py, same errors as with
manage.py.

Karlis

On 6 Janv., 18:30, Shawn Milochik  wrote:
> It appears that 'makemessages' is meant to be run with django-admin.py,
> not manage.py.
>
> http://docs.djangoproject.com/en/dev/topics/i18n/localization/
>
> Shawn

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


  

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



Together we can make a difference

2011-01-06 Thread satyandra babu
Hi

This year make a resolution that lasts not for a week, not for a month, not
for a lifetime, but FOREVER. Start this decade with a good.. Help someone to
see the MISSING COLOURS in their life.



A startup NGO is conducting a survey to analyze trends about EYE DONATION
and ITS AWARENESS IN INDIA to come up with some innovative solution to
support the cause.



All you need to do is spend 4 minutes of your precious time for filling out
this survey @ *http://www.eyedonation.in/survey *



 You can help them by:

  1. Filling out online survey @ *http://www.eyedonation.in/survey*

  2. Asking your friends, family member of any age group to fill this survey

  3. Posting http://www.eyedonation.in to your Social Network ex. Facebook,
Twitter, Orkut etc.

  4. Forwarding this email to your group.



For more details you can subscribe at http://www.eyedonation.in



REMEMBER: Your small steps can make big changes to someone’s life... spare
some of your time for someone's better life...


* *Please send this message which can help someone see. *  *



 "Helping hands are better than Praying Lips".



 Pass this, to all you know, & whom you don't know.. together we can and, we
will make a difference!

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



Re: manage.py makemessages doesn't create .po files

2011-01-06 Thread skazhy
I tried running it with the djang-admin.py, same errors as with
manage.py.

Karlis

On 6 Janv., 18:30, Shawn Milochik  wrote:
> It appears that 'makemessages' is meant to be run with django-admin.py,
> not manage.py.
>
> http://docs.djangoproject.com/en/dev/topics/i18n/localization/
>
> Shawn

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



Re: Django with PostgreSQL on Debian.

2011-01-06 Thread Tonton
on my ubuntu
in the settings . py

'ENGINE': 'django.db.backends.postgresql_psycopg2',

i've seen works with

'ENGINE': 'postgresql_psycopg2',

On Thu, Jan 6, 2011 at 5:32 PM, Peter L. Berghold wrote:

> Having gotten through the first few obstacles, I am now trying to build
> an app on a Debian based (Linux Mint, actually) and I am running into
> the following message when running the development server:
>
> django.core.exceptions.ImproperlyConfigured: Error loading psycopg
> module: No module named psycopg
>
>
> If I am translating that correctly, Python is trying to tell me it is
> missing a module to talk to PostgreSQL.I've attempted to resolve
> this on my own by loading the following packages:
>
> python-psycopg
> (obsolete package?)
> python-psycopg2
>
>
> Still getting the same error.  Can anybody steer me to the correct
> package?
>
>
> --
> Peter L. Berghold 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Django with PostgreSQL on Debian.

2011-01-06 Thread Peter L. Berghold
Having gotten through the first few obstacles, I am now trying to build
an app on a Debian based (Linux Mint, actually) and I am running into
the following message when running the development server:

django.core.exceptions.ImproperlyConfigured: Error loading psycopg
module: No module named psycopg


If I am translating that correctly, Python is trying to tell me it is
missing a module to talk to PostgreSQL.I've attempted to resolve
this on my own by loading the following packages:

python-psycopg
 (obsolete package?) 
python-psycopg2 


Still getting the same error.  Can anybody steer me to the correct
package? 


-- 
Peter L. Berghold 

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



Re: manage.py makemessages doesn't create .po files

2011-01-06 Thread Shawn Milochik
It appears that 'makemessages' is meant to be run with django-admin.py, 
not manage.py.


http://docs.djangoproject.com/en/dev/topics/i18n/localization/

Shawn

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



manage.py makemessages doesn't create .po files

2011-01-06 Thread skazhy
Hi!

I tried running "manage.py makemessages -l lv" in the project root
dir. At first I got the following error:

Error: This script should be run from the Django SVN tree or your
project or app tree. If you did indeed run it from the SVN checkout or
your project or application, maybe you are just missing the conf/
locale (in the django tree) or locale (for project and application)
directory? It is not created automatically, you have to create it by
hand if you want to enable i18n for your project or application.

Then I created the locale folder in the project root dir manually and
ran the command again. It created folders locale>lv>LC_MESSAGES. But
there were no files in the LC folder. I have all my translation
strings in templates (with {% trans abc %} syntax). I tried making
the .po file manually like  msgid "abc" msgstr "Some local
translation", I compiled them, but they didn't appear in the browser.
I've got the following questions:

1. If I create .po files manually, what I should write after the # in
the first line (I had no # line in my .po file)?
2. What could be wrong with the makemessages that it doesn't work?

I am using the 1.2.4 version on Arch Linux

Thanks in advance,
Karlis

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



Re: Beginner questions: on the official polls tutorial

2011-01-06 Thread skazhy
3. You need to restart it only after you modify apache config files.

On 6 Janv., 02:52, Zheng  wrote:
> I started with the official tutorial to build the polls app.
> Everything works fine. I then tried to use wsgi on Apache. Everything
> still works, though with some defects explained below. I have a few
> questions to ask as a beginner:
>
> Assume I create mysite under E:\www.
>
> 1. In the settings.py file, there is a line to set the ROOT_URLCONF:
>
> ROOT_URLCONF = 'mysite.urls'
>
> However, sys.path is configured to contain 'E:\www\mysite' not 'E:
> \www'. So how can python find the module mysite.urls? In the tutorial
> example, everything works fine, and I don't know why. When I moved to
> wsgi+Apache, I had to either add 'E:\www' to sys.path or change
> 'mysite.urls' to 'urls' to make things work.
>
> 2. After I moved to wsgi+Apache, the 'fancy' admin site was gone.
> Although the basic functions seem to be still there, each page became
> plain text as in the polls app.
>
> 3. Do I have to restart the apache server every time after I add,
> modify or remove files?
>
> Thanks,
> Zheng

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



Re: Ordering columns in from clause

2011-01-06 Thread Ian Clelland
On Thu, Jan 6, 2011 at 7:35 AM, Vlastimil Zima  wrote:
> Recently I found out that distinct() can not be called on queries that
> are ordered as the result query is kind of
>
> SELECT DISTINCT table.id, table.ordering_column FROM table ORDER BY
> table.ordering_column ASC
>
> In ticket http://code.djangoproject.com/ticket/11568 was said that
> this will not be fixed, bacuse this is intentional behaviour of
> ordering.
>
>
> So code
>
> SomeModel.objects.order_by('ordering_column').values_list('pk')
>
> leads to SQL
>
> SELECT table.id, table.ordering_column FROM table ORDER BY
> table.ordering_column ASC
>
> instaed of simple
>
> SELECT table.id FROM table ORDER BY table.ordering_column ASC
>
> My question is, what is the intention? I could not find out any
> advantage that comes from this kind of query.

It is not valid SQL to order by a column that is not in the result set.

MySQL allows you to do that, but that is a MySQL-specific feature.
PostgreSQL, certainly, does not allow this, and there is no real
advantage gained (aside from a slightly smaller response) by excluding
the ordering column.



Regards,
Ian Clelland


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



Ordering columns in from clause

2011-01-06 Thread Vlastimil Zima
Recently I found out that distinct() can not be called on queries that
are ordered as the result query is kind of

SELECT DISTINCT table.id, table.ordering_column FROM table ORDER BY
table.ordering_column ASC

In ticket http://code.djangoproject.com/ticket/11568 was said that
this will not be fixed, bacuse this is intentional behaviour of
ordering.


So code

SomeModel.objects.order_by('ordering_column').values_list('pk')

leads to SQL

SELECT table.id, table.ordering_column FROM table ORDER BY
table.ordering_column ASC

instaed of simple

SELECT table.id FROM table ORDER BY table.ordering_column ASC

My question is, what is the intention? I could not find out any
advantage that comes from this kind of query.

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



Re: Massive insertion of records

2011-01-06 Thread Thomas Weholt
Just want to mention DSE which is especially made to solve problems
with mass insert and/updates in django:

http://pypi.python.org/pypi/dse/0.3.0

Regards,
Thomas

On Wed, Dec 29, 2010 at 1:22 PM, Derek  wrote:
> Thanks Craig - that explains it very clearly indeed ("textbook answer"!)
>
> On 27 December 2010 16:50, W. Craig Trader  wrote:
>>
>> Derek ...
>>
>> Quoting from http://docs.djangoproject.com/en/1.2/topics/db/transactions/:
>>>
>>> Django’s default behavior is to run with an open transaction which it
>>> commits automatically when any built-in, data-altering model function is
>>> called. For example, if you call model.save() or model.delete(), the change
>>> will be committed immediately.
>>>
>>> This is much like the auto-commit setting for most databases. As soon as
>>> you perform an action that needs to write to the database, Django produces
>>> the INSERT/UPDATE/DELETE statements and then does the COMMIT. There’s no
>>> implicit ROLLBACK.
>>
>> Using the Django transaction API, you can manually control transactions.
>> In this case, Silva must be doing something like this:
>>
>> from django.db import transaction
>>
>> @transaction.commit_manually
>> def viewfunc(request):
>>
>>
>>
>> ...
>> # You can commit/rollback however and whenever you want
>> i = 0
>> for x in data:
>> ... save something ...
>> i += 1
>> if i % 1000:
>>
>> transaction.commit()
>>
>> # One last commit to persist the last batch of saves
>> transaction.commit()
>>
>>
>>
>>
>> I will also note that the transaction API can be (and should be) used when
>> you're writing management commands.
>>
>>  - Craig -
>>
>> On Mon, Dec 27, 2010 at 05:29, derek  wrote:
>>>
>>> Can you explain what you mean by "manual commitments" (preferably with
>>> a code example)?
>>>
>>> Thanks
>>> Derek
>>>
>>> On Dec 26, 4:38 am, Silva Paulo  wrote:
>>> > OK. I found a "solution".
>>> > Using manual commitments after lots of insertions (ex. >1000) makes the
>>> > massive insertion very fast (at least for my needs).
>>> >
>>> > Thanks to all who answered.
>>> >
>>> > --- On Fri, 12/24/10, Silva Paulo  wrote:
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > > From: Silva Paulo 
>>> > > Subject: Massive insertion of records
>>> > > To: "newbie" 
>>> > > Date: Friday, December 24, 2010, 6:26 PM
>>> > > I need to do a massive insertion of
>>> > > records in two tables "connectd" by "foreignkey". Is there a
>>> > > way, using the Django db API, to do it. e=Foo(...);e.save()
>>> > > seems too slow.
>>> >
>>> > > Thanks
>>> >
>>> > >
>>> >
>>> > > --
>>> > > You received this message because you are subscribed to the
>>> > > Google Groups "Django users" group.
>>> > > To post to this group, send email to django-us...@googlegroups.com.
>>> > > To unsubscribe from this group, send email to
>>> > > django-users+unsubscr...@googlegroups.com.
>>> > > For more options, visit this group
>>> > > athttp://groups.google.com/group/django-users?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



ANN: dse 0.3.0 DSE - Delayed SQL Executor

2011-01-06 Thread Thomas Weholt
Just released a new version of DSE for django and would like to get
comments, flames, whatever.

http://pypi.python.org/pypi/dse/0.3.0

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Re: Japanese Text Sort Order

2011-01-06 Thread Tetsuya Morimoto
Hi, James

I'm Japanese.

> Any other suggestions or ways to correctly sort Japanese Words?
Though I'm not well versed in ordering Japanese words,
my friend told me the standards named "JIS X 4061:1996".

That's the standards using for Japanese dictionary(not python) or
Japanese book index.
The ja.wikipedia has an overview of that if you can read Japanese.
http://ja.wikipedia.org/wiki/日本語文字列照合順番

Also, you can buy the specification of the standards, but it seems
Japanese only.
http://www.webstore.jsa.or.jp/webstore/Com/FlowControl.jsp?lang=en=JIS+X+4061%3A1996=JIS=1=0

I found the implementation with Perl. Maybe, there is no Python implementation.
http://search.cpan.org/~sadahiro/Lingua-JA-Sort-JIS-0.05/JIS.pod

I hope this helps.

thanks,
Tetsuya


On Thu, Jan 6, 2011 at 7:31 PM, James Hancock  wrote:
> Wow, I have no idea what you just said... but, I think I agree.
>
> If I am right, what you are saying is, because the same kanji has multiple
> readings and the words are sorted by reading and not the kanji itself, that
> dictionary is going to be impossibly difficult to make.
>
> quick example, skip if you want to
> ->
> 大学 is read "daigaku" and means college
> 大き is read "Ōki" and means big.
>
>
> The 大 is read "dai" in one and "O" in the other. Giving the character a
> priority would not make it sort the right way because the order desired is
> by the reading, and the reading is all about the context of the characters.
>
> giving the character a value would make it be:
>
> 大き (Oki)
> 大学 (Daigaku
> 最高 (Saiko - means the best, because Django is the best!)
>
> When really, alphabetically it is:
>
> 大き (Oki)
> 最高 (Saiko)
> 大学 (Daigaku)
>
> <--
> End of Example:
>
>
> Man, the Japanese where not thinking about programming when they made their
> language.
>
> Any other suggestions or ways to correctly sort Japanese Words?
>
> Cheers,
> James Hancock
>
> On Thu, Jan 6, 2011 at 5:38 PM, Masklinn  wrote:
>>
>> On 2011-01-06, at 07:23 , Sam Walters wrote:
>> > Hi,
>> > Personally I would map the priority of every character in a dict and
>> > pass this to sorted
>>
>> Given Japanese is not an alphabetical language and mixes syllabic and
>> logographic scripts (the logographic system having a few thousand
>> graphemes), I doubt this kind of trivial ideas is going to work correctly
>> (it only works correctly for simple alphabetical engines, even diacritics
>> are going to cause an explosion in the number of cases)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: clever 404 pages

2011-01-06 Thread sunn
Use a custom 404 handler view:
http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views

On Jan 6, 2:45 pm, shofty  wrote:
> has anyone ever written or read an article on creation of clever 404
> pages in django sites?
>
> i'd like to know if its possible to capture the url requested and
> maybe push back a quick search on the terms in the url, rather than
> just telling the user that the page has disappeared in the transition
> to a new site.

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



Re: Japanese Text Sort Order

2011-01-06 Thread Thuy Nhien Doan
On Thu, Jan 6, 2011 at 5:31 PM, James Hancock  wrote:

> Wow, I have no idea what you just said... but, I think I agree.
>
> *Man, the Japanese where not thinking about programming when they made
> their language*.
>
> Any other suggestions or ways to correctly sort Japanese Words?
>
> Cheers,
> James Hancock
>
>
lol Japanese people are weird, I got lot of jap friends. but still find them
cute.

-- 
Thuy Nhien DOAN
Mobile phone: +84 923 862 630
OFFSHORING 2.1
-
“Your heart is my piñata.”

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



404 on Django admin

2011-01-06 Thread mostly_harmless
I installed the django admin interface recently following instructions
from the djangobook
I created a superuser and all. I am able to login
But whenever I click on any link in the admin interface, I get a 404.
Please help where I might be wrong. I am completely new to Django.

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



Re: Bug when OR'ing an empty Q() with a non-empty Q()?

2011-01-06 Thread bruno desthuilliers
On 6 jan, 04:14, Karen Tracey  wrote:
>
> Near as I can tell the doc doesn't say anything about what effect an empty
> Q() is supposed to have, so I don't know if the behavior you describe is a
> bug or not.
>
> However, the behavior you describe makes sense to me if you take the view
> that and empty Q() just doesn't apply any conditions to the query, and
> generates no SQL.

>>> PageInternet.objects.count()
13
>>> PageInternet.objects.filter().count()
13
>>> PageInternet.objects.filter(Q()).count()
13
>>>

Obviously calling qs.filter without args yields the same results as
calling qs.all - which makes sense to me - and calling qs.filter with
an empty Q yields the same result as calling it without args - which
also makes sense.

Now:

>>> PageInternet.objects.filter(id="PAG-INT.2010-12-20.015182").count()
1
>>> PageInternet.objects.filter(id="PAG-INT.2010-12-20.015182-yadda").count()
0
>>> q1 = Q(id="PAG-INT.2010-12-20.015182") | 
>>> Q(id="PAG-INT.2010-12-20.015182-yadda")
>>> PageInternet.objects.filter(q1).count()
1
>>> connection.queries[-1]['sql']
u'SELECT COUNT(*) FROM `page_internet` INNER JOIN `content` ON
(`page_internet`.`content_id` = `content`.`content_id`) WHERE
(`content`.`id` = PAG-INT.2010-12-20.015182  OR `content`.`id` = PAG-
INT.2010-12-20.015182-yadda )'
>>> q2 = Q() | Q(id="PAG-INT.2010-12-20.015182-yadda")
>>> PageInternet.objects.filter(q2).count()
0
>>> connection.queries[-1]['sql']
u'SELECT COUNT(*) FROM `page_internet` INNER JOIN `content` ON
(`page_internet`.`content_id` = `content`.`content_id`) WHERE
(`content`.`id` = PAG-INT.2010-12-20.015182-yadda )'
>>>

The empty Q doesn't generate a where clause, indeed - so from this POV
it's not "a bug" if OR'ing an empty Q with a non-empty one yields the
same result as using only the non-empty one.

OTHO, it's rather counter-intuitive - from a logical POV - that OR'ing
a condition that yields the whole set and a condition that yields a
subset doesn't yields the whole set. It's just like having "True or
whatever_boolean_expression" evaluating to False...

As someone famous here used to say in his sig:
"Bureaucrat Conrad, you are technically correct -- the best kind of
correct."

!-)

More seriously: whether this is how it "should" work or not is a
design choice, and as such belongs to the team. But whatever they
decide(d), it might be worth documenting the behaviour to avoid
confusing the users.

My 2 cents...

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



Re: clever 404 pages

2011-01-06 Thread Daniel Roseman
On Thursday, January 6, 2011 11:45:20 AM UTC, shofty wrote:
>
> has anyone ever written or read an article on creation of clever 404 
> pages in django sites? 
>
> i'd like to know if its possible to capture the url requested and 
> maybe push back a quick search on the terms in the url, rather than 
> just telling the user that the page has disappeared in the transition 
> to a new site.


I've done this. It's not particularly difficult. You can set the value of 
`handler404` in your urls.py, giving it the path to a view, which works like 
any other: it gets the request object, from which you can extract elements, 
do some processing with them, and render a template with whatever context 
you want.
http://docs.djangoproject.com/en/1.2/topics/http/urls/#handler404
--
DR.

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



clever 404 pages

2011-01-06 Thread shofty
has anyone ever written or read an article on creation of clever 404
pages in django sites?

i'd like to know if its possible to capture the url requested and
maybe push back a quick search on the terms in the url, rather than
just telling the user that the page has disappeared in the transition
to a new site.

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



Re: Cant locate problem with trunk: 'ModelForm' object has no attribute '_meta'

2011-01-06 Thread Martin
I added my case to this Django ticket. As far as I can tell its
related to the changes mentioned there.
http://code.djangoproject.com/ticket/15025

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



Re: Japanese Text Sort Order

2011-01-06 Thread Masklinn
On 2011-01-06, at 11:31 , James Hancock wrote:
> Any other suggestions or ways to correctly sort Japanese Words?
I don't believe Python has any support for collations (locale-specific sorts, 
especially the Unicode Collation Algorithm and related Default Unicode 
Collation Element Table and Common Locale Data Repository). It has 
locale.strcoll but that's POSIX-based and I'm not sure it's going to be 
sufficient.

As others suggested, your best bets are:
1. Use your database's collation support as suggested by Daniel. MySQL seems to 
allow per-column character set (and collation), Postgres's documentation seems 
to indicate its charset and collation support is per-database

2. Use Python's ICU bindings and perform your sort in-memory in Python using 
the right locale and collation, ICU should have pretty complete support for 
that operation.

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



Re: MVC (mtv!) schema...

2011-01-06 Thread James Hancock
I like it. I think it would make a good cartoon.

*Bookmark that.

Cheers,
James Hancock

On Tue, Jan 4, 2011 at 11:27 PM, marco  wrote:

> hi!
>
> i'm reading the djangobook, and it ocurred to me this drawing, to
> graphic the mtv concept.
>
> hope you like it, and you are free to use it!
>
> http://marcobernich.blogspot.com/2011/01/mvc.html
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Japanese Text Sort Order

2011-01-06 Thread James Hancock
Wow, I have no idea what you just said... but, I think I agree.

If I am right, what you are saying is, because the same kanji has multiple
readings and the words are sorted by reading and not the kanji itself, that
dictionary is going to be impossibly difficult to make.

quick example, skip if you want to
->
大学 is read "daigaku" and means college
大き is read "Ōki" and means big.


The 大 is read "dai" in one and "O" in the other. Giving the character a
priority would not make it sort the right way because the order desired is
by the reading, and the reading is all about the context of the characters.

giving the character a value would make it be:

大き (Oki)
大学 (Daigaku
最高 (Saiko - means the best, because Django is the best!)

When really, alphabetically it is:

大き (Oki)
最高 (Saiko)
大学 (Daigaku)

<--
End of Example:


Man, the Japanese where not thinking about programming when they made their
language.

Any other suggestions or ways to correctly sort Japanese Words?

Cheers,
James Hancock

On Thu, Jan 6, 2011 at 5:38 PM, Masklinn  wrote:

> On 2011-01-06, at 07:23 , Sam Walters wrote:
> > Hi,
> > Personally I would map the priority of every character in a dict and
> > pass this to sorted
>
> Given Japanese is not an alphabetical language and mixes syllabic and
> logographic scripts (the logographic system having a few thousand
> graphemes), I doubt this kind of trivial ideas is going to work correctly
> (it only works correctly for simple alphabetical engines, even diacritics
> are going to cause an explosion in the number of cases)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: ZSI WEB SERVICE

2011-01-06 Thread sami nathan
Ya me too in the same problem if any one find the solution please post here

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



Re: Japanese Text Sort Order

2011-01-06 Thread Masklinn
On 2011-01-06, at 07:23 , Sam Walters wrote:
> Hi,
> Personally I would map the priority of every character in a dict and
> pass this to sorted

Given Japanese is not an alphabetical language and mixes syllabic and 
logographic scripts (the logographic system having a few thousand graphemes), I 
doubt this kind of trivial ideas is going to work correctly (it only works 
correctly for simple alphabetical engines, even diacritics are going to cause 
an explosion in the number of cases)

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