Re: Windows XP and Django

2006-09-28 Thread [EMAIL PROTECTED]

I was in the same position only two days ago and although I'm still a
long way from coding, the framework is starting to make sense in my
tiny brain!

It's worth looking at some other peoples examples such as -

http://www.b-list.org/weblog/2006/09/04/django-tips-documentation-and-resources
http://www.b-list.org/weblog/2006/09/10/django-tips-laying-out-application

and a great site with source code -

http://www2.jeffcroft.com/2006/jun/06/lost-theories-with-source-code/

This probably won't make much sense to you (it is starting to register
slowly with me) but keep at it as I'm highly impressed so far!


--~--~-~--~~~---~--~~
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: Model-level DB cache

2006-09-28 Thread Michael Radziej

Hawkeye schrieb:
> I had the same reaction at first... "this has to be a transaction
> issue", but I decided to give it a try.
> 
> I'm working from trunk, and here's what I did to recreate the problem:
> 
> ==
> {{ In manage.py shell }}
 a = Foo.objects.all()
 a
> [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo: Foo 8>]
> 
> {{ In MySQL shell }}
> delete from foo_foo where id=8;
> commit;
> exit;
> 
> {{ In same manage.py shell }}
 a
> [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo: Foo 8>]
 b = Foo.objects.all()
 b
> [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo: Foo 8>]
 transaction.rollback()
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "[...]/django/db/transaction.py", line 161, in rollback
> set_clean()
>   File "[...]/django/db/transaction.py", line 102, in set_clean
> raise TransactionManagementError("This code isn't under transaction
> management")
> TransactionManagementError: This code isn't under transaction
> management
 b[3]
> < Foo: Foo 8>
> ==
> 
> Maybe we're making the same mistake, but this behavior seems strange to
> me as well.

I made a transaction.commit(), got the same error, but then the 
Foo.objects.all() returned the new set. I'm not sure why I get 
the error, but the behaviour is normal for certain transaction 
isolation levels. You don't see the result of transcations that 
committed after the start of your current transation (for 
'repeatable read' and 'serializable')

You can have the same fun with two mysql sessions and without any 
django.

Try this (you might need to set transaction level repeatable read 
to make it work):


Session1: begin;
   select * from xyz


   Session2: delete from xyz;
   Session2: commit;

Session1: select * from xyz

This is a normal database thing an not mysql specific, but 
there's a long but fine article on

http://dev.mysql.com/books/mysqlpress/mysql-tutorial/ch10.html


Michael


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



Here's an idea for the Django ninjas...

2006-09-28 Thread Tom Smith



Wouldn't it be nice if I could...

 >>> python manage.py sync-urls-to-views.py

...and have some output that creates all the functions (with params)  
called for me... even if only splatted to screen



Wouldn't it be nice if if perhaps in reverse I  could...

 >>> python manage.py sync-views-to-urls

...and have some output that creates a list of tuples, obviously not  
with all the regexes in but at least pointing to right functions.



Wouldn't it be nice if I could...

 >>> python manage.py sync-model-to-custom-templates

So that it creates the custom templates showing how to list, delete,  
show one, search could be created so I could then see how it was  
done... I know this may be covered by default views but I don't  
really get on with those... I prefer to hack my own


When starting a project one might approach it from 2 ends
a. Design your URLs... your functionality
b. Design your model.. your, er, model...
and then using the above you could easily weave the two together  
(perhaps)

Just a thoughtregards

tom





--~--~-~--~~~---~--~~
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: Re: Confused about generic.create_update

2006-09-28 Thread Russell Keith-Magee

On 9/27/06, gkelly <[EMAIL PROTECTED]> wrote:
>
> > The easiest fix I can think of would be to put a hidden field in your
> > form that holds the id of the current user. This will put a 'user'
> > entry into your form data, which will allow the create/update generic
> > views to submit without error.
>
> I definitely do not want to do this for security reasons. Just because
> it's hidden doesn't mean someone can't write a script to POST to my
> page with any user_id they want. And then I ask, what is the point of
> passing the generic view an object_id? Is there a better way to
> approach this problem? My code isn't set in stone, I'm ready and
> willing to learn to do it the right way. It makes sense in my head, but
> Django isn't following the same logic as I.

I think I've worked out the problem you are having.

As it stands, each instance of your UserProfile model will have a
unique 'user' attribute, but it will also have an 'id' attribute
acting as a primary key. This 'id' attribute will has no relationship
with the underlying user id (as no relationship is specified). In
addition, any generic view will expect you to provide a user id
whenever you submit new values. Hence the 'missing user' error
message.

It seems like your assumption is that by making the user attribute
unique=True, it will become the primary key. It doesnt - that keyword
just makes the attribute unique across the table. You can have
multiple unique attributes, if you want to.

You have to specify primary_key=True (instead of unique=True) to make
the attribute a primary key. Once you have done this, the generic
views should work as you expect - with this definition, you are
describing the fact that instances of User are linked to instances of
UserProfile by way of their primary keys, and when you specify an
object_id you are providing detail to populate the user field (since
the object_id _is_ the user id).

Yours,
Russ Magee %-)

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

2006-09-28 Thread [EMAIL PROTECTED]

It is hard to use it with related objects... Inside a for loop I can´t
know which original object to reference (at least with the template
language) and if I use the for to loop through the original object
instead of the form, I have to use it for all other fields of the form,
with no help for ForeignKeys and ManyToMany fields.


--~--~-~--~~~---~--~~
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 tune fastcgi for django?

2006-09-28 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 15:17 -0700, mamcxyz wrote:
> I have a Centos 3 server with 128 MB of RAM and a limit of 30
> processes... I'm using lighttpd + FastCGI
> 
> When I start the server for first time I get 18 process.
> 
> When later I need to run some change or restart or something, I get a
> error with fork, because the process limit is exhausted.
> 
> How calculate the params on process limit so the server get some air?
> I'm talking about the "max-procs" =>  params...

Based on the error message you are reporting, I'm not sure you are
diagnosing the problem correctly. Lighttpd should be spawning a new
process when the need arises and then reusing existing ones and not
going above the maximum you set.

Getting a fork error indicates that something else is going on.
Particularly when you restart your server(s), all the existing processes
should die off. It also sounds like bad design for a process like
lighttpd to be saying "fork error" just because it has reached the
maximum number of processes: a fork error is normally a very resource
exhaustion problem. So, again, this points to something more serious
going on than just hitting max-procs.

Have a look at your "ps" output and "netstat" output. Why are there an
unusually high number of processes running? Do you have a lot of
existing connections? Are you not stopping the existing servers
correctly when you restart? Check the output of "ulimit -a" and see if
the numbers there look like they can support the number of processes you
are running.

I don't entirely understand what you are seeing, but my strong suspicion
is that changing max-procs isn't going to fix much: it may make the
problem go away for a little longer, but then it is just going to come
back again. I would suggest doing a bit more investigation into the
state of your system at the time you see the problem and using Google
(or similar) to search for the exact error message you are seeing (along
with "lighttpd") to see if it has cropped up before.

Regards,
Malcolm


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



sorting data on list pages, date validation

2006-09-28 Thread Benedict Verheyen

HI,


i have a few questions.

1. In my app, i have a list view where several fields are represented in
tables. Now i want the user to be able to click the columnheader in
order to sort the data.
I have javascript code that displays a + or - wether (toggling between
the 2) and i made 2 views, 1 for ascending & descending sorting of the
columns and these views work independently.
But when i call the links from my javascript it doesn't seem to work.

Are their other more elegant ways of dealing with sorting of data?

2. I use the dd/mm/ date format. I created my own Validators
(without specifying the fields) and it all works. Before the data is
shown, i change the date from -MM-DD to dd/mm/.
But then off course the validators doesn't work correctly.

Only way i can solve this it seems is to specify a fields list and add
a custom date validator for my date field.
But i don't want to specify the fields (is there a way to have that list
generated?).
Can i override just the date field in a way or maybe just substitute the
date validator without having to go through the creation of the fields?

Thanks,
Benedict

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



sorting data on list pages, date validator

2006-09-28 Thread Benedict Verheyen

