unable to open /usr/lib/python2.4/config/Makefile (No such file or directory)

2005-12-09 Thread peter ma

OS is debian SID

error: invalid Python installation: unable to open
/usr/lib/python2.4/config/Makefile (No such file or directory)



Re: indexes on tables

2005-12-09 Thread Adrian Holovaty

On 12/9/05, braver <[EMAIL PROTECTED]> wrote:
> Basically, if I stuff data into the database as defined by
> django-admin.py sql app, via an external loader, and then open it in
> django, will I see proper objects -- or there's more to objects stored
> in django's own tables, and I have to load them via django calls?

There's nothing special about Django's own tables -- they just hold
stuff like authentication information for the Django admin. You don't
have to worry about any magic. :)

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org


Re: indexes on tables

2005-12-09 Thread braver

Basically, if I stuff data into the database as defined by
django-admin.py sql app, via an external loader, and then open it in
django, will I see proper objects -- or there's more to objects stored
in django's own tables, and I have to load them via django calls?



Re: choices in BooleanField: bug or feature?

2005-12-09 Thread Emanuele

Hi rob, thanks for your info. I tried NullBoleanField as you said one
month ago but without any success (see my post of Oct 28th). Now I'm
trying again and IT WORKS :) . This is a working example, related to my
problem:
choice = meta.NullBooleanField("Null Boolean", choices=((True,"It's
true"),(False,"It's false"),), blank=False,default="")
Here the default blank choice ("") is not accepted by the automatic
validator, forcing you to choos among "It's true" and "It's false".
Very good.
Probably in the last month many things happened in the source code of
django :)

This satisfies me completely, so there is no need to go further on
BooleanField.

Thanks again!

Emanuele



Re: choices in BooleanField: bug or feature?

2005-12-09 Thread oggie rob

Hi Emanuele,
To force a user to make a choice wrt boolean fields, you have two
options: a BooleanField or (as you seem to be looking for) a
NullBooleanField, which actually represents three states (including
'unselected'). This will mirror what you are trying to achieve with the
CharField solution, except that it saves to the database as a boolean
field instead of a varchar.
Not sure if 'choices' works with NullBooleanField, but it sounds like
it should raise an exception for the BooleanField?

 -rob



Re: Paginator - a problem

2005-12-09 Thread PythonistL

Solved.
Instead of
 paginator=ObjectPaginator('tradeleads',{'id__gt':1},2)

i had to use  
paginator=ObjectPaginator(tradeleads,{'id__gt':1},2)



Re: Paginator - a problem

2005-12-09 Thread Adrian Holovaty

On 12/9/05, PythonistL <[EMAIL PROTECTED]> wrote:
> paginator=ObjectPaginator('tradeleads',{'id__gt':1},2)

The first argument to ObjectPaginator should be tradeleads (without
quotes), not 'tradeleads' (a string).

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org


Paginator - a problem

2005-12-09 Thread PythonistL

Hi,
I would like to use Paginator in my scripts. So I tried this, very
simple view

##
def SearchP(request):
paginator=ObjectPaginator('tradeleads',{'id__gt':1},2)
page=request.GET.get('page',0)
Results=paginator.get_page(page)
return render_to_response('board/Pomo', {' Results':  Result})
#
where tradeleads is a table.

My urls.py for this is
(r'^Se/?$', 'boardproject.apps.board.views.Pomo.SearchP')

and I call it from my browser like this
http://localhost:8081/Se/?page=0

When I try it I get the error

Request Method: GET
Request URL: http://localhost:8081/Se/
Exception Type: AttributeError
Exception Value: 'str' object has no attribute 'get_list'
Exception Location:
C:\PYTHON23\lib\site-packages\django\core\paginator.py in get_page,
line 37

and the line (from my script )
Results=paginator.get_page(page)
is marked
Where is a problem? Thank you for help
L.
.



Re: Migrating existing data into Django models

2005-12-09 Thread Grigory Fateyev

Hello tonemcd!
On Thu, 08 Dec 2005 07:07:41 -0800 you wrote:

> 
> What does your auth model look like?
> 
class User(auth.User):
user_id = meta.CharField(maxlength=12, primary_key=True)
user_active = meta.BooleanField(default=True)
username = meta.CharField(maxlength=25)
user_password = meta.CharField(maxlength=32)
user_session_time = meta.IntegerField()
user_session_page = meta.IntegerField()
user_lastvisit = meta.DateTimeField(default=meta.LazyDate())
user_regdate = meta.DateTimeField(default=meta.LazyDate())
user_level = meta.CharField(maxlength=4)
user_posts = meta.IntegerField()
user_timezone = meta.FloatField(max_digits=5, decimal_places=2)
user_style = meta.CharField(maxlength=4)
[...]

-- 
Всего наилучшего!
greg [at] anastasia [dot] ru Григорий.


Re: indexes on tables

2005-12-09 Thread Adrian Holovaty

On 12/9/05, braver <[EMAIL PROTECTED]> wrote:
> unique_together = (("key","date",...),)
>
> Is it the way?  It creates proper SQL.  What about indexes on several
> columns?

Yes, that's the way to do multiple unique fields. There's no way to do
indexes across several columns -- you can do that yourself by creating
the indexes after the tables are created.

> Now, I'm going to load tons of logs into the database.  I want python
> objects to look at them, but the loader should be very fast.  Is
> loading the database directly according to the schema enough for Django
> -- i.e., there's nothing else, or does it keep more secret stuff
> somewhere?

I'm not sure what you're asking here...

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org


Re: choices in BooleanField: bug or feature?

2005-12-09 Thread Emanuele

Thanks for the answer Adrian. But let me say this:

- BooleanFields _are_ currently allowed to have "choices" parameter, as
I can see from my admin interface and docs (svn ~ rev1580). And they
behave differently from other Fields.
- Boolean has obviously only two choices, but if I want to force the
user (in admin interface I mean) to express explicitly a choice between
True of False, then a checkbox is not enough. If I have a checkbox
there are only two states and so a default value is expressed (False as
django checkbox default, or True if a say default=True): in short,
using a checkbox can't force the user to choose True of False. You need
at least a three-state system to do that.

As you previously told me, there is (at least) a solution to force a
user to select explicitly one of two values, like:
choice = meta.CharField(maxlength=1, choices=(('', ''), ('T',
'True'), ('F', 'False')), blank=False)
Anyway I'd prefer to use BooleanField instead of CharField, since
"choices" is available and  since I'd like not to convert every
'choice' call to booleans in apps code.

So back to my original question (Bug of Feature?), I'm studying Django
code to understand how can I improve BooelanField to handle choices as
desired. But I'm a newbie and if you definitely consider that as a
feature, It's better me to stop now and spend time on other things of
my long todo list :)

Thanks again,

Emanuele



Re: Auto-reload is not working

2005-12-09 Thread PythonistL

On my XP happens that sometims too.I noticed that happens if I have a
lot of other programs running

Regards,
L



Re: ID of the record

2005-12-09 Thread PythonistL

Thank you for the reply
L,



Re: indexes on tables

2005-12-09 Thread braver

OK.  In addition, I need UNIQUE with several fields in a list.  I've
found the following way to do it:

class Log(meta.Model):
key = ...
date = ...
class META:
unique_together = (("key","date",...),)

Is it the way?  It creates proper SQL.  What about indexes on several
columns?

Now, I'm going to load tons of logs into the database.  I want python
objects to look at them, but the loader should be very fast.  Is
loading the database directly according to the schema enough for Django
-- i.e., there's nothing else, or does it keep more secret stuff
somewhere?