Re: Django filter hack

2006-03-08 Thread tonemcd

This is very nice - very helpful!

Cheers,
Tone


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



Re: specifying a model with a field computed from other fields

2006-03-08 Thread Kenneth Gonsalves

On Thursday 09 Mar 2006 10:39 am, Gavin wrote:
> Hi, I have a model in which there is a foreign key that I want
> created using values from other fields. For example, I have a
> table `A`, with fields `a`, `b` and foreign key `C`. I want to
> specify a final foreign key field using the product `a`*`b` and
> value of `C`. I'm aiming at being able to get between tables `A`
> and `C`.

dont understand - can you give a clear example

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

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



specifying a model with a field computed from other fields

2006-03-08 Thread Gavin

Hi, I have a model in which there is a foreign key that I want created
using values from other fields. For example, I have a table `A`, with
fields `a`, `b` and foreign key `C`. I want to specify a final foreign
key field using the product `a`*`b` and value of `C`. I'm aiming at
being able to get between tables `A` and `C`.

What's a good way of doing this?

any thoughts much appreciated.

cheers,

g


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



Re: LDAP _without_ built-in Django user authentication

2006-03-08 Thread Matt

Is there any good documentation for implementing LDAP with Django?

The admin feature of Django is awesome and I'd love to use it, but in
addition to the need for LDAP my app will have to parse uploaded CSV
files in order to populate certain database tables simply because there
is far too much data to insert it one row at a time.  Therefore, I will
need a very customized admin interface -- at least for a few tables.
Ideally, I want to use the Django admin interface for 90% of the tables
that hold more basic info that could be entered manually, and then my
own custom interface for the CSV files.  Of course, the problem is I
would only be able to use LDAP (exclusively) for the non-Django admin
stuff.

Are there plans to allow for alternate authentication methods for the
Django admin by v1.0?


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



Re: stringformat in template

2006-03-08 Thread Geert Vanderkelen

Hi Rob,

On Mar 9, 2006, at 1:22 AM, Rob Slotboom wrote:

>
> I tried to use stringformat within a template but without success.
> This is what I want in 'normal' syntax':
>
> return "%.2f" % total_amount
>
> It returns a two decimal value.
>
> But how to use it in the template???

Try this in a template:

  {{ 22.22313|stringformat:".2f"  }}

See: STRINGFORMAT on http://www.djangoproject.com/documentation/ 
templates/

regards,
Geert

--
Geert Vanderkelen
http://Kemuri.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
-~--~~~~--~~--~--~---



Re: URLField Limit 200 maxlenght

2006-03-08 Thread favo

I have filed a ticket & have to wait


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



Re: stringformat in template

2006-03-08 Thread limodou

On 3/9/06, Rob Slotboom <[EMAIL PROTECTED]> wrote:
>
> I tried to use stringformat within a template but without success.
> This is what I want in 'normal' syntax':
>
> return "%.2f" % total_amount
>
> It returns a two decimal value.
>
> But how to use it in the template???
>

Where and how do you use it, in template or in custom tag code?


--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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



stringformat in template

2006-03-08 Thread Rob Slotboom

I tried to use stringformat within a template but without success.
This is what I want in 'normal' syntax':

return "%.2f" % total_amount

It returns a two decimal value.

But how to use it in the 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-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
-~--~~~~--~~--~--~---



Re: Django filter hack

2006-03-08 Thread oggie rob

> I did a quick hack today and made it toggable. If you want to aply a
filter, show it. If not, leave it there and browse the listings.

This is nice - can you write up a bug?

 -rob


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



Re: Attn. Dreamhost users

2006-03-08 Thread Amit Upadhyay
On 3/8/06, Hans-Christian Holm <[EMAIL PROTECTED]> wrote:
I'm a bit reluctant to switching hosts. I haven't had my DH account for thatlong, but they have offered great value for money so far, and there seems tobe a few Django apps running happily there already. And switching is so
boring work.I have faced a few issues but my django application  on dreamhost is wroking fine otherwise. Once in a while [1-2 such mails per day, their stats page say I execute about 200-400 thousand queries a day], I would get Mysql dies while executing the query, but the nature of my application is such that a one odd failures can be ignored. 
BTW I have not yet put any caching, so I am making upto 5 queries per scond on their mysql server, and don't face any hiccups. The only issue I have faced there is twice in about 2 months of deployment of my application my application will stop to respond, will wait for 2 minutes or so and then give me 500 server internal error, in the process it would create tens of core files. This problem has fixed automatically on both occasions in 5-10 minutes. 
-- Amit UpadhyayBlog: http://www.rootshell.be/~upadhyay+91-9867-359-701
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---



Non DJango data types

2006-03-08 Thread cajazzer