Hi,


i have a few questions.

1. In my app, i have a list view where several fields are represented in
tables. Now i want the user to be able to click the columnheader in
order to sort the data.
I have javascript code that displays a + or - wether (toggling between
the 2) and i made 2 views, 1 for ascending & descending sorting of the
columns and these views work independently.
But when i call the links from my javascript it doesn't seem to work.

Are their other more elegant ways of dealing with sorting of data?

2. I use the dd/mm/ date format. I created my own Validators
(without specifying the fields) and it all works. Before the data is
shown, i change the date from -MM-DD to dd/mm/.
But then off course the validators doesn't work correctly.

Only way i can solve this it seems is to specify a fields list and add
a custom date validator for my date field.
But i don't want to specify the fields (is there a way to have that list
generated?).
Can i override just the date field in a way or maybe just substitute the
date validator without having to go through the creation of the fields?

Thanks,
Benedict

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



sorting data on a list page, date validator

2006-09-28 Thread Benedict Verheyen

Hi,


i have a few questions.

1. In my app, i have a list view where several fields are represented
in tables. Now i want the user to be able to click the columnheader in
order to sort the data.
I have javascript code that displays a + or - wether (toggling between
the 2) and i made 2 views, 1 for ascending & descending sorting of the
columns and these views work independently.
But when i call the links from my javascript it doesn't seem to work.

Are their other more elegant ways of dealing with sorting of data?

2. I use the dd/mm/ date format. I created my own Validators
(without specifying the fields) and it all works. Before the data is
shown, i change the date from -MM-DD to dd/mm/.
But then off course the validators doesn't work correctly.

Only way i can solve this it seems is to specify a fields list and add
a custom date validator for my date field.
But i don't want to specify the fields (is there a way to have that list
generated?).
Can i override just the date field in a way or maybe just substitute
the date validator without having to go through the creation of the
fields?

Thanks,
Benedict

--~--~-~--~~~---~--~~
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: sorting data on list pages, date validation

2006-09-28 Thread charles sibbald
Hi use a _javascript_ widget from softcomplex.com that will recevie data for upto 3000 rows, and allow you to sort and filter on the client side. Its quite amazing.If you have a large amount of data/clients you dont want to be fetching data continuously. http://www.softcomplex.com/products/tigra_tables_pro/features:Data in the table can be sorted by any column in either ascending or descending order
			Table data can be filtered by exact match, substring or regular _expression_ found in the specified column
			Table data can be broken down by pages of specified size with all the required navigation automatically created
			Flexible arrangement of table elements  (NEW)
			Table row click events handling is available
			Key field can be specified and then passed to row click event handler
			Column cells can be formatted conditionally
			Hiddable table fields - useful if a field is key but should not be displayed (NEW)
			Alternating rows colors, onmouseover row effect and easy row (un)marking with mouse click (UPDATED)
			Every aspect of the table look is configurable with the CSS in familiar for web developers way (UPDATED)
			Each column has its own settings for data type, caption etc.
			Table can be initially sorted (NEW)
			String, number, date and currency values are internally supported (UPDATED)
			Custom data types can be plugged in with correct sorting algorithms (UPDATED)
			Data definition format is compact and easily generated with server side script
			Unlimited number of tables on single page, each independently configurable
			Extremely fast sorting algorithm using indexes is applied (NEW)
			Size optimized to reduce network load
			All popular browsers supported
			Highly optimized algorithms offer good results on large data sets (UPDATED)
			Script takes maximum results from capabilities of the browser used
			External API for data control (NEW)
			Free setup support
			Free updates and discounts for other products
			Plus date processing add-on module: any input and output date formats are supported now (NEW)
			i highly recomend it- Original Message From: Benedict Verheyen <[EMAIL PROTECTED]>To: django-users@googlegroups.comSent: Thursday, September 28, 2006 1:06:51 PMSubject: sorting data on list pages, date validationHI,i have a few questions.1. In my app, i have a list view where several fields are represented intables. Now i want the user to be able to click the columnheader inorder to sort the data.I have _javascript_ code that displays a + or - wether (toggling betweenthe 2) and i made 2 views, 1 for ascending & descending sorting of thecolumns and these views work independently.But when i call the links from my _javascript_ it doesn't seem to work.Are their other more elegant ways of dealing with sorting of data?2. I use the dd/mm/ date format. I created my
 own Validators(without specifying the fields) and it all works. Before the data isshown, i change the date from -MM-DD to dd/mm/.But then off course the validators doesn't work correctly.Only way i can solve this it seems is to specify a fields list and adda custom date validator for my date field.But i don't want to specify the fields (is there a way to have that listgenerated?).Can i override just the date field in a way or maybe just substitute thedate validator without having to go through the creation of the fields?Thanks,Benedict

--~--~-~--~~~---~--~~
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: sorting data on list pages, date validation

2006-09-28 Thread Benedict Verheyen



Hi,
 
i will have a look at it but for my app it's overkill 
as there isn't so much data that fetching it over and
over again would be a problem.
 
Regards,
Benedict
P.S. Sorry for sending the mails 3 times. At work we 
use exchange and it said it couldn't send the
message (can't connect to the server) so i tried from 
gmail after my 2 attempts only to find out it
did send out on the first 2 tries. 
*sigh*


Van: django-users@googlegroups.com 
[mailto:[EMAIL PROTECTED] Namens charles 
sibbaldVerzonden: donderdag 28 september 2006 14:19Aan: 
django-users@googlegroups.comOnderwerp: Re: sorting data on list 
pages, date validation


Hi 
use a _javascript_ widget from softcomplex.com that will recevie data for upto 
3000 rows, and allow you to sort and filter on the client side. Its quite 
amazing.If you have a large amount of data/clients you dont want to be 
fetching data continuously. http://www.softcomplex.com/products/tigra_tables_pro/features:

  Data in the table can be sorted by any column in either ascending or 
  descending order 
  Table data can be filtered by exact match, substring or regular _expression_ 
  found in the specified column 
  Table data can be broken down by pages of specified size with all the 
  required navigation automatically created 
  Flexible arrangement of table elements (NEW) 
  Table row click events handling is available 
  Key field can be specified and then passed to row click event handler 
  Column cells can be formatted conditionally 
  Hiddable table fields - useful if a field is key but should not be 
  displayed (NEW) 
  Alternating rows colors, onmouseover row effect and easy row (un)marking 
  with mouse click (UPDATED) 
  Every aspect of the table look is configurable with the CSS in familiar 
  for web developers way (UPDATED) 
  Each column has its own settings for data type, caption etc. 
  Table can be initially sorted (NEW) 
  String, number, date and currency values are internally supported (UPDATED) 
  Custom data types can be plugged in with correct sorting algorithms (UPDATED) 
  Data definition format is compact and easily generated with server side 
  script 
  Unlimited number of tables on single page, each independently configurable 

  Extremely fast sorting algorithm using indexes is applied (NEW) 
  Size optimized to reduce network load 
  All popular browsers supported 
  Highly optimized algorithms offer good results on large data sets (UPDATED) 
  Script takes maximum results from capabilities of the browser used 
  External API for data control (NEW) 
  Free setup support 
  Free updates and discounts for other products 
  Plus date processing add-on module: any 
  input and output date formats are supported now (NEW) 
  i highly recomend it
- 
Original Message From: Benedict Verheyen 
<[EMAIL PROTECTED]>To: django-users@googlegroups.comSent: 
Thursday, September 28, 2006 1:06:51 PMSubject: sorting data on list pages, 
date validation
HI,i have a few questions.1. In my app, i have a 
list view where several fields are represented intables. Now i want the user 
to be able to click the columnheader inorder to sort the data.I have 
_javascript_ code that displays a + or - wether (toggling betweenthe 2) and i 
made 2 views, 1 for ascending & descending sorting of thecolumns and 
these views work independently.But when i call the links from my _javascript_ 
it doesn't seem to work.Are their other more elegant ways of dealing 
with sorting of data?2. I use the dd/mm/ date format. I created my 
own Validators(without specifying the fields) and it all works. Before the 
data isshown, i change the date from -MM-DD to dd/mm/.But then 
off course the validators doesn't work correctly.Only way i can solve 
this it seems is to specify a fields list and adda custom date validator for 
my date field.But i don't want to specify the fields (is there a way to have 
that listgenerated?).Can i override just the date field in a way or 
maybe just substitute thedate validator without having to go through the 
creation of the 
fields?Thanks,Benedict
--~--~-~--~~~---~--~~
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: Confused: staff / active users

2006-09-28 Thread Enrico

Hi Waylan,

Thanks for your help, the fog has gone now. :)