I am looking for the easiest way to use POINT data types as supported
by Mysql (and Postgresql I believe) with DJango.  Along with this I
need to create a Spatial index on these columns.  Should I implement a
new type, or is there an easier way?
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
-~--~~~~--~~--~--~---



Re: Attn. Dreamhost users

2006-03-08 Thread tonemcd

Doesn't DreamHost allow you to download your own copy of lighttpd and
install that?

Of course, if lighttpd needs root access, the standard plans at
DreamHost won't work - I think I've answered my own question...

Cheers,
Tone


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



Re: How to find out id of the first record?

2006-03-08 Thread PythonistL

Thank you all for help
L.


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



Re: Attn. Dreamhost users

2006-03-08 Thread James Bennett

On 3/8/06, Hans-Christian Holm <[EMAIL PROTECTED]> wrote:
> But is this a DreamHost problem or a FastCGI problem? Do other hosts have
> different FastCGI configurations that make them better suited to Django? If
> so, what could DH do to make life easier for Django users? I've voted for
> all things Python on DH. Would mod_python help?

lighttpd+FastCGI is the way to go for shared hosting, IMHO, but
Dreamhost doesn't offer lighttpd.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Attn. Dreamhost users

2006-03-08 Thread Hans-Christian Holm

But is this a DreamHost problem or a FastCGI problem? Do other hosts have 
different FastCGI configurations that make them better suited to Django? If 
so, what could DH do to make life easier for Django users? I've voted for 
all things Python on DH. Would mod_python help?

I'm a bit reluctant to switching hosts. I haven't had my DH account for that 
long, but they have offered great value for money so far, and there seems to 
be a few Django apps running happily there already. And switching is so 
boring work.

Hans-Christian

- Original Message - 
From: "Julio Nobrega" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, March 07, 2006 5:05 PM
Subject: Re: Attn. Dreamhost users

Dreamhost hasn't been good to me. I will be switching hosts soon...
can't have such unreliable apps live.



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



Re: How to find out id of the first record?

2006-03-08 Thread Andy Shaw

Andy Shaw wrote:
> lowest ID, or you can write a custom SQL query to do the same thing. I
> don't know if Django currently has a built-in feature to let you do
> this, though it is possible that the database will return the records in

Julio Nobrega wrote:
> first_record = models.get_list(order_by = ['id'], limit = 1)[0]
>
>   Maybe even .get_object() if it works with limit 1.

Laurent RAHUEL wrote:
> reqObs = something.get_list(order_by=('id',), limit=1)
> if reqObs:
>   firstOb = reqObs[0]

*slaps forehead* Naturally. Sorry, guys.

-Andy



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



Re: Attn. Dreamhost users

2006-03-08 Thread Jeremy Jones

On Wed, 8 Mar 2006 19:43:21 +0530
"Amit Upadhyay" <[EMAIL PROTECTED]> wrote:

> On 3/8/06, PythonistL <[EMAIL PROTECTED]> wrote:
> >
> > But how can I kill ALL of them?
> > One by one something like:
> > kill processNumber
> > ?
> 
> 
> pkill is your friend.
> 
> I use "pkill -9 python2.4" on abovenet for most code changes.

I've actually had pretty decent success with 

killall -USR1 the_process_you_want_to_die

This is supposed to signal the process it needs a restart so that the
next request in will be a process running your new code.

- jmj

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



Re: An expression tag

2006-03-08 Thread Cheng Zhang


On Mar 4, 2006, at 3:12 PM, limodou wrote:

>
> I'v written a expression tag, it can be used to calculate python
> expression and save the result to a template variable. I think it
> maybe some useful for someone.

Indeed. I just found a place to use it in our app. :-) Thanks.

- Cheng


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



Re: Attn. Dreamhost users

2006-03-08 Thread Gábor Farkas

Amit Upadhyay wrote:
> On 3/8/06, *PythonistL* <[EMAIL PROTECTED] > wrote:
> 
> But how can I kill ALL of them?
> One by one something like:
> kill processNumber
> ?
> 
> 
> pkill is your friend.
> 
> I use "pkill -9 python2.4" on abovenet for most code changes.
> 
> 

or use a little shell scripting, like

ps aux | grep python2.4 | awk '{print $2}' | xargs kill

or something like that..

(i have to admit, the pkill solution looks simpler :))

gabor

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



Re: LDAP _without_ built-in Django user authentication

2006-03-08 Thread [EMAIL PROTECTED]

Joseph,
  Here is a link to the rails+lap wiki entry:
 http://wiki.rubyonrails.com/rails/pages/HowtoAuthenticateViaLdap

-- Nick


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



Re: Attn. Dreamhost users