Maybe the docs should be a little clearer...

Regards.
Enrico


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



Admin CSS: Broken INTERNAL link

2006-09-28 Thread Enrico

Hi,

The admin "css/base.css" has a CSS hack to block IE5 which reports me a
broken link.

Since I don't care about IE5, I just removed the hack:

/* Block IE 5 */
@import "null?\"\{";

Maybe some other css hack could be used to avoid an invalid request to
the server.

Just reporting here in case someone gets the same error.

Best regards.
Enrico


--~--~-~--~~~---~--~~
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: Admin CSS: Broken INTERNAL link

2006-09-28 Thread Enrico

Sorry guys!

I think this didn't solve the error for me.

I keep getting this error:

Referrer: http://200.139.115.13/media/admin/css/base.css
Requested URL: /error/HTTP_NOT_FOUND.html.var

Someone can help me?

Thanks in advance.

Enrico


--~--~-~--~~~---~--~~
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: Re: Confused: staff / active users

2006-09-28 Thread Russell Keith-Magee

On 9/28/06, Enrico <[EMAIL PROTECTED]> wrote:
>
> Hi Waylan,
>
> Thanks for your help, the fog has gone now. :)

Just to further Waylan's comments:

The purpose of 'is_active' is to identify an 'active' user - that is,
a user whose account can still be used to log in.

This is an alternative to deleting an account when you want to remove
access for a user. If there are artefacts in your database that
reference a specific user (e.g., a comment), you may not want to
delete the user, as this would delete the related artefacts.

> Maybe the docs should be a little clearer...

Do you have any specific suggestions? Is there any specific area that
you feel could be improved? Something that has been ommitted?
Something that is misleading? The documentation on authentication
describes is_active in the API reference for the fields of the User
model - is this description inadequate? Should it be
repeated/referenced somewhere else?

Specific requests and/or specific problems can be addressed and fixed;
blanket statements tend to get ignored due to a lack of telepathy on
the part of the developers :-)

Yours,
Russ Magee %-)

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



explicit array access in django templates

2006-09-28 Thread falcon