2006-03-08 Thread Amit Upadhyay
On 3/8/06, PythonistL <[EMAIL PROTECTED]> wrote:
But how can I kill ALL of them?One by one something like:kill processNumber?pkill is your friend. I use "pkill -9 python2.4" on abovenet for most code changes. 
-- Amit UpadhyayBlog: http://www.rootshell.be/~upadhyay+91-9867-359-701
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---



Re: How to find out id of the first record?

2006-03-08 Thread Laurent RAHUEL

Le Mercredi 8 Mars 2006 14:26, Andy Shaw a écrit :
> PythonistL wrote:
> > Hi,
> > is there a way how to find out id of the first record in a table?
> > I will explain what I mean.
> > When I insert the first record into a table the id is 1.
> > when I insert next record, the id for this record will be 2.
> > But if I delete the first record, the id of the first record will be 2
> > .So, I need to find out the id of the first record.
> > Is it possible?
> > Thank you for help
> > L.
>
> As the ID field is auto-incremented, the earliest ('first') record will
> be the one with the lowest ID. In python, you can determine this by
> pulling all records from the database and finding the one with the
> lowest ID, or you can write a custom SQL query to do the same thing. I
> don't know if Django currently has a built-in feature to let you do
> this, though it is possible that the database will return the records in
> creation order anyway (someone correct me here).
>
> -Andy
>

You can also use django "build-in" method on your model objects like :

reqObs = something.get_list(order_by=('id',), limit=1)
if reqObs:
  firstOb = reqObs[0]

Regards, Laurent.




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



Re: How to find out id of the first record?

2006-03-08 Thread Julio Nobrega

  Something like this perhaps...

first_record = models.get_list(order_by = ['id'], limit = 1)[0]

  Maybe even .get_object() if it works with limit 1.



On 3/8/06, Andy Shaw <[EMAIL PROTECTED]> wrote:
>
> As the ID field is auto-incremented, the earliest ('first') record will
> be the one with the lowest ID. In python, you can determine this by
> pulling all records from the database and finding the one with the
> lowest ID, or you can write a custom SQL query to do the same thing. I
> don't know if Django currently has a built-in feature to let you do
> this, though it is possible that the database will return the records in
> creation order anyway (someone correct me here).
>
> -Andy


--
Julio Nobrega - http://www.inerciasensorial.com.br

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



Re: How to find out id of the first record?

2006-03-08 Thread Andy Shaw

PythonistL wrote:
> Hi,
> is there a way how to find out id of the first record in a table?
> I will explain what I mean.
> When I insert the first record into a table the id is 1.
> when I insert next record, the id for this record will be 2.
> But if I delete the first record, the id of the first record will be 2
> .So, I need to find out the id of the first record.
> Is it possible?
> Thank you for help
> L.

As the ID field is auto-incremented, the earliest ('first') record will
be the one with the lowest ID. In python, you can determine this by
pulling all records from the database and finding the one with the
lowest ID, or you can write a custom SQL query to do the same thing. I
don't know if Django currently has a built-in feature to let you do
this, though it is possible that the database will return the records in
creation order anyway (someone correct me here).

-Andy

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



How to find out id of the first record?

2006-03-08 Thread PythonistL

Hi,
is there a way how to find out id of the first record in a table?
I will explain what I mean.
When I insert the first record into a table the id is 1.
when I insert next record, the id for this record will be 2.
But if I delete the first record, the id of the first record will be 2
.So, I need to find out the id of the first record.
Is it possible?
Thank you for help
L.


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



Re: Attn. Dreamhost users

2006-03-08 Thread PythonistL

Eugene,
thank you for your reply.
You say"
 If you run several web sites from one account, you cannot tell which
process serves a given web site. I kill all of them"
But how can I kill ALL of them?
One by one something like:
kill processNumber
?
Thank you for reply
L


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



Re: Disabled fields in admin interface

2006-03-08 Thread JirkaJ

Hi Malcolm,
please let me know when u finish the changes in code.

thanks a lot


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



Re: Django filter hack

2006-03-08 Thread limodou

On 3/8/06, Andu <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> One of the problems I faced when using Django's admin was the filter
> part overlapped the table with data, when I showed lots of fields in
> the admin listing.
>
> I did a quick hack today and made it toggable. If you want to aply a
> filter, show it. If not, leave it there and browse the listings.
>
> I documented it here, and you can also see some images on how it looks:
> http://andu.417.ro/blog/django_filter_hack.html
>

I'v seen that already. It's good.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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



Django filter hack

2006-03-08 Thread Andu

Hi all,

One of the problems I faced when using Django's admin was the filter
part overlapped the table with data, when I showed lots of fields in
the admin listing.

I did a quick hack today and made it toggable. If you want to aply a
filter, show it. If not, leave it there and browse the listings.

I documented it here, and you can also see some images on how it looks:
http://andu.417.ro/blog/django_filter_hack.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-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
-~--~~~~--~~--~--~---