Let's say I have two arrays:
data=[["a",1,9],["b",2,8],["c",3,7],["d",4,6],["e",5,5]]
type=['string','number','number]

I iterate through the 'data' array (either with 'for' or 'range' loops)
and render a  with values from the array.
...
range rownumber from 0 to sizeOfData
...
 range columnnumber from 0 to sizeOfColumn
   {{data.rownumber.columnnumber}}

...

For some reason, type.columnnumber and data.rownumber.columnnumber seem
to print empty strings.

The context does indeed have the two arrays...I can't figure out why I
get blanks when every thing else seems to work fine.  I'm obviously
brand new to django templates, am I doing something obviously wrong?

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



changing models

2006-09-28 Thread Carlo Caponi

hi,
this is my model:

class Poll(models.Model):
question=models.CharField(maxlength=200)

If i run './manage.py syncdb' it creates tables on db. Now i populate
tables with something.

Now, if i change the model:

class Poll(models.Model):
question=models.CharField(maxlength=200)
pub_date=models.DateTimeField('date published')

and i run './manage.py syncdb', it deletete contents of tables..

The question is:
How can i change the model and keep data on db?

(sorry for my bad english, i'm italian)
-- 
Carlo Caponi

http://www.karolvs.it
icq #: 73707983

--~--~-~--~~~---~--~~
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: Model-level DB cache

2006-09-28 Thread Greg Plesur

That does fix it - thanks Michael.

I just want to summarize what I'm seeing, though, in case it helps others:
   - In no place, either in my MySQL shell or my Python Django session, 
am I explicitly starting a transaction.  Further, my MySQL shell has 
auto_commit on.
   - If I make a change in the MySQL shell, it isn't reflected by 
getting a new QuerySet from the Django model.
   - If, in the Python session, I call transaction.commit(), I get an 
error saying that I'm not under transaction management.
   - After calling transaction.commit() and getting that error, getting 
a new QuerySet does reflect the new DB changes.

So that's a work-around that I can use, but...is it okay behavior?  That 
seems pretty broken.  Is it possible that Django's DB connection has 
auto-commit off, but explicitly calls COMMIT internally on save() 
operations when there's no Django-level transaction in play?

Thanks again to everyone for all of your help - I was afraid that there 
wouldn't be a workaround for this at all.

-Greg


Michael Radziej wrote:
> Hawkeye schrieb:
>> I had the same reaction at first... "this has to be a transaction
>> issue", but I decided to give it a try.
>>
>> I'm working from trunk, and here's what I did to recreate the problem:
>>
>> ==
>> {{ In manage.py shell }}
> a = Foo.objects.all()
> a
>> [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo: Foo 8>]
>>
>> {{ In MySQL shell }}
>> delete from foo_foo where id=8;
>> commit;
>> exit;
>>
>> {{ In same manage.py shell }}
> a
>> [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo: Foo 8>]
> b = Foo.objects.all()
> b
>> [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo: Foo 8>]
> transaction.rollback()
>> Traceback (most recent call last):
>>   File "", line 1, in ?
>>   File "[...]/django/db/transaction.py", line 161, in rollback
>> set_clean()
>>   File "[...]/django/db/transaction.py", line 102, in set_clean
>> raise TransactionManagementError("This code isn't under transaction
>> management")
>> TransactionManagementError: This code isn't under transaction
>> management
> b[3]
>> < Foo: Foo 8>
>> ==
>>
>> Maybe we're making the same mistake, but this behavior seems strange to
>> me as well.
> 
> I made a transaction.commit(), got the same error, but then the 
> Foo.objects.all() returned the new set. I'm not sure why I get 
> the error, but the behaviour is normal for certain transaction 
> isolation levels. You don't see the result of transcations that 
> committed after the start of your current transation (for 
> 'repeatable read' and 'serializable')
> 
> You can have the same fun with two mysql sessions and without any 
> django.
> 
> Try this (you might need to set transaction level repeatable read 
> to make it work):
> 
> 
> Session1: begin;
>select * from xyz
> 
> 
>Session2: delete from xyz;
>Session2: commit;
> 
> Session1: select * from xyz
> 
> This is a normal database thing an not mysql specific, but 
> there's a long but fine article on
> 
> http://dev.mysql.com/books/mysqlpress/mysql-tutorial/ch10.html
> 
> 
> Michael
> 
> 
> > 
> 


--~--~-~--~~~---~--~~
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: changing models

2006-09-28 Thread can xiang

I think you'd change the schema manually.

You can take a look at the "manage.py sql appname" output for the sql
statement.

Carlo Caponi 写道:
> hi,
> this is my model:
>
> class Poll(models.Model):
>   question=models.CharField(maxlength=200)
>
> If i run './manage.py syncdb' it creates tables on db. Now i populate
> tables with something.
>
> Now, if i change the model:
>
> class Poll(models.Model):
>   question=models.CharField(maxlength=200)
>   pub_date=models.DateTimeField('date published')
>
> and i run './manage.py syncdb', it deletete contents of tables..
>
> The question is:
> How can i change the model and keep data on db?
>
> (sorry for my bad english, i'm italian)
>   

--~--~-~--~~~---~--~~
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: Model-level DB cache

2006-09-28 Thread Michael Radziej

Greg Plesur schrieb:
> So that's a work-around that I can use, but...is it okay behavior?  That 
> seems pretty broken.  Is it possible that Django's DB connection has 
> auto-commit off, but explicitly calls COMMIT internally on save() 
> operations when there's no Django-level transaction in play?

Looking at it like a database does, at least in theory, 
everything happens in a transaction. auto-commit is only an 
illusion ... or the database is broken in a fundamental way.

Django probably does start a transaction somewhere, I don't know. 
Try to trace your session and you'll see.

Within the normal server http transactions, you don't get this 
error. I have not seen it before. There are some settings in the 
transaction documentation that might be worth playing with if it 
gets in your way. Usually, it does not ...

And, this turned out to be a really interesting question ;-)

Michael


--~--~-~--~~~---~--~~
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: Djangonauts at the hack day?

2006-09-28 Thread Adrian Holovaty

On 9/28/06, Sandro <[EMAIL PROTECTED]> wrote:
> Woah! In response to Adrian's "make us proud" comment I whipped up a
> django shirt to wear during the hackday.  Check it here
> http://flickr.com/photos/untorn/254672411/
> I'm going to try to get photographed as much as possible with this
> thing on!

Sweet. :)

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: "slice" xhtml content and keep it valid xhtml?

2006-09-28 Thread Adrian Holovaty

On 9/27/06, Gábor Farkas <[EMAIL PROTECTED]> wrote:
> or perhaps, is there some library, that "fixes" invalid (x)html?

This is only tangentially related, but if the other suggestions in
this thread haven't helped, you can always fall back on HTML Tidy:
http://tidy.sourceforge.net/ . It will fix invalid (X)HTML, and
there's a nice Python wrapper for it.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: Confused: staff / active users

2006-09-28 Thread Enrico

Hi Russel,

As I said, in my tests an inactive user with staff status could log
into the admin, but had no permissions even if he's a superuser.

I think he shouldn't be able to log in at all, instead of logging in
and being able to do nothing.

In the admin, he can't see nothing, but in other parts of the project
he'll be able to log in. If I use the is_authenticated() to show/hide
private content, an inactive user would be able to see this content,
and that doesn't feel right. The user should be treated almost as
'deleted'.

The is_staff and is_active description in the docs looks very similar.

Maybe should be clarified that is_staff is only Django admin related,
and is_active is related to the entire Django Auth, not only admin.

Just my thoughts, hope I'm not being picky with this.

Best Regards.
Enrico


--~--~-~--~~~---~--~~
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: Confused about generic.create_update

2006-09-28 Thread gkelly

Thanks for looking into this more. What you said makes sense, and I was
almost on my way to that conclusion. Specifying primary_key=True is
probably what I need. I'll give it a try.

Thanks,
Grant


--~--~-~--~~~---~--~~
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: Confused about generic.create_update

2006-09-28 Thread gkelly

Can a ForeignKey be a primary key? I'm getting the following error.

Here is the relevant part of the model:

class UserProfile(models.Model):
user = models.ForeignKey(User, primary_key=True,
edit_inline=models.STACKED, num_in_admin=1,min_num_in_admin=1,
max_num_in_admin=1,num_extra_on_change=0)
...

$ python manage.py sql profiles
calling execute_manager
BEGIN;
Traceback (most recent call last):
  File "manage.py", line 12, in ?
execute_manager(settings)
  File
"/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 1319, in execute_manager
execute_from_command_line(action_mapping, argv)
  File
"/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 1286, in execute_from_command_line
output = action_mapping[action](mod)
  File
"/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 115, in get_sql_create
final_output.extend(_get_many_to_many_sql_for_model(model))
  File
"/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 233, in _get_many_to_many_sql_for_model
table_output.append('%s %s %s %s (%s),' % \
KeyError: 'ForeignKey'


If I remove primary_key=True, then it happily produces the SQL (with
the default primary key 'id').


Grant


--~--~-~--~~~---~--~~
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 + FCGI on 1and1 shared hosting

2006-09-28 Thread Ivan Manolov

I was able to get Django to work with FCGI but the problem I'm running
into is that I get a 500 Error randomly on every few requests. I
downloaded a copy of the application and ran it using mod_python.
Everything seems to be fine.
Here is what my django.fcgi and .htaccess files look like:

django.fcgi:
#!/usr/bin/python2.4
if __name__ == '__main__':
import sys, os
sys.path = [ ...my path]
os.environ['DJANGO_SETTINGS_MODULE'] = 'cs.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(["method=threaded", "daemonize=false"])

.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]

My guess is that some of the requests, don't even get routed to
django.fcgi.
Unfortunately, 1and1 doesnt give you access to apache's error log and
the CGI Output Monitor they have on the control panel simply says
"Network Error".
Does anyone have an idea why I get a 500 Error on every few requests?
Thank you.
Ivan


--~--~-~--~~~---~--~~
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 session at Pune Python meet on 30th September

2006-09-28 Thread Sandy

Pune Python meet organized by PythonThreads.com is scheduled on 30th
September. The main purpose of the meet is to introduce Django to
Python web framework developers and encourage them to use it in their
daily tasks. Amitabh Jain will speak on Django. In the IndicThreads.com
Java meet, Amol Raje will talk about Portlets.

Speakers :-

Amitabh Jain is an IT professional with more than 8 years of experience
in companies like Infosys and Vertex. He has done his graduation in
Computer Science from Pune University followed by MBA from IIM,
Ahmedabad. Over the years, he has worked with various technologies in
different technical and managerial capacities. Currently, he is
involved in setting up a startup that is focused on executing projects
using accelerated development frameworks like Django.

He first started dealing with Python in 2000, when he was evaluating
Zope for one of the projects at Infosys in Bangalore. After that he has
been using Python in various projects.

Amol Raje is currently working as a business analyst with the Global
functions team in HSBC GLT. He was earlier with ITC Infotech in
Bangalore and has over 5 years of industry experience.

Guido van Rossum, the creator of Python, recently commented on Django.
He said, "People keep asking me to pick one, and I like Django because
I like the way its authors run their project : They really 'get'
open-source development.". He is pretty clear that he is not trying to
force the "there should be only one way to do it" philosophy on the
world of Python web frameworks. Well, Guido prefers Django, you can
judge the importance of Django from his comments.

Django session details :-

*  Introduction to Django (5 mins)
*  Mapping MVC concepts in Django (5 mins)
*  A walkthrough of a simple Django application (15 mins)
*  ORM in Django (5 minutes)
*  A look at a more complex Dnago application (30 minutes)

Session will be followed by an open discussion on Django.

Date and Time :-

Saturday, 30th September 2006

4.30 pm - 5.30 pm - Introduction to Portlets. Walkthrough of portlet
development and how they could be put to use (business drivers). Also a
quick walkthough on portlet administration - by Amol Raje

5.35 pm - 6.35 pm - Pune Python meet - A session on Django. Django is a
high-level Python Web framework that encourages rapid development and
clean, pragmatic design. - by Amitabh Jain

Venue :-

Symbiosis Institute of Computer Studies and Research (SICSR),
7th floor, Atur Center, Model Colony, Pune, India
(Event supported by SICSR)

* Entry is free of cost. Entry on first come first served basis.

*Please share the meet details or this file on your college / company
mailing lists or notice boards so that others could also benefit.*

IndicThreads and PythonThreads meets are held on the last Saturday of
each month.


--~--~-~--~~~---~--~~
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 join 2 QuerySets? (with QuerySet object in result)

2006-09-28 Thread Scater

I have 2 QuerySets: news and articles
I want to have new QuerySet: newsPlusArticles with data from news and
articles on it.
Solution list(news) + list(articles) is not right for me because i want
to use result QuerySet in Paginator object.

Thanks for Your answers.


--~--~-~--~~~---~--~~
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 & Jitsu Combination - Help Needed

2006-09-28 Thread mmohen

Hi,

We would like to use jitsu as a client GUI and Django as a backend. we
wish to know that is it possible this combination will work out or is
there any issues to be solved. 

Thanks
M Mohen


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



Project level template tags?

2006-09-28 Thread zenx

Hi,
I was wondering if it was possible to create project level template
tags that can be called by any app template.

Thank you!


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



authentication/access control for static files

2006-09-28 Thread [EMAIL PROTECTED]

I'm planning to play with django and I am totally a django noob.

my question is how can I set access control of static files on a
separate server.

for example, I have a dynamic page created, which has a url pointing to
a static file on another server.

if I have access to both servers; how can I control who can access the
static file.


if I leave the static file's url untouched, anyone can look at the html
code and figure out how to access that file regardless of permissions.

what are my options? some kind of token mechanism? redirection to temp
link?.

please show me examples of a possible solution or point me to where I
can find the solution.

Thanks.

-Bedros


--~--~-~--~~~---~--~~
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 join 2 QuerySets? (with QuerySet object in result)

2006-09-28 Thread Joe

Are the news and articles using the same fields?

if so, you can do some custom SQL like this (warning: hack follows):

News.objects.extras([ '  WHERE [...] UNION (SELECT * FROM ARTICLES
WHERE [...] )' ])


--~--~-~--~~~---~--~~
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: explicit array access in django templates

2006-09-28 Thread Don Arbow

On Sep 28, 2006, at 7:08 AM, falcon wrote:
>
> Let's say I have two arrays:
> data=[["a",1,9],["b",2,8],["c",3,7],["d",4,6],["e",5,5]]
> type=['string','number','number]
>
> I iterate through the 'data' array (either with 'for' or 'range'  
> loops)
> and render a  with values from the array.
> ..
> range rownumber from 0 to sizeOfData
> ..
>  range columnnumber from 0 to sizeOfColumn
>{{data.rownumber.columnnumber}}
> 
> ..
>
> For some reason, type.columnnumber and data.rownumber.columnnumber  
> seem
> to print empty strings.
>
> The context does indeed have the two arrays...I can't figure out why I
> get blanks when every thing else seems to work fine.  I'm obviously
> brand new to django templates, am I doing something obviously wrong?



You cannot append a variable onto a list variable to use its value as  
an index into the list. columnumber is not an attribute of the type  
list, nor is rownumber an attribute of the data list.

In addition, range is not a standard Django template tag, where did  
you find that? As I mentioned, you cannot index the list variables,  
therefore a range template tag would not do much good. Most of the  
time, an iterator is more efficient than indexing into an array.

What I would do is this:

{% for d in data %}
{% for t in type %}
{{ d.0 }}{{ d.1 }}{{ d.2 }}
{% endfor %}
{% endfor %}

But since you already know the types of the three columns, I would  
just go ahead and hard code them into the template.

Don


--~--~-~--~~~---~--~~
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: authentication/access control for static files

2006-09-28 Thread James Bennett

On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> for example, I have a dynamic page created, which has a url pointing to
> a static file on another server.

Django provides a mechanism for extending Apache's own authentication
to check against the Django user database, but this requires Django to
be running on all the servers involved:

http://www.djangoproject.com/documentation/apache_auth/

-- 
"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: authentication/access control for static files

2006-09-28 Thread Bedros Hanounik
thanks for the quick response; that should work for me for now (low traffic); but I wonder how it scales with high traffic site. Also, any idea how this may apply to lighttpd.
On 9/28/06, James Bennett <[EMAIL PROTECTED]> wrote:
On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:> for example, I have a dynamic page created, which has a url pointing to
> a static file on another server.Django provides a mechanism for extending Apache's own authenticationto check against the Django user database, but this requires Django tobe running on all the servers involved:
http://www.djangoproject.com/documentation/apache_auth/--"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: Re: authentication/access control for static files

2006-09-28 Thread James Bennett

On 9/28/06, Bedros Hanounik <[EMAIL PROTECTED]> wrote:
> thanks for the quick response; that should work for me for now (low
> traffic); but I wonder how it scales with high traffic site. Also, any idea
> how this may apply to lighttpd.

The PythonAuthenHandler directive used to make this work is specific
to Apache/mod_python.

-- 
"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: How tune fastcgi for django?

2006-09-28 Thread mamcxyz

The fork error is not in lighttpd, is when I login with SSH console...


--~--~-~--~~~---~--~~
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: authentication/access control for static files

2006-09-28 Thread Ivan Sagalaev

Bedros Hanounik wrote:
> thanks for the quick response; that should work for me for now (low 
> traffic); but I wonder how it scales with high traffic site. Also, any 
> idea how this may apply to lighttpd.

In Lighty there is a "secure download" module 
(http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload) that creates 
temporary static files based on user credentials.

--~--~-~--~~~---~--~~
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: Project level template tags?

2006-09-28 Thread Ivan Sagalaev

zenx wrote:
> Hi,
> I was wondering if it was possible to create project level template
> tags that can be called by any app template.

Create an app specially for such tags, name it like "common_tags", 
include it in INSTALLED_APPS and then you can use those tags throughout 
the project using {% load common_tags %} in templates.

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



Pro Django Book preview

2006-09-28 Thread [EMAIL PROTECTED]

Hi everyone!

Has anyone previewed the book on Django which is about to be released
by Apress?

http://www.amazon.com/Pro-Django-Development-Done-Right/dp/1590597257

Is it a good book for beginners to pick up and explore?

I'm just starting and I am starting to see patterns but I'd love a
properly structured course.


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



acts_as_list?

2006-09-28 Thread Paul Barry

Does django has something like the rails ActiveRecord acts_as_list?

For those who don't know what acts_as_list is, it gives you the api
for dealing with an ordered list of objects.  For example, think if
was modeling a book.  I would have a Book object with a one to of a
simple Netflix queue.  You might have a database table like this:

class Book(models.Model):
title = models.CharField(maxlength=50)

class Chapter(models.Model):
book = models.ForeignKey(Book)
position = models.IntegerField
title = models.CharField(maxlength=50)

Now, it would be nice if I could do something like this:

#Create the book
book = Book(title="Dive Into Python")

#Create a chapter, have it automatically set the position
#based on the current number of chapters
chapter = Chapter(book=b, title="Installing Python")

#If that's not possible, how would you do it manually, like this?
chapter = Chapter(book=b, title="Installing Python",
position=book.chapter_set.count()+1)

#Anyway, save the chapter
chapter.save()

#Make another chapterm.  By the way, I'm a Java programmer, new to Python,
#will this work like I think?  Does chapter now point to a new
instance of Chapter,
#and changes after this line would have no effect
#on the chapter I created in the previous line?
chapter = Chapter(book=b, title="Your First Python Program",
position=book.chapter_set.count()+1)

#Now I realize the chapters are out of order, so I want to re-order them
#It would be nice if this method would set the value of the current
#chapter's position to 1, and the value of the other chapter's position to 2
chapter.move_lower

Here are some links to acts_as_list:
http://rubyonrails.org/api/classes/ActiveRecord/Acts/List/InstanceMethods.html
http://brianfox.wordpress.com/2006/08/08/acts_as_list-in-ruby-on-rails/

Here are the methods with a description:
decrement_position Moves an item position down one
first?  Returns true if item is first in list,
false if not higher_item Returns the record immediately  above the
current record
in_list?   Returns true if item is in list, false if not
increment_position  Moves an item up one position
insert_at(position = 1) Adds an item to the list in a specific position
last?  Returns true if item is last in list,
false if not
lower_item Returns the record immediately below the
current record
move_higher  Moves an item up one position
move_lower   Moves an item down one position
move_to_bottom   Moves an item to the bottom of the list
move_to_top Moves an item to the top of the list
remove_from_list   Removes an item from the list

--~--~-~--~~~---~--~~
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: Confused about generic.create_update

2006-09-28 Thread Malcolm Tredinnick

On Thu, 2006-09-28 at 17:08 +, gkelly wrote:
> Can a ForeignKey be a primary key?

Possibly not.

>  I'm getting the following error.
> 
> Here is the relevant part of the model:
> 
> class UserProfile(models.Model):
> user = models.ForeignKey(User, primary_key=True,
> edit_inline=models.STACKED, num_in_admin=1,min_num_in_admin=1,
> max_num_in_admin=1,num_extra_on_change=0)
> ...

Given the way you are wanting to use this, isn't there only going to be
one UserProfile per User? If that is the case, a one-to-one field will
fit your requirements nicely, since it is a primary key by default (at
the moment, you can't make it *not* be a primary key).

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 tune fastcgi for django?

2006-09-28 Thread Malcolm Tredinnick

On Thu, 2006-09-28 at 16:21 -0700, mamcxyz wrote:
> The fork error is not in lighttpd, is when I login with SSH console...

Which confirms it has nothing to do with the max-procs parameter. You
have other system level problems going on.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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: authentication/access control for static files

2006-09-28 Thread Bedros Hanounik
thanks, that's exactly what I'm looking for.On 9/28/06, Ivan Sagalaev <[EMAIL PROTECTED]
> wrote:Bedros Hanounik wrote:> thanks for the quick response; that should work for me for now (low
> traffic); but I wonder how it scales with high traffic site. Also, any> idea how this may apply to lighttpd.In Lighty there is a "secure download" module(
http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload) that createstemporary static files based on user credentials.

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


Preventing Multiple Submits

2006-09-28 Thread Ian Maurer

Just wondering if anyone has thought through the problem of multiple
submits due to multiple clicks of a submit button?

I am already properly using POSTs and GETs and doing a redirect after
a POST, as recommeded by the Django docs.

The issue I am talking about is when a user clicks the submit button rapidly.

The "easy" answer is to use JavaScript to disable the submit button
after the first click and I guess I am leaning towards that since I do
require JavaScript for the particular app I am working on. However, I
was hoping to come up with a more general purpose solution.

One thought I had was overriding the AddManipulator and adding a
hidden field with a "token". And then using the Session map to store
and retrieve the primary key of a created object using the token.

Then it occurred to me that the CSRF middleware is already doing
something very similar and I was wondering if anyone already leveraged
it to also handle this problem? (Or can think of a reason why not to)

http://www.djangoproject.com/documentation/csrf/

And even if I do solve this problem, there are still synchronization
issues to deal with the multiple submits. (ie, if request 1 doesn't
store the pk prior to request 2 goes looking for it).

I am beginning to think that I am overthinking this, but I still want
to see if anyone else has thought this through...

thanks,
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-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 & Jitsu Combination - Help Needed

2006-09-28 Thread Malcolm Tredinnick

On Wed, 2006-09-27 at 17:07 +, mmohen wrote:
> Hi,
> 
> We would like to use jitsu as a client GUI and Django as a backend. we
> wish to know that is it possible this combination will work out or is
> there any issues to be solved. 

As far as I can recall, nobody has ever mentioned this combination
before on django-users or django-devel (I even had to go and serach to
find out what Jitsu is). So I think you're on a voyage of discovery. If
you make some useful progress, it would be interesting to hear how you
solved various problems.

Good luck.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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: changing models

2006-09-28 Thread Malcolm Tredinnick

On Thu, 2006-09-28 at 16:59 +0200, Carlo Caponi wrote:
> hi,
> this is my model:
> 
> class Poll(models.Model):
>   question=models.CharField(maxlength=200)
> 
> If i run './manage.py syncdb' it creates tables on db. Now i populate
> tables with something.
> 
> Now, if i change the model:
> 
> class Poll(models.Model):
>   question=models.CharField(maxlength=200)
>   pub_date=models.DateTimeField('date published')
> 
> and i run './manage.py syncdb', it deletete contents of tables..

Are you sure? Syncdb should *never* touch tables that already exist. The
"reset" option to manage.py will drop the tables and recreate them, but
"syncdb" is very safe to run when you already have some tables created.

So are you really just running syncdb and having the tables emptied?

Regards,
Malcolm



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



settings

2006-09-28 Thread Henrik Vendelbo - Fashion Content

Ouch 20 mins into trying out Django and the water is getting too hot.

Where am I supposed to put my things such as mysite.settings?

I run on FC5 and installed the Django egg. I thought it would be a good idea
to put all my stuff in /opt/test-site, but
apparently I can't use absolute path when referring to the settings file in
mod_python config.

So I tried to drop the setting sile in site-packages, but that doesn't seem
to work either.

On a side not, why can't django detect that I have modified a file and
reload it, much better than running in a beta mode.

Henrik


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



Why I'm giving up on Django

2006-09-28 Thread Sean Schertell

Hi Guys,

I just wanted to share with the community my personal experience with  
Django in the hopes that maybe some of my petty gripes might be  
somehow helpful. Before doing that, I have to thank everyone in the  
community for being so helpful and just so damn nice! Thanks so much  
to all on this list and on the IRC channel.

So here's the thing... I came from a background of PHP and then Ruby  
on Rails. I was drawn to Django because it seems more modular and a  
better match for my goal of creating web *sites* with apps the live  
*in* the sites. Rails doesn't really work that way at all. And PHP?  
-- well, you know. PHP lends itself to a style of coding that is so  
not DRY, it's like coding underwater.

So I went on a quest to find a well-polished, easy to use framework  
that is modular, object oriented, does the basics like database  
abstraction and form validation, is easy to deploy, and most  
importantly: *doesn't get in my way*. After exploring lots of  
options, I settled on Django. I bought a book on Python, went though  
the Django tutorials, read the docs, etc. It all looked fantastic!

The things I was most excited about were:

(1) Clean modular design with 'apps' that can be imported into  
'projects'

(2) Included libraries for things like authentication

(3) Reasonably easy forms with form wrappers/manipulators

(4) The free Admin section!

(5) Overall really polished look and feel -- even the error pages

(6) Super simple deployment with mod_python

(7) Opinionated design decisions start you off with something  
sensible so you don't have to reinvent the wheel for things like  
naming conventions or directory structure.

--

But I'm very sorry to say that one by one, all of these things turned  
out to be not so great after all. Here's what I found after six weeks  
of struggling to build a site in Django that would have taken a week  
or so in PHP.

--

(1) The clean modular apps aren't totally decoupled because they  
still have to use the project's template directory and css (which  
makes sense perhaps but complicates things for what I'm trying to  
achieve). More importantly, there's no built-in facility for  
rendering templates which are just static pages. Yes I know there's  
flatpages and templatepages but it would be a lot nicer if Django  
just served up the template in the absence of a url-routed view. I  
ended up writing my own little app to do this which took the better  
part of a day. So it took extra work to accomplish something as  
simple as serving a static html page.

(2) This is a biggie for me. I can't believe that the authentication  
module forces you to use hard coded urls for login/logout pages --  
that's just maddening! So if you want to do it your own way, you have  
to totally roll your own authentication from scratch. More work. I  
ended up hiring a guy to write a basic auth system that lets me set  
my own urls.

(3) FormWrappers are great until you need to do anything even  
slightly different from the django prescribed method, then you have  
to use custom manipulators which I found to be a giant pain in the  
ass. I spent literally several days working on one form (yes it's a  
complex form -- but 4 days is ridiculous). The first thing that threw  
me was that I wanted to use a more traditional  method of inputting a  
date -- just three pulldown menus for month, date, year. Instead of  
providing some simple facility to let you override parts of the  
standard manipulators, as soon as you find something you want to do  
that isn't included, you have to write a whole custom manipulator for  
it.

(4) The admin section is certainly pretty enough for production use  
-- but it isn't flexible enough in my opinion. Take my 3-pulldown  
menus for inputting a date as an example. How would you go about  
doing that in the admin section? I suppose there's probably some way  
-- but this is another example of django getting in the way -- adding  
extra work where I'd hoped it would be reducing work. After  
identifying a few things that wouldn't work easily with the free  
admin section, it looked like the easiest solution was to do my own  
custom admin section rather than try to sculpt the django admin  
section into what I wanted.

(5) The polish is very nice -- no question. But I was disappointed to  
discover that many of those sexy error messages didn't reveal *my*  
coding error but just reported problems as they occurred in the  
django stack. So I was often left to guess about what part of my code  
was causing the issue.

(6) Not really a django issue but disappointing nonetheless. If you  
want to deploy to a cpanel server (which is stuck in the 1900's using  
Apache 1.3), you'll have to mod_proxy out to another web server such  
as Lighttpd with FastCGI. That's exactly how Rails apps are typically  
deployed and one of the reasons I went hunting for an alternative. So  
much for the easy deployment advantage.

(7) The firs

Re: settings

2006-09-28 Thread Malcolm Tredinnick

On Fri, 2006-09-29 at 02:24 +0100, Henrik Vendelbo - Fashion Content
wrote:
> Ouch 20 mins into trying out Django and the water is getting too hot.
> 
> Where am I supposed to put my things such as mysite.settings?
> 
> I run on FC5 and installed the Django egg. I thought it would be a good idea
> to put all my stuff in /opt/test-site, but
> apparently I can't use absolute path when referring to the settings file in
> mod_python config.

The settings config string is treated as a Python module to be imported.
So you write it in import style (foo.bar.baz.settings) and it needs to
be somewhere on your Python path. You can put it anywhere you like and
have your Python path set appropriately.

The "traditional" approach (not a huge tradition, but such as it is) is
to put the settings file for a project either in the top-level project
directory or in the directory just above it. That way you can set your
Python path to the project directory's parent directory and things seem
"neat". But other setups work, too.

> So I tried to drop the setting sile in site-packages, but that doesn't seem
> to work either.

Urgh. It's not really going to be a systems-wide settings file. More
project-wide. So when you come to do project #2, this is going to have
problems.

> 
> On a side not, why can't django detect that I have modified a file and
> reload it, much better than running in a beta mode.

Not entirely sure what you mean here. The development server can detect
this. You can configure mod-python to do so, too, although it's not
recommended.

The downside of continually watching for changes is the need to monitor
*every* *single* *file* for changes, which is very difficult to do in an
efficient and portable fashion. In production situations (which are the
majority of the use, unless you have no audience at all), files hardly
ever change, so the default setting for things like mod-python is
sensible: the developer or systems operators will know when files have
changed (because they just rolled out new ones) and will know to reload
the appropriate processes.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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: Why I'm giving up on Django

2006-09-28 Thread Adrian Holovaty

On 9/28/06, Sean Schertell <[EMAIL PROTECTED]> wrote:
> So at the end of the day, my experience with Django started off with
> a *lot* of excitement. I was thrilled because it seemed I'd found
> something that met my needs exactly. But in actual usage, I found
> that using django to build a website the way *I* want to build my
> website ended up being more work than if I'd just coded it by hand in
> PHP.

Sounds like Django in its current incarnation isn't for you. Thanks
for giving it a shot, thanks for the great feedback, and check out
Django again after a while. Have fun with the PHP!

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

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



Re: Why I'm giving up on Django

2006-09-28 Thread Malcolm Tredinnick

On Fri, 2006-09-29 at 10:26 +0900, Sean Schertell wrote:
> Hi Guys,
> 
> I just wanted to share with the community my personal experience with  
> Django in the hopes that maybe some of my petty gripes might be  
> somehow helpful. Before doing that, I have to thank everyone in the  
> community for being so helpful and just so damn nice! Thanks so much  
> to all on this list and on the IRC channel.

Sorry to hear you're not completely satisfied, but thanks for taking the
time to write this regardless. It should be food for thought.

No doubt this will turn into a long thread and possibly not all relating
to your original issues, but some of your problems seems valid (others
seem to be a matter of perspective and experience and so not really
universally "fixable" in any real way). On the whole, though, it's good
to hear what people think.

A couple of brief comments below:
[...]
> (1) Clean modular design with 'apps' that can be imported into  
> 'projects'
> 
> (2) Included libraries for things like authentication
> 
> (3) Reasonably easy forms with form wrappers/manipulators
> 
> (4) The free Admin section!
> 
> (5) Overall really polished look and feel -- even the error pages
> 
> (6) Super simple deployment with mod_python
> 
> (7) Opinionated design decisions start you off with something  
> sensible so you don't have to reinvent the wheel for things like  
> naming conventions or directory structure.
> 
> --
> 
> But I'm very sorry to say that one by one, all of these things turned  
> out to be not so great after all. Here's what I found after six weeks  
> of struggling to build a site in Django that would have taken a week  
> or so in PHP.

That's probably an experience thing. Although Django does advertise
"stupidly fast" or something like that, I would prefer that we thought
of that "on average". Any new system takes a little while to ramp up.

That being said, the initial learning curve, particularly for the
corporate-style user, is something we are working on actively and should
continue to do so.

> --
> 
> (1) The clean modular apps aren't totally decoupled because they  
> still have to use the project's template directory and css (which  
> makes sense perhaps but complicates things for what I'm trying to  
> achieve).

Not sure why you didn't think you could put these inside the app
directories. It's possible.

>  More importantly, there's no built-in facility for  
> rendering templates which are just static pages. Yes I know there's  
> flatpages and templatepages but it would be a lot nicer if Django  
> just served up the template in the absence of a url-routed view. I  
> ended up writing my own little app to do this which took the better  
> part of a day. So it took extra work to accomplish something as  
> simple as serving a static html page.

It's not clear from this what you wanted to do that isn't covered by
flatpages of TemplatePages or a small variation thereof. But if there's
something you really needed here and couldn't do, I agree that could be
frustrating.

> (2) This is a biggie for me. I can't believe that the authentication  
> module forces you to use hard coded urls for login/logout pages --  
> that's just maddening!

Again, this isn't universally correct, so it would be interesting to
hear what your specific case was. You can have any URL you like being
the login URL (or even multiple ones -- so you can have a login box on
every page if you want) and you can redirect to wherever you like
afterwards. So customisable entry and exit points -- what other
flexibility is useful here?

The auth system is not the best documented piece of Django, though.
Improvements there will be welcomed by many people, I'm sure.

>  So if you want to do it your own way, you have  
> to totally roll your own authentication from scratch. More work. I  
> ended up hiring a guy to write a basic auth system that lets me set  
> my own urls.
> 
> (3) FormWrappers are great until you need to do anything even  
> slightly different from the django prescribed method, then you have  
> to use custom manipulators which I found to be a giant pain in the  
> ass. I spent literally several days working on one form (yes it's a  
> complex form -- but 4 days is ridiculous). The first thing that threw  
> me was that I wanted to use a more traditional  method of inputting a  
> date -- just three pulldown menus for month, date, year. Instead of  
> providing some simple facility to let you override parts of the  
> standard manipulators, as soon as you find something you want to do  
> that isn't included, you have to write a whole custom manipulator for  
> it.

Manipulators are a different way of thinking and it seems not entirely
intuitive to everybody. This is certainly a stumbling block for many and
one reason we are trying to improve them and remove a lot of the
complexity and restrictions they impose at the moment.

I suspect this is partly an experience/learning curve item, bu

Re: Why I'm giving up on Django

2006-09-28 Thread Kenneth Gonsalves


On 29-Sep-06, at 6:56 AM, Sean Schertell wrote:

> But I'm very sorry to say that one by one, all of these things turned
> out to be not so great after all. Here's what I found after six weeks
> of struggling to build a site in Django that would have taken a week
> or so in PHP

all the 7 points you mention have been bugging me for some time now.  
but I am not giving up on django for the simple reason that all of  
them are actively in the process of being fixed - as a casual look at  
the devel list would show you. In fact right now I am struggling with  
an app which I thought would take me 20 minutes - but has crossed a  
day and a half already because of these issues. But once its done -  
it'll stay done and i can sleep at night. You *have* noticed that the  
django community rocks - but dont realise that that is the prime  
reason why you shouldnt give up on Django

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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: explicit array access in django templates

2006-09-28 Thread falcon

Don,
First of all I have to admit that I was testing with jinja templates,
which are supposed to be based on django (i wanted to run into just
these kinds of limits before setting up django).

Unfortunately I don't know hwo many columns my table will have, I want
a generic solution which requires that I iterate over columns as well
as rows.  Is there really no way to index into an array?  Are there
work-arounds, perhaps iterating over two variables at the same time
({%for x,y in data,type%})? I didn't see any thing in the documentation
that might help (i had some hope for the splice tag but I don't think
that is appropriate here).

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: Confused about generic.create_update

2006-09-28 Thread gkelly

It's funny. Everyone I ask about this problem says to use the other
type of Field (either OneToOne or ForeignKey). I have tried both. See
this thread for my problems with OneToOne:
http://groups.google.com/group/django-users/browse_thread/thread/9789d5e4bf24a4c3/

I just recently upgraded from 0.95 to 0.96-pre and this seems to have
solved the problem of saving an edit_inline ForeignKey in the admin.
Also, I am writing custom manipulators and views instead of using the
generic views, so this problem is avoided. It's a shame the generic
views can't handle my model relationships, but it's probably good
practice for me to write custom manipulators/views anyway.  I'm using a
Manipulator class (from the code wiki, can't find the link at the
moment) that is really simplifying things. (That is, unless
manipulators completely go away and I have to re-write them all in some
futuristic way.)

So I guess this problem is solved.

Thanks,
Grant


--~--~-~--~~~---~--~~
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: Why I'm giving up on Django

2006-09-28 Thread Don Arbow

On Sep 28, 2006, at 6:26 PM, Sean Schertell wrote:
>
> (2) This is a biggie for me. I can't believe that the authentication
> module forces you to use hard coded urls for login/logout pages --
> that's just maddening! So if you want to do it your own way, you have
> to totally roll your own authentication from scratch. More work. I
> ended up hiring a guy to write a basic auth system that lets me set
> my own urls.


This isn't such a roadblock. There are many places in Django where  
you can ignore the abstractions and use the low level code. In less  
than 5 minutes, I wrote my own login/logout methods and called out to  
the basic auth methods when needed:

from django.contrib import auth
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response

def login(request):
if request.POST:
username = request.POST.get('username', None)
password = request.POST.get('password', None)
user = auth.authenticate(username=username,password=password)
if user :
if not user.isactive:
return render_to_response('user/login.html'
{'message':'This account is not 
active.'})
auth.login(request, user)
return HttpResponseRedirect('/')

return render_to_response('user/login.html',
{'message':'Please enter a username and password.'})

def logout(request):
auth.logout(request)
return HttpReponseRedirect('/')


Don



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

2006-09-28 Thread Graham Dumpleton

Malcolm Tredinnick wrote:
> > On a side not, why can't django detect that I have modified a file and
> > reload it, much better than running in a beta mode.
>
> Not entirely sure what you mean here. The development server can detect
> this. You can configure mod-python to do so, too, although it's not
> recommended.
>
> The downside of continually watching for changes is the need to monitor
> *every* *single* *file* for changes, which is very difficult to do in an
> efficient and portable fashion. In production situations (which are the
> majority of the use, unless you have no audience at all), files hardly
> ever change, so the default setting for things like mod-python is
> sensible: the developer or systems operators will know when files have
> changed (because they just rolled out new ones) and will know to reload
> the appropriate processes.

The default setting for mod_python is actually to reload modules. That
this is
the case though is irrelevant anyway as Django doesn't use mod_python's
module
importer anyway for any code managed under Django. Instead, Django uses
__import__ directly to import modules. To get this to work without
naming
collisions Django requires code to effectively reside in one big Python
package
structure. That it uses a package structure in this way makes it
basically
impossible to implement a module reloading scheme, as the very way that
imports within a package are done via the root of the package causes
loops
in the dependencies between modules within the package. Because it
isn't
just a tree like structure, the only option would be to reload every
module within
the package when any single module has changed and even then depending
on how data is cached and shared amongst modules in the package, it is
still
not practical and would cause lots of problems.

Even with mod_python there are lots of issues with its module importer.
These
have been documented at:


http://www.dscpl.com.au/wiki/ModPython/Articles/ModuleImportingIsBroken

A new module importer implementation in mod_python 3.3 will fix just
about
all of the issues, but in doing so it explicitly ignores Python
packages and
will not consider them as something that can be reloaded. Because of
how
Django relies on Python packages, it wouldn't even be able to use a
similar
scheme. To do so would require a fundamental part of how Django works
to
be changed and there is no way people would accept that. Thus, because
of
that earlier design decision, I would suggest you will never see
automatic
module reloading in Django.

Graham


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



Re: Why I'm giving up on Django

2006-09-28 Thread James Bennett

On 9/28/06, Sean Schertell <[EMAIL PROTECTED]> wrote:
> (1) The clean modular apps aren't totally decoupled because they
> still have to use the project's template directory and css (which
> makes sense perhaps but complicates things for what I'm trying to
> achieve).

No, they don't.

http://www.djangoproject.com/documentation/templates_python/#loader-types


> (2) This is a biggie for me. I can't believe that the authentication
> module forces you to use hard coded urls for login/logout pages

So file a ticket; the login/logout URLs are a bit of a wart, and we
could certainly stand to improve that situation.

> (3) FormWrappers are great until you need to do anything even
> slightly different from the django prescribed method, then you have
> to use custom manipulators which I found to be a giant pain in the
> ass.

There's a reason why we're working on a replacement for the
manipulator system :)


> (4) The admin section is certainly pretty enough for production use
> -- but it isn't flexible enough in my opinion.

I don't think it's ever going to be "flexible enough" or "customizable
enough" for every conceivable use. It's just plain impossible. Right
now, I think we do a good job of getting to, or at least close to, the
80% mark.


> (5) The polish is very nice -- no question. But I was disappointed to
> discover that many of those sexy error messages didn't reveal *my*
> coding error but just reported problems as they occurred in the
> django stack. So I was often left to guess about what part of my code
> was causing the issue.

Tracebacks are a really hard thing to handle well in an application
stack with more than a couple of components; generally the debug pages
are nice, though, because they give you the local vars at each level
-- when (as is often the case) an error occurred because some code
didn't raise an exception but *did* do something it shouldn't have,
having the local vars can be a lifesaver.


> (6) Not really a django issue but disappointing nonetheless. If you
> want to deploy to a cpanel server (which is stuck in the 1900's using
> Apache 1.3), you'll have to mod_proxy out to another web server such
> as Lighttpd with FastCGI.

There's not much that can be done about this; as Malcolm pointed out,
Apache 2 has been around for almost half a decade, and so if you want
to use Django under mod_python you need Apache 2.


> (7) The first thing I did after creating a new project was to
> organize the directory structure more sensibly. Littering the top
> level of your project with things like manage.py and urls.py just
> isn't very clean.

What would be cleaner? Also, the ROOT_URLCONF setting lets you put
your root URLs file anywhere on your Python path, and if you don't
like manage.py, just use django-admin.py with the
DJANGO_SETTINGS_MODULE environment variable or pass it the explicit
'settings' argument.

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



Font.

2006-09-28 Thread Gabriel Puliatti
I liked the Django font a lot. Does anyone know what font is used in the
Django logo[1]? 

[1]http://media.djangoproject.com/img/site/hdr_logo.gif


-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


Re: Why I'm giving up on Django

2006-09-28 Thread Michael Radziej

Sean Schertell schrieb:
>
> (3) FormWrappers are great until you need to do anything even  
> slightly different from the django prescribed method, then you have  
> to use custom manipulators which I found to be a giant pain in the  
> ass. I spent literally several days working on one form (yes it's a  
> complex form -- but 4 days is ridiculous). The first thing that threw  
> me was that I wanted to use a more traditional  method of inputting a  
> date -- just three pulldown menus for month, date, year. Instead of  
> providing some simple facility to let you override parts of the  
> standard manipulators, as soon as you find something you want to do  
> that isn't included, you have to write a whole custom manipulator for  
> it.

This is recognized. Well, in the end every framework will give 
you a frame and make things that fit it easy, but somewhere it 
ends, and then your down to yourself. I didn't find manipulators 
particularly hard to use once you've learned how they work and 
what parts you need. I only wished I wouldn't have first tried to 
derive from the automatic manipulators. It seems to be so much 
easier just to derive from django.forms.Manipulator instead. And 
I'm really looking forward to the "new way" with model 
validation, bound forms etc.

Now, I still can deal well with current manipulators, but there's 
one major hassle:

Manipulators get very hard to use when you deal with inline 
editing on yourself, because all this inline collection stuff is 
not very flexible and heavily underdocumented. Either I'm too 
stupid, or there's the really dark djungle of django.

Another point is that I wished Django had SqlAlchemy as ORM. The 
built-in just is too naive for my taste. But there's already a 
branch starting on SqlAlchemy integration.


Looking into other frameworks, I give a lot on good 
documentation, and I hate when I have to dig into the source to 
find out details about the API. I just couldn't find any 
competitor that comes any close to django in this aspect. I'm 
with django.

Michael


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