ANN: Django 1.3 released

2011-03-22 Thread James Bennett
It's here!

Django 1.3 has been officially released.

Blog post here: http://www.djangoproject.com/weblog/2011/mar/23/13/
Release notes here: http://docs.djangoproject.com/en/dev/releases/1.3/
Download here: http://www.djangoproject.com/download/


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorting in /admin

2011-03-22 Thread Jason Culverhouse


> On Tue, Mar 22, 2011 at 5:29 PM, Jason Culverhouse  
> wrote:
> On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote:
> 
> > how else would you pull in information from another model into the
> > current model list view in admin?
> >
> >
> There are some options:
> Search for
> http://www.google.com/search?q=ModelAdmin+__
> 
> You'll find http://code.djangoproject.com/ticket/10743
> "Support lookup separators in ModelAdmin.list_display"
> 
> If this "bug" were fixed, your problem would be solved
> 
> There is no need for any Django change to get this to work today. All that 
> needs to be done is for the existing callables specified in list_display to 
> specify the appropriate admin_order_field value, e.g.:
> 
> 
> def Client_Lastname(self, obj):
> return  obj.CustomerId.lastName
> Client_Lastname.admin_order_field  = 'CustomerId__lastName'
> 
> Doc on admin_order_field is 
> here:http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display,
>  search for admin_order_field.
> 

I missed that, I see that the latest docs
 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
Specifically state: "Fields in list_filter can also span relations using the __ 
lookup:"

I don't see that verbiage for other fields, perhaps a Doc enhancement is in 
order?



> Karen
> -- 
> http://tracey.org/kmt/
> 
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: sorting in /admin

2011-03-22 Thread Karen Tracey
On Tue, Mar 22, 2011 at 5:29 PM, Jason Culverhouse wrote:

> On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote:
>
> > how else would you pull in information from another model into the
> > current model list view in admin?
> >
> >
> There are some options:
> Search for
> http://www.google.com/search?q=ModelAdmin+__
>
> You'll find http://code.djangoproject.com/ticket/10743
> "Support lookup separators in ModelAdmin.list_display"
>
> If this "bug" were fixed, your problem would be solved
>

There is no need for any Django change to get this to work today. All that
needs to be done is for the existing callables specified in list_display to
specify the appropriate admin_order_field value, e.g.:


def Client_Lastname(self, obj):
return  obj.CustomerId.lastName
Client_Lastname.admin_order_field  = 'CustomerId__lastName'

Doc on admin_order_field is here:
http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display,
search for admin_order_field.

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query on MySQL

2011-03-22 Thread Javier Guerra Giraldez
On Tue, Mar 22, 2011 at 10:42 PM, Brian Neal  wrote:
> This is what I came up with to reduce the long times I was
> seeing (but it still is slow). This is probably going to get ugly in
> email, maybe I should have dpasted it:

ugliness is assumed in SQL :-)

is there an index on Post.creation_date ?

-- 
Javier

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: suspiciousoperation with file upload on django-cms

2011-03-22 Thread Karen Tracey
On Tue, Mar 22, 2011 at 5:12 PM, Tony  wrote:

>  I have looked at my media_url and
> media_root, and played with them but I haven't been able to have any
> success.
>

MEDIA_URL isn't relevant for the problem you are reporting. MEDIA_ROOT is.
It would help people help you if you shared what value you have been trying
for MEDIA_ROOT.

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query on MySQL

2011-03-22 Thread Brian Neal
On Mar 22, 10:15 pm, Javier Guerra Giraldez 
wrote:
> On Tue, Mar 22, 2011 at 10:06 PM, Brian Neal  wrote:
> > I see. There are in fact only 15 forums. But why does it take 40
> > seconds? I can get much better results if I do a select on each forum
> > individually and combine them together in Python code. So in this case
> > 15 selects is far better than 1. Maybe that's an expected result in
> > some cases, but it sure surprised me.
>
> can you post the full SQL query?
>

Sure. This is what I came up with to reduce the long times I was
seeing (but it still is slow). This is probably going to get ugly in
email, maybe I should have dpasted it:

items = Post.objects.filter(topic__forum=8).order_by('-
creation_date').select_related('topic', 'user', 'topic_forum')[:30]

produces (time 0.289 seconds):

SELECT `forums_post`.`id`, `forums_post`.`topic_id`,
`forums_post`.`user_id`, `forums_post`.`creation_date`,
`forums_post`.`update_date`, `forums_post`.`body`,
`forums_post`.`html`, `forums_post`.`user_ip`, `forums_topic`.`id`,
`forums_topic`.`forum_id`, `forums_topic`.`name`,
`forums_topic`.`creation_date`, `forums_topic`.`user_id`,
`forums_topic`.`view_count`, `forums_topic`.`sticky`,
`forums_topic`.`locked`, `forums_topic`.`post_count`,
`forums_topic`.`update_date`, `forums_topic`.`last_post_id`,
`auth_user`.`id`, `auth_user`.`username`, `auth_user`.`first_name`,
`auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`,
`auth_user`.`is_staff`, `auth_user`.`is_active`,
`auth_user`.`is_superuser`, `auth_user`.`last_login`,
`auth_user`.`date_joined` FROM `forums_post` INNER JOIN `forums_topic`
ON (`forums_post`.`topic_id` = `forums_topic`.`id`) INNER JOIN
`auth_user` ON (`forums_post`.`user_id` = `auth_user`.`id`) WHERE
`forums_topic`.`forum_id` = 8  ORDER BY `forums_post`.`creation_date`
DESC LIMIT 30

This:
items = Post.objects.filter(topic__forum__in=forums).order_by('-
creation_date').select_related('topic', 'user', 'topic_forum')[:30]

produces (in 7.357 seconds)

SELECT `forums_post`.`id`, `forums_post`.`topic_id`,
`forums_post`.`user_id`, `forums_post`.`creation_date`,
`forums_post`.`update_date`, `forums_post`.`body`,
`forums_post`.`html`, `forums_post`.`user_ip`, `forums_topic`.`id`,
`forums_topic`.`forum_id`, `forums_topic`.`name`,
`forums_topic`.`creation_date`, `forums_topic`.`user_id`,
`forums_topic`.`view_count`, `forums_topic`.`sticky`,
`forums_topic`.`locked`, `forums_topic`.`post_count`,
`forums_topic`.`update_date`, `forums_topic`.`last_post_id`,
`auth_user`.`id`, `auth_user`.`username`, `auth_user`.`first_name`,
`auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`,
`auth_user`.`is_staff`, `auth_user`.`is_active`,
`auth_user`.`is_superuser`, `auth_user`.`last_login`,
`auth_user`.`date_joined` FROM `forums_post` INNER JOIN `forums_topic`
ON (`forums_post`.`topic_id` = `forums_topic`.`id`) INNER JOIN
`auth_user` ON (`forums_post`.`user_id` = `auth_user`.`id`) WHERE
`forums_topic`.`forum_id` IN (3, 4, 14, 2, 6, 9, 8, 10, 5, 7, 11, 12,
13, 16) ORDER BY `forums_post`.`creation_date` DESC LIMIT 30

Each Post has a foreign key to a Topic and each Topic has a foreign
key to a Forum.

I guessing all those INNER JOIN's are killing me 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query on MySQL

2011-03-22 Thread Javier Guerra Giraldez
On Tue, Mar 22, 2011 at 10:06 PM, Brian Neal  wrote:
> I see. There are in fact only 15 forums. But why does it take 40
> seconds? I can get much better results if I do a select on each forum
> individually and combine them together in Python code. So in this case
> 15 selects is far better than 1. Maybe that's an expected result in
> some cases, but it sure surprised me.

can you post the full SQL query?

-- 
Javier

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Another problem with django static files

2011-03-22 Thread Brian Neal
On Mar 22, 9:58 pm, jim_rain  wrote:
> Brian -
>
> Thanks for the reply - I missed that step. But when I added it the
> behavior changed but still no joy. The form has text field in addition
> to the date picker - it looks like this:
>
> class JTestForm(forms.Form):
>     input          = forms.CharField(label='Please enter some input',
> max_length=100)
>     start_time =
> JqSplitDateTimeField(widget=JqSplitDateTimeWidget(attrs={'date_class':'date 
> picker','time_class':'timepicker'})),
>
> In my template I was outputting {{ form.as_p }}
>
> I would see the CharField but not the date picker. So I changed my
> template to {{ form.media }} then I don't see anything (neither
> field) .
>
> Also when I do that the out put from runserver changed to: "GET /myApp/
> jtest/ HTTP/1.1" 200 283
>
> Any other suggestions or ideas are very welcome as I'm pretty
> stumped.
>
> Jim

Well it is really hard to say without knowing what that javascript
does or seeing your code. The javascript might be error-ing out mid-
way through and leaving your HTML in a bad way.

Get it working first without the fancy javascript. Then add one thing
in at a time, it will be easier to debug that way.

Also, look in the debug server output for HTTP responses to requests
for the javascript and CSS assets. If you see 404 then you know
something isn't right with your static files setup. If you don't see
any requests for the javascript or CSS, you probably forgot to output
the  and 

Re: Slow query on MySQL

2011-03-22 Thread Brian Neal
On Mar 22, 9:56 pm, Javier Guerra Giraldez  wrote:
> On Tue, Mar 22, 2011 at 9:49 PM, Brian Neal  wrote:
> > I studied the SQL that Django generated and it seemed fine to me.
> > That's why I wonder if it is a MySQL issue since the EXPLAIN said it
> > had a possible key (PRIMARY) but then ended up not using it (bottom
> > one):
>
> that's because it saw so few rows (just 15) that it was cheaper to
> scan the whole thing instead of using the index
>

I see. There are in fact only 15 forums. But why does it take 40
seconds? I can get much better results if I do a select on each forum
individually and combine them together in Python code. So in this case
15 selects is far better than 1. Maybe that's an expected result in
some cases, but it sure surprised me.

Thank you for that, that helps a bit.

Best,
BN

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Another problem with django static files

2011-03-22 Thread jim_rain
Brian -

Thanks for the reply - I missed that step. But when I added it the
behavior changed but still no joy. The form has text field in addition
to the date picker - it looks like this:

class JTestForm(forms.Form):
input  = forms.CharField(label='Please enter some input',
max_length=100)
start_time =
JqSplitDateTimeField(widget=JqSplitDateTimeWidget(attrs={'date_class':'datepicker','time_class':'timepicker'})),

In my template I was outputting {{ form.as_p }}

I would see the CharField but not the date picker. So I changed my
template to {{ form.media }} then I don't see anything (neither
field) .

Also when I do that the out put from runserver changed to: "GET /myApp/
jtest/ HTTP/1.1" 200 283

Any other suggestions or ideas are very welcome as I'm pretty
stumped.

Jim



On Mar 22, 5:26 pm, Brian Neal  wrote:
> On Mar 22, 6:49 pm, jim_rain  wrote:
>
>
>
>
>
>
>
>
>
> > I'm running Django 1.2.5 on a linux (Centos 5.5) server and I'm trying
> > to use a datepicker widget written by Aaron Williamson (http://
> > copiesofcopies.org/webl/2010/04/26/a-better-datetime-widget-for-
> > django/)
>
> > I followed all the steps in his write up but when I try to access the
> > form with the datepicker on it I don't see anything and the runserver
> > outputs: "GET /myApp/jtest/ HTTP/1.1" 200 409
>
> > I'm pretty sure this is because Django can't find my media files but I
> > can't figure out why. I have added this to my urls.py:
>
> >     (r'^site_media/(?P.*)$', 'django.views.static.serve',
> >         {'document_root': '/home/jim/work_area/site_base/site_media',
> > 'show_indexes': True}),
>
> > and when I go tohttp://localhost/site_mediaIsee a directory listing
> > of all the media directories and files.
>
> > In my widget class I have the following inner class:
>
> >     class Media:
> >         css = {
> >             'all' : ("site_media/css/ui-lightness/jquery-
> > ui-1.8.11.custom.css", ),
> >             }
> >         js = (
> >             "site_media/js/jqsplitdatetime.js",
> >             "site_media/js/jquery-1.5.1.min.js",
> >             "site_media/js/jquery-ui-1.8.11.custom.min.js",
> >             )
>
> > I thought that would do it but apparently not. Can anybody tell me
> > what I"m missing?
>
> > Thank you.
>
> Did you output {{ form.media }} in your template?
>
> Best,
> BN

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query on MySQL

2011-03-22 Thread Javier Guerra Giraldez
On Tue, Mar 22, 2011 at 9:49 PM, Brian Neal  wrote:
> I studied the SQL that Django generated and it seemed fine to me.
> That's why I wonder if it is a MySQL issue since the EXPLAIN said it
> had a possible key (PRIMARY) but then ended up not using it (bottom
> one):

that's because it saw so few rows (just 15) that it was cheaper to
scan the whole thing instead of using the index

-- 
Javier

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query on MySQL

2011-03-22 Thread Brian Neal
On Mar 22, 8:17 pm, smallfish xy  wrote:
> hi, you can try split the in statement, with less with "in".
>
> forums = [1, 2, 3, 4, 5]
> r = []
> for f in forums :
>     r.append(Post.objects.filter(topic__forum=f.id)
> return r

That's what I did to work around it. I'd still like to know why it was
so excruciatingly slow.

>
> perhaps try to use the pure sql statement.

I studied the SQL that Django generated and it seemed fine to me.
That's why I wonder if it is a MySQL issue since the EXPLAIN said it
had a possible key (PRIMARY) but then ended up not using it (bottom
one):

http://dpaste.com/524697/

BN

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Slow query on MySQL

2011-03-22 Thread smallfish xy
hi, you can try split the in statement, with less with "in".

forums = [1, 2, 3, 4, 5]
r = []
for f in forums :
r.append(Post.objects.filter(topic__forum=f.id)
return r

perhaps try to use the pure sql statement.
--
blog: http://chenxiaoyu.org



On Wed, Mar 23, 2011 at 8:22 AM, Brian Neal  wrote:

> I apologize in advance as this is probably only tangentially related
> to Django.
>
> I have a forums type Django application. In my RSS feed class I had
> this Django model query:
>
> return Post.objects.filter(topic__forum__id=obj.id).order_by(
>'-creation_date').select_related(depth=2)[:30]
>
> It seemed to work okay, but was slow (2 seconds). I was able to reduce
> the time it took by more carefully extracting only the fields I needed
> with values_list().
>
> But then I changed it to use an "in" operation:
>
> forums = [1, 2, 3, 4, 5]
> return Post.objects.filter(topic__forum__in=forums).order_by(
>'-creation_date').select_related(depth=2)[:30]
>
> This query took over 40 seconds! Again, I can reduce this time using
> values_list and a smaller list of fields, but even then it is 4
> seconds or so.
>
> I did an EXPLAIN on each of the queries, see the link below. The top
> one is the fast one, and the bottom one is the slow one:
>
> http://dpaste.com/524697/
>
> I am not a MySQL expert and I need help interpreting the results. It
> looks like for whatever reason, on the slow one, MySQL identified a
> possible index, but then decided not to use it?
>
> I ended up working around it by doing the work in Python: I looped
> over all the forum ids in the "in" list, making the first query for
> each, and then had to combine and sort the results myself.
>
> I'm using InnoDB if that matters. Did I do something wrong or is this
> a MySQL issue?
>
> Thanks for any insights.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: django tutorial on asus netbook

2011-03-22 Thread Tim Johnson
* Bill Freeman  [110322 16:38]:
> You don't actually need an webserver for a learning scenario, so
> apache, or even lighthttp is unnessary.  Django comes with the
> "development server" built in.  Python itself listens on a port for
> HTTP requests.
> 
> Of somewhat more importance is a database.  You can't do much
> without one.  While you can use a database over the net, letting
> you run somewhere else, you would need connectivity.  I'd suggest
> that you start with SQLite, which ought to be available for you.  If
> I'm not mistaken, more recent Python versions come with it built
> in.  In any even, it's pretty light weight, and the Django docs and
> tutorials all tell you how to set it up (it's actually easier to configure
> than most deployment grade databases).  All the data will be in a
> file that you can save a copy of before trying something new, or
> just delete to start over, without having to know how to get a database
> to drop your tables, etc.
> 
> Python 2.4.4 is a bit long in the tooth.  I'm tempted to suggest
> working with a newer version, but xandros, like most distros,
> probably depends on having its favorite version around, so you
> can't just replace it.  It is possible to have more than one version
> installed, but that will eat into what I'm assuming is flash disk.
> And 2.4.4 will likely work just fine withDjango and most of its
> tutorials.  If you find a piece of code in a tutorial that gives
> unexpected errors, however, remember that folks writing new
> tutorials may choose to use some features that weren't there
> in 2.4.  On the other hand, if you do decide to have a second
> install, DO NOT go all the way to the 3.x version.  Only go as
> far as 2.7.x, and even that has a few quirks (that mostly turn
> to depracation warnings).  I'd really suggest the latest 2.6.x
> if you're going to do it, and either read carefully about using
> 'altinstall' rather than 'install' when you build it (if there is no
> package) or set the prefix so that it gets installed in your home
> directory, where it won't replace the meaning of 'python' for
> your system tools.
  Hi Bill: 
Thanks for taking the time to answer. I've run into more
dependency problems than I am willing to take the time to
resolved on the little feller. I'm thinking that slax might be
worth looking into. I think it might be more appropriate if I
start a separate thread regarding slax. 
However, FYI I've used up less than 20% of the disk space on the
asus.
cheers 
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django tutorial on asus netbook

2011-03-22 Thread Bill Freeman
You don't actually need an webserver for a learning scenario, so
apache, or even lighthttp is unnessary.  Django comes with the
"development server" built in.  Python itself listens on a port for
HTTP requests.

Of somewhat more importance is a database.  You can't do much
without one.  While you can use a database over the net, letting
you run somewhere else, you would need connectivity.  I'd suggest
that you start with SQLite, which ought to be available for you.  If
I'm not mistaken, more recent Python versions come with it built
in.  In any even, it's pretty light weight, and the Django docs and
tutorials all tell you how to set it up (it's actually easier to configure
than most deployment grade databases).  All the data will be in a
file that you can save a copy of before trying something new, or
just delete to start over, without having to know how to get a database
to drop your tables, etc.

Python 2.4.4 is a bit long in the tooth.  I'm tempted to suggest
working with a newer version, but xandros, like most distros,
probably depends on having its favorite version around, so you
can't just replace it.  It is possible to have more than one version
installed, but that will eat into what I'm assuming is flash disk.
And 2.4.4 will likely work just fine withDjango and most of its
tutorials.  If you find a piece of code in a tutorial that gives
unexpected errors, however, remember that folks writing new
tutorials may choose to use some features that weren't there
in 2.4.  On the other hand, if you do decide to have a second
install, DO NOT go all the way to the 3.x version.  Only go as
far as 2.7.x, and even that has a few quirks (that mostly turn
to depracation warnings).  I'd really suggest the latest 2.6.x
if you're going to do it, and either read carefully about using
'altinstall' rather than 'install' when you build it (if there is no
package) or set the prefix so that it gets installed in your home
directory, where it won't replace the meaning of 'python' for
your system tools.

Have fun,
Bill

On Tue, Mar 22, 2011 at 7:53 PM, Tim Johnson  wrote:
> I'm going on vacation with my little Asus EEE Pc 900 with xandros.
> lighttpd is running.  vim (non-gui 'big' version) and kate
> installed. Python version is 2.4.4 is installed.
> Couldn't get apache2 to install at this point.
>
> I've got the book "Django 1.0 Web Site Development". I hope to take
> the book along and work on getting an intro to django in some spare
> time. I am an experienced web programmer, python programmer and
> familiar with linux and the linux shell.
>
> I would welcome comments and advice on whether I can install the
> current versions of django and procede.
>
> thanks
> --
> Tim
> tim at johnsons-web dot com or akwebsoft dot com
> http://www.akwebsoft.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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Another problem with django static files

2011-03-22 Thread Brian Neal
On Mar 22, 6:49 pm, jim_rain  wrote:
> I'm running Django 1.2.5 on a linux (Centos 5.5) server and I'm trying
> to use a datepicker widget written by Aaron Williamson (http://
> copiesofcopies.org/webl/2010/04/26/a-better-datetime-widget-for-
> django/)
>
> I followed all the steps in his write up but when I try to access the
> form with the datepicker on it I don't see anything and the runserver
> outputs: "GET /myApp/jtest/ HTTP/1.1" 200 409
>
> I'm pretty sure this is because Django can't find my media files but I
> can't figure out why. I have added this to my urls.py:
>
>     (r'^site_media/(?P.*)$', 'django.views.static.serve',
>         {'document_root': '/home/jim/work_area/site_base/site_media',
> 'show_indexes': True}),
>
> and when I go tohttp://localhost/site_mediaI see a directory listing
> of all the media directories and files.
>
> In my widget class I have the following inner class:
>
>     class Media:
>         css = {
>             'all' : ("site_media/css/ui-lightness/jquery-
> ui-1.8.11.custom.css", ),
>             }
>         js = (
>             "site_media/js/jqsplitdatetime.js",
>             "site_media/js/jquery-1.5.1.min.js",
>             "site_media/js/jquery-ui-1.8.11.custom.min.js",
>             )
>
> I thought that would do it but apparently not. Can anybody tell me
> what I"m missing?
>
> Thank you.

Did you output {{ form.media }} in your template?

Best,
BN

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Slow query on MySQL

2011-03-22 Thread Brian Neal
I apologize in advance as this is probably only tangentially related
to Django.

I have a forums type Django application. In my RSS feed class I had
this Django model query:

return Post.objects.filter(topic__forum__id=obj.id).order_by(
'-creation_date').select_related(depth=2)[:30]

It seemed to work okay, but was slow (2 seconds). I was able to reduce
the time it took by more carefully extracting only the fields I needed
with values_list().

But then I changed it to use an "in" operation:

forums = [1, 2, 3, 4, 5]
return Post.objects.filter(topic__forum__in=forums).order_by(
'-creation_date').select_related(depth=2)[:30]

This query took over 40 seconds! Again, I can reduce this time using
values_list and a smaller list of fields, but even then it is 4
seconds or so.

I did an EXPLAIN on each of the queries, see the link below. The top
one is the fast one, and the bottom one is the slow one:

http://dpaste.com/524697/

I am not a MySQL expert and I need help interpreting the results. It
looks like for whatever reason, on the slow one, MySQL identified a
possible index, but then decided not to use it?

I ended up working around it by doing the work in Python: I looped
over all the forum ids in the "in" list, making the first query for
each, and then had to combine and sort the results myself.

I'm using InnoDB if that matters. Did I do something wrong or is this
a MySQL issue?

Thanks for any insights.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django tutorial on asus netbook

2011-03-22 Thread Tim Johnson
I'm going on vacation with my little Asus EEE Pc 900 with xandros.
lighttpd is running.  vim (non-gui 'big' version) and kate
installed. Python version is 2.4.4 is installed.
Couldn't get apache2 to install at this point. 

I've got the book "Django 1.0 Web Site Development". I hope to take
the book along and work on getting an intro to django in some spare
time. I am an experienced web programmer, python programmer and
familiar with linux and the linux shell.

I would welcome comments and advice on whether I can install the
current versions of django and procede.

thanks
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Another problem with django static files

2011-03-22 Thread jim_rain
I'm running Django 1.2.5 on a linux (Centos 5.5) server and I'm trying
to use a datepicker widget written by Aaron Williamson (http://
copiesofcopies.org/webl/2010/04/26/a-better-datetime-widget-for-
django/)

I followed all the steps in his write up but when I try to access the
form with the datepicker on it I don't see anything and the runserver
outputs: "GET /myApp/jtest/ HTTP/1.1" 200 409

I'm pretty sure this is because Django can't find my media files but I
can't figure out why. I have added this to my urls.py:

(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/home/jim/work_area/site_base/site_media',
'show_indexes': True}),

and when I go to http://localhost/site_media I see a directory listing
of all the media directories and files.

In my widget class I have the following inner class:

class Media:
css = {
'all' : ("site_media/css/ui-lightness/jquery-
ui-1.8.11.custom.css", ),
}
js = (
"site_media/js/jqsplitdatetime.js",
"site_media/js/jquery-1.5.1.min.js",
"site_media/js/jquery-ui-1.8.11.custom.min.js",
)

I thought that would do it but apparently not. Can anybody tell me
what I"m missing?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Queryset cloning is very expensive

2011-03-22 Thread Malte Engelhardt
Sorry for the late response.

Maybe it's sufficient to override the QuerySet clone method to just return
self, not really clone it.


2011/2/14 myx 

> Thank you for the reply. But I meant a slightly different case:
>
> Item.objects.filter(...).order_by(...).values_list('id', flat=True)[:
> 10]
>
> As you can see, there are four cloning operations. Wouldn't be
> chaining possible without cloning the queryset? The method could just
> return the original queryset. Seems like I'll have to write raw
> queries in such cases :(
>
> On Feb 11, 1:18 pm, kurvenschubser  wrote:
> > Hi myx,
> >
> > cloning is useful for chaining of filters, e.g.
> >
> User.objects.filter(name="Harry").exclude(lastname="Potter").filter(somethi
> ngelse="bla")
> >
> > But most of the time, I found I can construct querysets using a
> > dictionary for collecting the query conditions:
> >
> > d = {name:"Harry", lastname:"Potter", somethingelse:"bla"}
> > User.objects.filter(**d)
> >
> > For more complex queries, e.g.
> >
> > if not d:
> > return
> >
> > q0 = Q(**dict(d.popitem()))
> >
> > for i, (k, v) in enumerate(d.items()):
> > qx = Q(**{k:v})
> > if i % 2:
> > q0 | qx
> > else:
> > q0 & qx
> >
> > User.objects.filter(q0)
> >
> > On 10 Feb., 10:55, myx  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Almost every method of QuerySet clones it. Sometimes it is very
> > > ineficcient, for example when querysets are constructed in loops. I
> > > have a function, which makes about 20 queries, and its execution time
> > > is about 100ms. After profiling the function, I saw that clone() takes
> > > most of the time: 70ms. It is called about 60 times, 1ms per call. The
> > > queries themselves are very fast (about 15ms for all queries). So
> > > constructing the query takes much longer time than executing it.
> > > What cloning is needed for? Can I prevent queryset from cloning, or do
> > > something else to reduce cpu consumption?
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Using success_url with reverse() in class-based generic view

2011-03-22 Thread rb
I just ran into this today and was curious. My setup is this:

class MyGenericView(DeleteView):
success_url = reverse('my-name')

This will produce the from the original author. I got around this by
overriding get_success_url():

class MyGenericView(DeleteView):
def get_success_url(self):
return reverse('my-name')

Is this the preferred/proper way to accomplish this? While looking
around in the tickets I did find this ticket:

http://code.djangoproject.com/ticket/13753

This made me believe that maybe the generic views were using
redirect() (which can accept names), but I tried setting success_url
to 'my-name' and it sends an HttpRedirectResponse with that as the
target. Looking in django.views.generic.edit shows that it is just
calling HttpRedirectResponse. Should these call redirect() instead of
HttpRedirectResponse?

Thanks!

Rob

(django 1.3 rc 1 SVN-15894)

On Feb 18, 5:00 pm, jnns  wrote:
> Hi users,
>
> I have a CreateView which I'd like to redirect to a custom success_url
> defined in my URLconf. As I want to stick to the DRY-principle I just
> did the following:
>
>    success_url = reverse("my-named-url")
>
> Unfortunately, this breaks my site by raising an
> "ImproperlyConfigured: The included urlconf doesn't have any patterns
> in it". Removing success_url and setting the model's
> get_absolute_url() to the following works fine:
>
>    def get_absolute_url(self):
>        return reverse("my-named-url")
>
> I could reproduce this with a brand new project/application so I don't
> think this has something to do with my setup.
>
> Can anyone confirm this issue?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorting in /admin

2011-03-22 Thread Jason Culverhouse

On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote:

> how else would you pull in information from another model into the
> current model list view in admin?
> 
> 
There are some options:
Search for
http://www.google.com/search?q=ModelAdmin+__

You'll find http://code.djangoproject.com/ticket/10743
"Support lookup separators in ModelAdmin.list_display"

If this "bug" were fixed, your problem would be solved

Would search work as an alternative??
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields

search_fields = ['foreign_key__related_fieldname']
i.e.
search_fields = ['user__email']


You can filter on them on the right ( this isn't going to work for names) 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
ModelAdmin.list_filter supports __

Jason


> 
> On Mar 22, 2:41 pm, Siara  wrote:
>> Why are you doing this way ?
>> The better idea is to make it that way:
>> 
>> class YourModelAdmin(admin.ModelAdmin):
>>model = YourModel
>>list_display = [ 'firstName', 'lastName' ]
>> 
>> admin.site.register(YourModel, YourModelAdmin)
>> 
>> and i'm sure then you will be able to sort olums
>> 
>> On 22 Mar, 19:28, Bobby Roberts  wrote:
>> 
>>> I am listing the following fields from the model in /admin as follows:
>> 
>>> [...snip...]
>> 
>>> def Client_Lastname(self, obj):
>>>  return  obj.CustomerId.lastName
>> 
>>> def Client_Firstname(self, obj):
>>>  return  obj.CustomerId.firstName
>> 
>>> list_display = ('Client_Firstname', 'Client_Lastname', )
>> 
>>> [...snip...]
>> 
>>> The Firstname and Lastname fields from the Client model drop right
>>> into the list fine but I cannot sort on these fields when i click the
>>> column header.  What do I need to do to make them sortable?
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: values_list of ordered annotated QuerySet

2011-03-22 Thread Andreas Pfrengle
Thank you, it works! :-)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



suspiciousoperation with file upload on django-cms

2011-03-22 Thread Tony
I am using django-cms for my project right now and I am using their
file and image plugins on my pages, but when I try to upload a file, I
get a suspiciousoperation error.  I have looked at my media_url and
media_root, and played with them but I haven't been able to have any
success.  There is also a django cms media root which I have played
with too.  I have gotten this error on the dev server as well as
apache.  I have set file upload permissions to 0644 as well (which was
recommended by others with similar problems).  All other media files
work properly.  Here is my traceback.


Environment:

Request Method: POST
Request URL: 
http://localhost:8000/admin/cms/page/1/edit-plugin/13/?popup=true&no_preview
Django Version: 1.2.4
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'menus',
 'mptt',
 'appmedia',
 'south',
 'cms.plugins.text',
 'cms.plugins.picture',
 'cms.plugins.link',
 'cms.plugins.file',
 'cms.plugins.snippet',
 'cms.plugins.googlemap',
 'publisher',
 'myproject.polls',
 'social_auth',
 'registration',
 'voting',
 'cms']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'cms.middleware.media.PlaceholderMediaMiddleware')


Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in
get_response
  100. response = callback(request,
*callback_args, **callback_kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
_wrapped_view
  76. response = view_func(request, *args,
**kwargs)
File "C:\Python27\lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func
  78. response = view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\contrib\admin\sites.py" in
inner
  190. return view(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\cms\admin\pageadmin.py" in
edit_plugin
  1239. response = plugin_admin.add_view(request)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
_wrapper
  21. return decorator(bound_func)(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
_wrapped_view
  76. response = view_func(request, *args,
**kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in
bound_func
  17. return func(self, *args2, **kwargs2)
File "C:\Python27\lib\site-packages\django\db\transaction.py" in
_commit_on_success
  299. res = func(*args, **kw)
File "C:\Python27\lib\site-packages\django\contrib\admin\options.py"
in add_view
  821. self.save_model(request, new_object, form,
change=False)
File "C:\Python27\lib\site-packages\cms\plugin_base.py" in save_model
  169. return super(CMSPluginBase, self).save_model(request,
obj, form, change)
File "C:\Python27\lib\site-packages\django\contrib\admin\options.py"
in save_model
  623. obj.save()
File "C:\Python27\lib\site-packages\cms\models\pluginmodel.py" in save
  206. super(CMSPlugin, self).save()
File "C:\Python27\lib\site-packages\django\db\models\base.py" in save
  456. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
File "C:\Python27\lib\site-packages\django\db\models\base.py" in
save_base
  542. for f in meta.local_fields]
File "C:\Python27\lib\site-packages\django\db\models\fields\files.py"
in pre_save
  255. file.save(file.name, file, save=False)
File "C:\Python27\lib\site-packages\django\db\models\fields\files.py"
in save
  92. self.name = self.storage.save(name, content)
File "C:\Python27\lib\site-packages\django\core\files\storage.py" in
save
  47. name = self.get_available_name(name)
File "C:\Python27\lib\site-packages\django\core\files\storage.py" in
get_available_name
  73. while self.exists(name):
File "C:\Python27\lib\site-packages\django\core\files\storage.py" in
exists
  196. return os.path.exists(self.path(name))
File "C:\Python27\lib\site-packages\django\core\files\storage.py" in
path
  212. raise SuspiciousOperation("Attempted access to '%s'
denied." % name)

Exception Type: SuspiciousOperation at /admin/cms/page/1/edit-plugin/
13/
Exception Value: Attempted access to 'C:\Users\Tony\Documents\My Music 
\1\Penguins.jpg' denied.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to

Re: values_list of ordered annotated QuerySet

2011-03-22 Thread Marcos Moyano
This should work without grabbing the entire table:

[x[0] for x in
Wizard.objects.filter(**filterargs).annotate(wpower=Sum('creatures__power')).order_by('-
wpower').values_list('id', 'wpower')]

Rgds,
Marcos

On Tue, Mar 22, 2011 at 5:25 PM, Andreas Pfrengle wrote:

> just pulling it up again...
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Clueless Monk

2011-03-22 Thread Cal Leeming [Simplicity Media Ltd]
Shawn is right, Python *is* awesome ^_^

Soon you will be whispering sweet nothings to your IDE as your code just
gracefully glides along. But then, you will hit a glass window, and fall
swiftly to the ground with all the grace of a blind pigeon, whilst screaming
at your IDE because python/stackless is throwing memory errors or seg
faulting when you try implementing threads.

It's at that point, that these mailing lists become *very* handy :D

On Tue, Mar 22, 2011 at 8:28 PM, Shawn Milochik  wrote:

> A good way to start is to go to the Python Web site, do the tutorial,
> and then graduate to the Python mailing list. Welcome to Python --
> it's awesome!
>
> This list is for Django, so this isn't on-topic for this list.
>
> Tutorial: http://python.org/doc/
>
> Mailing list: http://mail.python.org/mailman/listinfo/python-list
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Clueless Monk

2011-03-22 Thread Cal Leeming [Simplicity Media Ltd]
Probably best place to ask this question is the Python mailing list tbh
(although others here may be willing to help out!).

I myself, learned Python by writing a memory injection exploit for the Eve
Online game, which gave me the ability to inject Python code directly into
the game. I didn't know wtf I was doing at the time lmao, but it sure was
fun ;D

One thing I will give you a heads up on, is the dir() function. If someone
had pointed that out to me to begin with, it would have saved me *a lot* of
time :D

Sorry for the rather random reply!

Cal

On Tue, Mar 22, 2011 at 8:22 PM, Fernando Torres Jr. wrote:

> Hi I was wondering how you start up with Python? Python is a language
> that you use on what platform? Like C++ can be used on Microsoft
> Visual Studios. What is the equivalent for Python. Sorry I am a
> begineer programmer
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Clueless Monk

2011-03-22 Thread Shawn Milochik
A good way to start is to go to the Python Web site, do the tutorial,
and then graduate to the Python mailing list. Welcome to Python --
it's awesome!

This list is for Django, so this isn't on-topic for this list.

Tutorial: http://python.org/doc/

Mailing list: http://mail.python.org/mailman/listinfo/python-list

Shawn

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



Clueless Monk

2011-03-22 Thread Fernando Torres Jr.
Hi I was wondering how you start up with Python? Python is a language
that you use on what platform? Like C++ can be used on Microsoft
Visual Studios. What is the equivalent for Python. Sorry I am a
begineer programmer

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: values_list of ordered annotated QuerySet

2011-03-22 Thread Andreas Pfrengle
just pulling it up again...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorting in /admin

2011-03-22 Thread Bobby Roberts
yeah we want it split into first name and last name.  That part is
working fine... i'm just trying to figure out how to get the column
sortable by clicking on the column header.

On Mar 22, 3:53 pm, Siara  wrote:
> Hmm i dont know but if you dont realy need 2 separate colums for name
> and surname you can define in Customer __unicode__ like that:
>
> def __unicode__(self):
>    return self.lastName + " " + self.firstName
>
> and then in list_diplay = ['CustomerId'],
> but that solution could give ou another problems
>
> On 22 Mar, 20:10, Bobby Roberts  wrote:
>
> > how else would you pull in information from another model into the
> > current model list view in admin?
>
> > On Mar 22, 2:41 pm, Siara  wrote:
>
> > > Why are you doing this way ?
> > > The better idea is to make it that way:
>
> > > class YourModelAdmin(admin.ModelAdmin):
> > >    model = YourModel
> > >    list_display = [ 'firstName', 'lastName' ]
>
> > > admin.site.register(YourModel, YourModelAdmin)
>
> > > and i'm sure then you will be able to sort olums
>
> > > On 22 Mar, 19:28, Bobby Roberts  wrote:
>
> > > > I am listing the following fields from the model in /admin as follows:
>
> > > > [...snip...]
>
> > > > def Client_Lastname(self, obj):
> > > >      return  obj.CustomerId.lastName
>
> > > > def Client_Firstname(self, obj):
> > > >      return  obj.CustomerId.firstName
>
> > > > list_display = ('Client_Firstname', 'Client_Lastname', )
>
> > > > [...snip...]
>
> > > > The Firstname and Lastname fields from the Client model drop right
> > > > into the list fine but I cannot sort on these fields when i click the
> > > > column header.  What do I need to do to make them sortable?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorting in /admin

2011-03-22 Thread Siara
Hmm i dont know but if you dont realy need 2 separate colums for name
and surname you can define in Customer __unicode__ like that:

def __unicode__(self):
   return self.lastName + " " + self.firstName

and then in list_diplay = ['CustomerId'],
but that solution could give ou another problems

On 22 Mar, 20:10, Bobby Roberts  wrote:
> how else would you pull in information from another model into the
> current model list view in admin?
>
> On Mar 22, 2:41 pm, Siara  wrote:
>
>
>
> > Why are you doing this way ?
> > The better idea is to make it that way:
>
> > class YourModelAdmin(admin.ModelAdmin):
> >    model = YourModel
> >    list_display = [ 'firstName', 'lastName' ]
>
> > admin.site.register(YourModel, YourModelAdmin)
>
> > and i'm sure then you will be able to sort olums
>
> > On 22 Mar, 19:28, Bobby Roberts  wrote:
>
> > > I am listing the following fields from the model in /admin as follows:
>
> > > [...snip...]
>
> > > def Client_Lastname(self, obj):
> > >      return  obj.CustomerId.lastName
>
> > > def Client_Firstname(self, obj):
> > >      return  obj.CustomerId.firstName
>
> > > list_display = ('Client_Firstname', 'Client_Lastname', )
>
> > > [...snip...]
>
> > > The Firstname and Lastname fields from the Client model drop right
> > > into the list fine but I cannot sort on these fields when i click the
> > > column header.  What do I need to do to make them sortable?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorting in /admin

2011-03-22 Thread Bobby Roberts
how else would you pull in information from another model into the
current model list view in admin?



On Mar 22, 2:41 pm, Siara  wrote:
> Why are you doing this way ?
> The better idea is to make it that way:
>
> class YourModelAdmin(admin.ModelAdmin):
>    model = YourModel
>    list_display = [ 'firstName', 'lastName' ]
>
> admin.site.register(YourModel, YourModelAdmin)
>
> and i'm sure then you will be able to sort olums
>
> On 22 Mar, 19:28, Bobby Roberts  wrote:
>
> > I am listing the following fields from the model in /admin as follows:
>
> > [...snip...]
>
> > def Client_Lastname(self, obj):
> >      return  obj.CustomerId.lastName
>
> > def Client_Firstname(self, obj):
> >      return  obj.CustomerId.firstName
>
> > list_display = ('Client_Firstname', 'Client_Lastname', )
>
> > [...snip...]
>
> > The Firstname and Lastname fields from the Client model drop right
> > into the list fine but I cannot sort on these fields when i click the
> > column header.  What do I need to do to make them sortable?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorting in /admin

2011-03-22 Thread Siara
Why are you doing this way ?
The better idea is to make it that way:

class YourModelAdmin(admin.ModelAdmin):
   model = YourModel
   list_display = [ 'firstName', 'lastName' ]

admin.site.register(YourModel, YourModelAdmin)

and i'm sure then you will be able to sort olums

On 22 Mar, 19:28, Bobby Roberts  wrote:
> I am listing the following fields from the model in /admin as follows:
>
> [...snip...]
>
> def Client_Lastname(self, obj):
>      return  obj.CustomerId.lastName
>
> def Client_Firstname(self, obj):
>      return  obj.CustomerId.firstName
>
> list_display = ('Client_Firstname', 'Client_Lastname', )
>
> [...snip...]
>
> The Firstname and Lastname fields from the Client model drop right
> into the list fine but I cannot sort on these fields when i click the
> column header.  What do I need to do to make them sortable?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Postgresql transaction error

2011-03-22 Thread cootetom
Thanks for the replies. Looking in the log files got me back on track.
There was a SQL query running against the database that would never
work due to the table to existing. Now i know where to look next time!


On Mar 22, 5:42 pm, Jason Culverhouse  wrote:
> On Mar 22, 2011, at 10:03 AM, cootetom wrote:
>
> > I'm using the psycopg2 python library and have tried postgresql 8 and
> > now 9.
>
> > The error, in brief, is:
>
> > "
> > Template error
> > In template c:\python26\lib\site-packages\django\contrib\admin
> > \templates\admin\base.html, error at line 58
> > Caught DatabaseError while rendering: current transaction is aborted,
> > commands ignored until end of transaction block
>
> Look in the postgres log file, by default it should log the first error and 
> the subsequent errors
>
> If not, you can add:
>         log_statement = 'all'
> to your postgresql.conf and see every statement...
>
> Jason

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



Unicode string writed on boolean field in model

2011-03-22 Thread Siara
Hi i think that i found 'funny' thing during writing my app.
I have app which returns JSON with data for second app. Interesting
part of my JSON looks like that:

"availability_internet" : "True",
"availability_phone" : "False",

In seconds app models.py i have lines like that:

availability_internet = models.BooleanField(verbose_name = 'Dostępność
przez internet', default=False)
availability_phone = models.BooleanField(verbose_name = 'Dostępność
przez telefon', default=False)

In second app i have script to fetch data from first app and to save
them in database, i'm doing it like that:

model_instance = model(**kwargs)
model_instance.save()

where kwargs is dictionary obtained through JSON.

And now goes the 'funny' thing, during debugging my app i found that
after i save model_instance it has fields like that:

availability_internet - unicode: True
availability_phone -  unicode: False

and that was looking in app admin panel like both fields are set to
True.

I found a way to fix it, but in my opinion i should get error during
model_instance.save().
And there is a question did anyone have similar problem, or could
confirm that this is realy is bug ?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



sorting in /admin

2011-03-22 Thread Bobby Roberts
I am listing the following fields from the model in /admin as follows:

[...snip...]

def Client_Lastname(self, obj):
 return  obj.CustomerId.lastName

def Client_Firstname(self, obj):
 return  obj.CustomerId.firstName

list_display = ('Client_Firstname', 'Client_Lastname', )

[...snip...]


The Firstname and Lastname fields from the Client model drop right
into the list fine but I cannot sort on these fields when i click the
column header.  What do I need to do to make them sortable?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem using ManyToMany Field in admin

2011-03-22 Thread pankaj sharma
Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/admin/college/college/3/

Django Version: 1.3 rc 1
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'college']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
options.py" in wrapper
  307. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  93. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  79. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
sites.py" in inner
  197. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapper
  28. return bound_func(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  93. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in bound_func
  24. return func(self, *args2, **kwargs2)
File "/usr/local/lib/python2.6/dist-packages/django/db/transaction.py"
in inner
  217. res = func(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
options.py" in change_view
  992. form = ModelForm(instance=obj)
File "/usr/local/lib/python2.6/dist-packages/django/forms/models.py"
in __init__
  238. object_data = model_to_dict(instance, opts.fields,
opts.exclude)
File "/usr/local/lib/python2.6/dist-packages/django/forms/models.py"
in model_to_dict
  128. data[f.name] = [obj.pk for obj in
f.value_from_object(instance)]
File "/usr/local/lib/python2.6/dist-packages/django/db/models/
query.py" in _result_iter
  107. self._fill_cache()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/
query.py" in _fill_cache
  772.
self._result_cache.append(self._iter.next())
File "/usr/local/lib/python2.6/dist-packages/django/db/models/
query.py" in iterator
  273. for row in compiler.results_iter():
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/
compiler.py" in results_iter
  680. for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/
compiler.py" in execute_sql
  735. cursor.execute(sql, params)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
util.py" in execute
  34. return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/mysql/
base.py" in execute
  86. return self.cursor.execute(query, args)
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py" in execute
  166. self.errorhandler(self, exc, value)
File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py" in
defaulterrorhandler
  35. raise errorclass, errorvalue

Exception Type: DatabaseError at /admin/college/college/3/
Exception Value: (1146, "Table 'ednect.college_college_branches'
doesn't exist")

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem with paths

2011-03-22 Thread Mishen'ka
Hi everyone,

I have a strange problem. On my home server, everything works.
I have a Ubuntu server with all things installed what i needed.
Now i want to emigrate all things to a live configuration

situation:

path of project:
/home/django/profile/settings.py

because i use Plesk on OpenSuse i needed to make a fastcgi file.
Mod_python doesnt work on some way.

so i have created a file like mysite.fcgi:


#!/usr/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home/django")
sys.path.append('/home/django/profile')

#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)

# Switch to the directory of your project. (Optional.)
os.chdir("/srv/www/vhosts/test.com/httpdocs")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "profile.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")


Now i have make all files redirecting to the mysite.fcgi.

But it doesnt work.
If i go to test.com i get the follow message:

---
Page not found (404)
Request Method: GET
Request URL:http://www.test.com/srv/www/
vhosts/test.com/httpdocs/
---

The rewrite :
---



Options MultiViews FollowSymLinks +Includes +ExecCGI
AllowOverride All
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{PATH_INFO} !-f
RewriteBase /
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]


---

I have changed my domain trough test.com because it isn't relevant

Can someone find the solution?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Implementing a ldap db backend

2011-03-22 Thread Sells, Fred
I'm using my own auth and ldap via python-ldap as a query only; others maintain 
it.  My only issue is that of response.  I query all the groups I care about 
and get all their members and keep that in a MySQL db that I refresh every 5 
minutes of an unrelated cron job.

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Felipe Prenholato
Sent: Tuesday, March 22, 2011 9:19 AM
To: django-users@googlegroups.com
Subject: Re: Implementing a ldap db backend

 

I have read and tested some more libs.

 

My concern is that:

 

django-ldapdb (http://opensource.bolloretelecom.eu/projects/django-ldapdb/): 
amazing idea, I'm working very well to query users, having some issues to write 
on LDAP but is more probably due server stuff and not django-ldapdb itself. 
Probably django-ldapdb is a good start for a backend, but doesn't have much 
documentation, mostly examples only.

 

django-auth-ldap (doc at http://packages.python.org/django-auth-ldap/, source 
at https://bitbucket.org/psagers/django-auth-ldap): testing now, the docs show 
that it's amazing with all backend and update of users working very well at 
user login. This kind of functionality is required for me.

 

Since ldapdb can search, update and add users as I see in code we just need to 
do some work on lookups and doc, because istartswith as example doesn't works, 
but it is not much trouble I guess. At other side ldapdb lacks a authentication 
backend that can update user data at login and is easy to update django tables 
like auth-ldap does (see documentation). I'll use both for now because my time 
about it is very small but in future I'm ready to join on efforts to merge both 
apps and construct a full ldap backend / ldap orm for django.

 

 


Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc




2011/3/21 David De La Harpe Golden 

On 03/11/10 07:48, sebastien piquemal wrote:

> I have thought of many solutions to replace ldapdb. I came to
> conclusion than the cleanest, and most useful for the community, would
> be to implement a real db backend for ldap. However, I have been told
> that it is an awfully big task !
>

It would be big...

BTW "pumpkin" is another project that attempts an ORM-like (let's say
ODM) interface.  It's not django integrated, i.e. it's not a ldap-nonrel
backend for the Django ORM, it's a separate Somewhat-Django-ORM-like
ODM.  http://pypi.python.org/pypi/pumpkin/0.1.0

I'd also recommend taking a close look at ldap.schema.models in
python-ldap source itself - it's "half an ODM" in itself, though it
can't save and still doesn't really datatype-map (python-ldap is a thin
layer on top of libldap and returns strings e.g. you get a "FALSE" back
not a python False. Yeargh), it does introspect the schema and handle
some horrible little details of attribute lookup for you.

We also grew something of an ODM for in-house use, sitting on top of
python-ldap, doing a little mapping of datatypes (only just enough for
our needs), allowing saving.  It's unreleased at time of writing and,
um, what happens to it later won't be up to me.  Pumpkin is probably
better anyway.  Our Django ORM integration, such as it is, is by "fake"
surrogate django models in RDBMS.  So again not a /backend/ for the
django ORM - Instead we (ab)use entryUUID and syncrepl entryCSN ldap
operational attributes to keep some almost featureless "LDAPEntry" model
instances in the RDBMS roughly in-sync via polling*.  This allowed
signals to fire etc so a django/celery based system can be somewhat
reactive to directory changes both inside and  outside its control.  But
our ldap directory is and will remain fairly small (thousands to tens of
thousands of entries) having an RDBMS row for every entry in ldap works
out okay, you wouldn't want to do it that way with a giant directory.

(* We toyed with the idea of making a full-blown syncrepl client on top
of python-ldap for something lighter weight than polling, but that's not
a small job either.  And there's some support in openldap for having
/slapd backend to RDBMS/, i.e. swap the problem around, but it's limited
and really only suited for specific setups...)

P.S. ldaptor also exists and is a pure-python lowlevel ldap interface
(unlike python-ldap which is on top of openldap libldap, so fully
bug-compatible with libldap)


--
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 
django-users+unsubscr...@googlegroups.com 
 .
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe f

Re: Postgresql transaction error

2011-03-22 Thread Simon Riggs
On Tue, Mar 22, 2011 at 5:03 PM, cootetom  wrote:

> Hi, I've been trying to use Postgresql because I'm thinking of using
> that instead of MySQL due to it's ability to role back transactions
> making it easier to use South. However I've hit a wall with it and
> can't seem to fix it.
>
> I'm using the psycopg2 python library and have tried postgresql 8 and
> now 9.
>
> The error, in brief, is:
>
> "
> Template error
> In template c:\python26\lib\site-packages\django\contrib\admin
> \templates\admin\base.html, error at line 58
> Caught DatabaseError while rendering: current transaction is aborted,
> commands ignored until end of transaction block
> "
>
> By searching Google for this error I have found loads of discussion on
> it but nothing that I have been able to apply in order to fix my
> scenario. I'm getting this error when visiting the Django admin site
> which is probably adding to my confusion because it's code that I'm
> not able to debug.
>
> Has anyone else got any information on this error, or better, a
> solution?

If your transaction throws an error then you must explicitly rollback
the transaction before you continue.

This is a requirement of the SQL standard, not just a PostgreSQL
issue. I can see it would be fairly hard to Google an answer for.

I would guess you started a transaction and then didn't check for
success on an earlier database action before continuing to issue
commands.

This is all normal and good.

-- 
 Simon Riggs   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Django on Windows 7

2011-03-22 Thread Sells, Fred
It's painless.  I'm no sysadmin but I just followed the instructions and
everything worked.  I'm even using python 2.4 due to some outside
issues.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Vladimir
Sent: Tuesday, March 22, 2011 1:08 PM
To: Django users
Subject: Re: Django on Windows 7

I'm a beginner and haven't enough time to test, but I must answer You
I use Django on Windows 7

-- 
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


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



RE: Django on EC2

2011-03-22 Thread Sells, Fred
I'm using a redhat enterprise 6 and all these are standard or available
as standard installs.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Eric Chamberlain
Sent: Tuesday, March 22, 2011 12:31 PM
To: django-users@googlegroups.com
Subject: Re: Django on EC2


On Mar 20, 2011, at 2:21 PM, ydjango wrote:

> I need to install a nginx(optional), Linux,  Apache, Django 1.2,
> python2.6 env and Mysql  on EC2 and ESB.
> 
> Can you please point to any recent instructions on how to install on
> amazon 2 and which images to use?
> 
> How has your experience been so far?
> 

We use the Amazon Linux AMI for our web/app servers and Amazon RDS for
our database.

--
Eric Chamberlain, Founder
RF.com - http://RF.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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


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



Where to put generic Database Tables?

2011-03-22 Thread Andre Lopes
Hi,

I'm trying to start with Django.

I'm developing an App. This App is called "Directory" and will store
info about websites.

I must to create a database table called "Genders", but this is a
generic database table and could be used in other App.

My question... how to deal with this kind of situation in Django? And
in wich model I shuld put this database table?


Best Regards,

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



Re: Postgresql transaction error

2011-03-22 Thread Jason Culverhouse
On Mar 22, 2011, at 10:03 AM, cootetom wrote:
> I'm using the psycopg2 python library and have tried postgresql 8 and
> now 9.
> 
> The error, in brief, is:
> 
> "
> Template error
> In template c:\python26\lib\site-packages\django\contrib\admin
> \templates\admin\base.html, error at line 58
> Caught DatabaseError while rendering: current transaction is aborted,
> commands ignored until end of transaction block


Look in the postgres log file, by default it should log the first error and the 
subsequent errors

If not, you can add:
log_statement = 'all'
to your postgresql.conf and see every statement...

Jason

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



Re: Postgresql transaction error

2011-03-22 Thread Shawn Milochik
pdb:

www.doughellmann.com/PyMOTW/pdb/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Postgresql transaction error

2011-03-22 Thread Shawn Milochik
The cause is that there's a problem with a line of code that interacts
with the database, leaving the database connection dirty and unusable.

The error occurs not at that line of code, but at the next line of
code which tries to use the database connection.

The solution is to use pdb and/or logging to figure out where the
problem is and fix it. It's probably easier to just step through with
pdb. If you want help with that we can meet up in the #django IRC.

Shawn

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



Re: Django on Windows 7

2011-03-22 Thread Vladimir
I'm a beginner and haven't enough time to test, but I must answer You
I use Django on Windows 7

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Postgresql transaction error

2011-03-22 Thread cootetom
Hi, I've been trying to use Postgresql because I'm thinking of using
that instead of MySQL due to it's ability to role back transactions
making it easier to use South. However I've hit a wall with it and
can't seem to fix it.

I'm using the psycopg2 python library and have tried postgresql 8 and
now 9.

The error, in brief, is:

"
Template error
In template c:\python26\lib\site-packages\django\contrib\admin
\templates\admin\base.html, error at line 58
Caught DatabaseError while rendering: current transaction is aborted,
commands ignored until end of transaction block
"

By searching Google for this error I have found loads of discussion on
it but nothing that I have been able to apply in order to fix my
scenario. I'm getting this error when visiting the Django admin site
which is probably adding to my confusion because it's code that I'm
not able to debug.

Has anyone else got any information on this error, or better, a
solution?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: installing docutils on Dreamhost

2011-03-22 Thread Jason Haury
Here's my short how-to on getting docultils working on Dreamhost where 
Passenger is used to wrap Django.  At the time of writing, this is the way 
DreamHost recommends one use Python code with web development.  

Using j...@skappber.com's tips below, one can successfully install docutils. 
 Just as others have to communicate this installation path to FastCGI, etc, 
a Passenger user needs to edit their passenger_wsgi.py file.  What I did was 
find the line that says: "sys.path.append(os.getcwd())" then add a line 
right after it that looks something 
like sys.path.append('/home/MY_USER/lib/python2.5/site-packages/').


Substitute MY_USER with the correct user name, and also be aware of what 
python version is actually being run.  Currently, it's 2.5.  In 
the instructions above, it was 2.3.   Change the path accordingly.

Enjoy!
Jason

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



Re: django 1.3

2011-03-22 Thread Shawn Milochik
It was claimed this morning that the release will be today.

https://groups.google.com/forum/#!topic/django-developers/Bh33bkwnEZU

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.3

2011-03-22 Thread Casey Greene
While the tone of the e-mail isn't really appropriate, I think the 
question is a good one.  The most recent update 
(http://www.djangoproject.com/weblog/2011/mar/03/13-rc/) was from March 
3rd and said that "Barring major issues discovered with this package, 
the final Django 1.3 release will follow a little over a week from now," 
but now it is 19 days later and there has not been a more recent update. 
 Does this mean that major issues were discovered in the RC?


Even a quick note in the weblog about the revised date would be helpful. 
 The earlier updates about the February release of 1.3 getting pushed 
back were helpful in this way.


Casey

On 03/22/2011 12:09 PM, Ovnicraft wrote:



On Tue, Mar 22, 2011 at 10:43 AM, django_user :)
mailto:srb-stefan...@hotmail.de>> wrote:

hey,
can someone tell me when the final version of django 1.3 appears???
i need it immediately!
thank you


Hello you can read about here:
http://www.djangoproject.com/weblog/2011/feb/16/django-1_3-release-schedule-update-4/
So if you can wait more you can get the code from repository (you will
find the access in django site.)  and test the RC and update asap
following the django policy for this.

Regards,

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




--
Cristian Salamea
@ovnicraft

--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


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



Re: what is mean by an integer is required?

2011-03-22 Thread NavaTux
I think the problem is in "Datetime field" format
test_start_date
please could you make it sure?plz


On Mar 22, 9:23 pm, NavaTux  wrote:
> Here just i had written django script to calculate in my data
>
> MarketUpdate in my django model
> Here i am passing two custom fields 'ticker' and 'test_start_date'(datetime
> format)
> this script is finely working while executing in django shell
> It displays error after calling as a method "stock_up()"
>
> from optionsAlpha.models import MarketUpdate
>
> from datetime import datetime
>
> from django.db.models import Q
>
> def stock_up(ticker, test_start_date):
>
> #stock_value=0
>
> mu1 = MarketUpdate.objects.filter(Q(stock_symbol=ticker) &
> Q(update_timestamp__gt=datetime(test_start_date))).order_by('stock_value')
>
> #print mu1[0].stock_value
>
> max_stock=mu1[0].stock_value
>
> count=0
>
> for i in mu1:
>
>      if i.stock_value >= max_stock:
>
>          max_stock = i.stock_value
>
>          count+=1
>
>         return count
>
> Output when calling this method from django shell:
>
> >>> dat
>
> datetime.datetime(2011, 3, 19, 8, 58, 28, 999615)
>
> >>> ticker
>
> 'GOOG'
>
> >>> stock_up(ticker,dat)
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
>   File "/home/hirelex/optionsalpha/optionsAlpha/trade_count.py", line 6, in
> stock_up
>
>     mu1 = MarketUpdate.objects.filter(Q(stock_symbol=ticker) &
> Q(update_timestamp__gt=datetime(test_start_date))).order_by('stock_value')
>
> TypeError: an integer is required
>
>
>
> Here Stock_value is another field (float) in my model. just i need to order
> it
> what is the meaning of this error? How to resolve it? could you suggest it

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on EC2

2011-03-22 Thread Eric Chamberlain

On Mar 20, 2011, at 2:21 PM, ydjango wrote:

> I need to install a nginx(optional), Linux,  Apache, Django 1.2,
> python2.6 env and Mysql  on EC2 and ESB.
> 
> Can you please point to any recent instructions on how to install on
> amazon 2 and which images to use?
> 
> How has your experience been so far?
> 

We use the Amazon Linux AMI for our web/app servers and Amazon RDS for our 
database.

--
Eric Chamberlain, Founder
RF.com - http://RF.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



what is mean by an integer is required?

2011-03-22 Thread NavaTux
Here just i had written django script to calculate in my data

MarketUpdate in my django model
Here i am passing two custom fields 'ticker' and 'test_start_date'(datetime 
format)
this script is finely working while executing in django shell
It displays error after calling as a method "stock_up()"

from optionsAlpha.models import MarketUpdate

from datetime import datetime

from django.db.models import Q

def stock_up(ticker, test_start_date):

#stock_value=0

mu1 = MarketUpdate.objects.filter(Q(stock_symbol=ticker) & 
Q(update_timestamp__gt=datetime(test_start_date))).order_by('stock_value')

#print mu1[0].stock_value

max_stock=mu1[0].stock_value

count=0

for i in mu1:

 if i.stock_value >= max_stock:

 max_stock = i.stock_value

 count+=1

return count


Output when calling this method from django shell:

>>> dat

datetime.datetime(2011, 3, 19, 8, 58, 28, 999615)

>>> ticker

'GOOG'

>>> stock_up(ticker,dat)

Traceback (most recent call last):

  File "", line 1, in 

  File "/home/hirelex/optionsalpha/optionsAlpha/trade_count.py", line 6, in 
stock_up

mu1 = MarketUpdate.objects.filter(Q(stock_symbol=ticker) & 
Q(update_timestamp__gt=datetime(test_start_date))).order_by('stock_value')

TypeError: an integer is required

>>> 

Here Stock_value is another field (float) in my model. just i need to order 
it
what is the meaning of this error? How to resolve it? could you suggest it 

 

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.3

2011-03-22 Thread Ovnicraft
On Tue, Mar 22, 2011 at 10:43 AM, django_user :)
wrote:

> hey,
> can someone tell me when the final version of django 1.3 appears???
> i need it immediately!
> thank you
>
>
Hello you can read about here:
http://www.djangoproject.com/weblog/2011/feb/16/django-1_3-release-schedule-update-4/
So if you can wait more you can get the code from repository (you will find
the access in django site.)  and test the RC and update asap following the
django policy for this.

Regards,

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


-- 
Cristian Salamea
@ovnicraft

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django 1.3

2011-03-22 Thread django_user :)
hey,
can someone tell me when the final version of django 1.3 appears???
i need it immediately!
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Some clues on multi language webapp on Django

2011-03-22 Thread Daniel Hilton
On 22 March 2011 14:18, Andre Lopes  wrote:
> Hi,
>
> I'm new to Django. I need some clues on how to design a multi language
> webapp on Django. There are some some examples, tips and tricks about
> the best way of doing it?
>
> PS: Sorry for my english.

Have a look at django-localeurl and django-mothertongue as well.
Cheers,
Dan



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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Some clues on multi language webapp on Django

2011-03-22 Thread Julien Castets
take a loop to internationalization and localization :
http://docs.djangoproject.com/en/dev/topics/i18n/?from=olddocs

On Tue, Mar 22, 2011 at 3:18 PM, Andre Lopes  wrote:
> Hi,
>
> I'm new to Django. I need some clues on how to design a multi language
> webapp on Django. There are some some examples, tips and tricks about
> the best way of doing it?
>
> PS: Sorry for my english.
>
> Best Regards,
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Julien Castets
+33 (0)6.85.20.10.03

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Developer wanted

2011-03-22 Thread shmengie
Jacksonville Florida based development teem seeks a, contract
developer.

Requirements: django, postgresql, jquery

The software is an Electronic Health Record.  ePrescription
integration experience a plus.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Some clues on multi language webapp on Django

2011-03-22 Thread Andre Lopes
Hi,

I'm new to Django. I need some clues on how to design a multi language
webapp on Django. There are some some examples, tips and tricks about
the best way of doing it?

PS: Sorry for my english.

Best Regards,

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



Re: Parse template variables in custom tag

2011-03-22 Thread Turner
I think I've solved the issue. Rather than create a Variable object, I
called parser.compile_filters(value) in the parsing function for my
tag. That seems to have done the trick, and seems to internally
resolve with a Variable object all the same.



On Mar 21, 9:05 pm, Turner  wrote:
> On Mar 20, 11:15 pm, Daniel Roseman  wrote:
>
> > On Sunday, March 20, 2011 9:57:04 PM UTC, Turner wrote:
>
> > > I'm working on a custom tag to which I would like to be able to pass
> > > template variables and filters. I found
> > > Variable(value).resolve(context) in the Django source. I
> > > have a couple of questions:
>
> > > You don't need to look at the code, this is explicitly documented:
>
> >http://docs.djangoproject.com/en/1.2/howto/custom-template-tags/#pass...
>
> Ah, I somehow missed that in my searching.
>
>
>
> > > 1) Is it safe to use Variable()? That is, is it part of
> > > the public API? Not having visibility modifiers makes it a bit
> > > difficult to tell.
>
> > Yes, since it is documented.
>
> > > 2) Variable.resolve() works fine for, well, resolving a variable, but
> > > doesn't work with filters. That is, if I pass to my tag
> > > some.context.variable|some_filter, the tag will throw up
> > > on the last bit, saying that it can't find an attribute/key/method
> > > called  "variable|some_filter". Is there an easy way I can have my tag
> > > apply any filters to the value passed in?
>
> > AFAIK that should just work. The `with` tag, for example, works fine with
> > arguments that include filters.
>
> Here's the exception I get when I try a variable with filters:
>
> Caught VariableDoesNotExist while rendering: Failed lookup for key
> [path|split_path]
>
> It's raised on the following template call:
>
> {% my_tag list=form.instance.path|split_path %}
>
> (split_path is, obviously, a custom filter)
>
> In the code for my tag I have the following
>
> Variable(value).resolve(context)
>
> (where value is "form.instance.path|split_path")
>
> I'm using Django version 1.3 alpha 1, if that makes a difference.> --
> > DR.

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



Re: DatabaseError: ORA-03127: no new operations allowed until the active operation ends

2011-03-22 Thread Ian
On Mar 22, 5:38 am, Paolo Corti  wrote:

> I have solved this by downgrading the cx_Oracle library from 5.1 to
> 5.0.1
> I am using Oracle 11.2
> Now works well both on Django 1.2.5 and 1.3 RC with Python 2.6
> best regards
> P

Thanks for letting us know.  I haven't yet tried cx_Oracle 5.1 myself,
so I suppose I'll have to install it and see if this reproduces.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on Windows 7

2011-03-22 Thread shofty
The installation isn't that tricky. what you will struggle with is
when your project starts to become complex in terms of package
requirements.

i spent a day trying to get PIL installed on windows and in the end
ran out of patience. spent the next day building a hackintosh and
haven't looked back.

this was a year ago, so i hope for your sake things have changed. good
luck.

Matt

On Mar 22, 12:59 pm, David Kovar  wrote:
> Good evening,
>
> I need to install Django on Windows 7 due to other requirements for our 
> system. I've found documentation showing how to do this, but I don't have a 
> sense of how hard this is, how stable it will be, and what the associated 
> issues might be. If someone can help enlighten me, I'd appreciate it.
>
> Thank you.
>
> -David

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Logging visitors/requests and showing it all in a nice report?

2011-03-22 Thread Tomasz Zieliński
On 21 Mar, 14:21, Thomas Weholt  wrote:
> Is there an app for logging visitors with a nice report, like a report
> showing number of visitors for a specific page, users with a specific
> browser/OS etc?
>

I know you want a Djangoish solution, but there is a nice small
Apache log analyzer http://www.hping.org/visitors/ which output
might fit your purposes.

--
Tomasz Zielinski
pyconsultant.eu

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on Windows 7

2011-03-22 Thread delegbede
I am not sure there would be major issues except that you need to install 
binary versions of your database drivers. 

Regards. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: David Kovar 
Sender: django-users@googlegroups.com
Date: Tue, 22 Mar 2011 07:59:45 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Django on Windows 7

Good evening,

I need to install Django on Windows 7 due to other requirements for our system. 
I've found documentation showing how to do this, but I don't have a sense of 
how hard this is, how stable it will be, and what the associated issues might 
be. If someone can help enlighten me, I'd appreciate it.

Thank you.

-David

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

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



Re: Localization of CharField entries

2011-03-22 Thread Stuart MacKay
The sync_transmeta_db command will set only the field for the language 
you select when it performs the schema conversion. The others will be 
null so you probably want to add some default content e.g. Needs 
Translation" or simply update all the other fields with the value you 
already have.


Regards,

Stuart

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django on Windows 7

2011-03-22 Thread David Kovar
Good evening,

I need to install Django on Windows 7 due to other requirements for our system. 
I've found documentation showing how to do this, but I don't have a sense of 
how hard this is, how stable it will be, and what the associated issues might 
be. If someone can help enlighten me, I'd appreciate it.

Thank you.

-David

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How make CSRF middleware emit html4 rather than xhtml1.0 (closing tags issue) so will validate?

2011-03-22 Thread Andre Terra
Hello, Chris

Your forms are "always" going to be created using Form classes, but you can
still customize the template, unless you use {{ form.as_p }} or other
similar methods. These methods are built-in for the sake of simplicity and
writing fast code, but you'll see that most of everything that is built-in
to django (generic views, the admin, form rendering, etc.) are only good in
the short term or for applications with a very small number of users.
Usually the case is that you will use these tools until you reach a point
where you need to do things on your own, and that's when things really get
interesting!

Please see
http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-templatefor
information on how to work with forms on your templates. Also consider
carljm's django-form-utils (my personal favorite) and pydanny's
django-uniforms as third-party apps that will most definitely make your life
easier.


Sincerely,
André Terra

On Tue, Mar 22, 2011 at 12:11 AM, Chris Seberino wrote:

>
> Ian
>
> Thanks for the reply.  Your solution makes perfect sense.  My forms
> are
> automatically generated by Django via Form classes.  So I can't
> embed this suggested input element in any form element present in my
> template.
> Where should I put this code in since there is no form element?
>
> cs
>
> >
> > 
> >  value='{{csrf_token }}' >
> > 
> >
> > (Note the '{{', '}}' delimiters, rather than '{%', '%}')
> >
> > A more complicated, but more reusable way to do it would be to write
> > your own template tag (it's really simple, you can use the CSRF-token
> > code indjango/template/defaulttags.py as a starting point) which
> > would render whatever markup you need.
> >
> > --
> > Regards,
> > Ian Clelland
> > 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Implementing a ldap db backend

2011-03-22 Thread Felipe Prenholato
I have read and tested some more libs.

My concern is that:

django-ldapdb (http://opensource.bolloretelecom.eu/projects/django-ldapdb/):
amazing idea, I'm working very well to query users, having some issues to
write on LDAP but is more probably due server stuff and not django-ldapdb
itself. Probably django-ldapdb is a good start for a backend, but doesn't
have much documentation, mostly examples only.

django-auth-ldap (doc at http://packages.python.org/django-auth-ldap/,
source at https://bitbucket.org/psagers/django-auth-ldap): testing now, the
docs show that it's amazing with all backend and update of users working
very well at user login. This kind of functionality is required for me.

Since ldapdb can search, update and add users as I see in code we just need
to do some work on lookups and doc, because istartswith as example doesn't
works, but it is not much trouble I guess. At other side ldapdb lacks a
authentication backend that can update user data at login and is easy to
update django tables like auth-ldap does (see documentation). I'll use both
for now because my time about it is very small but in future I'm ready to
join on efforts to merge both apps and construct a full ldap backend / ldap
orm for django.



Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://chronosbox.org/blog
Twitter: http://twitter.com/chronossc



2011/3/21 David De La Harpe Golden 

> On 03/11/10 07:48, sebastien piquemal wrote:
>
> > I have thought of many solutions to replace ldapdb. I came to
> > conclusion than the cleanest, and most useful for the community, would
> > be to implement a real db backend for ldap. However, I have been told
> > that it is an awfully big task !
> >
>
> It would be big...
>
> BTW "pumpkin" is another project that attempts an ORM-like (let's say
> ODM) interface.  It's not django integrated, i.e. it's not a ldap-nonrel
> backend for the Django ORM, it's a separate Somewhat-Django-ORM-like
> ODM.  http://pypi.python.org/pypi/pumpkin/0.1.0
>
> I'd also recommend taking a close look at ldap.schema.models in
> python-ldap source itself - it's "half an ODM" in itself, though it
> can't save and still doesn't really datatype-map (python-ldap is a thin
> layer on top of libldap and returns strings e.g. you get a "FALSE" back
> not a python False. Yeargh), it does introspect the schema and handle
> some horrible little details of attribute lookup for you.
>
> We also grew something of an ODM for in-house use, sitting on top of
> python-ldap, doing a little mapping of datatypes (only just enough for
> our needs), allowing saving.  It's unreleased at time of writing and,
> um, what happens to it later won't be up to me.  Pumpkin is probably
> better anyway.  Our Django ORM integration, such as it is, is by "fake"
> surrogate django models in RDBMS.  So again not a /backend/ for the
> django ORM - Instead we (ab)use entryUUID and syncrepl entryCSN ldap
> operational attributes to keep some almost featureless "LDAPEntry" model
> instances in the RDBMS roughly in-sync via polling*.  This allowed
> signals to fire etc so a django/celery based system can be somewhat
> reactive to directory changes both inside and  outside its control.  But
> our ldap directory is and will remain fairly small (thousands to tens of
> thousands of entries) having an RDBMS row for every entry in ldap works
> out okay, you wouldn't want to do it that way with a giant directory.
>
> (* We toyed with the idea of making a full-blown syncrepl client on top
> of python-ldap for something lighter weight than polling, but that's not
> a small job either.  And there's some support in openldap for having
> /slapd backend to RDBMS/, i.e. swap the problem around, but it's limited
> and really only suited for specific setups...)
>
> P.S. ldaptor also exists and is a pure-python lowlevel ldap interface
> (unlike python-ldap which is on top of openldap libldap, so fully
> bug-compatible with libldap)
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: DatabaseError: ORA-03127: no new operations allowed until the active operation ends

2011-03-22 Thread Paolo Corti
On 22 Mar, 11:41, Paolo Corti  wrote:
> Hi
> I had to migrate a GeoDjango project based on a Postgres/PostGIS
> backend to a Oracle/Oracle Spatial backend.
>
> I could sync the database without problems and now I can successfully
> read and create new data from the shell, but as soon as I try to
> access my Django web application I am getting in this error:
>
> Traceback (most recent call last):
>   File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
> django/core/servers/basehttp.py", line 283, in run
>     self.result = application(self.environ, self.start_response)
>   File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
> django/contrib/staticfiles/handlers.py", line 68, in __call__
>     return self.application(environ, start_response)
>   File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
> django/core/handlers/wsgi.py", line 275, in __call__
>     signals.request_finished.send(sender=self.__class__)
>   File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
> django/dispatch/dispatcher.py", line 172, in send
>     response = receiver(signal=self, sender=sender, **named)
>   File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
> django/db/__init__.py", line 85, in close_connection
>     conn.close()
>   File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
> django/db/backends/__init__.py", line 244, in close
>     self.connection.close()
>
> DatabaseError: ORA-03127: no new operations allowed until the active
> operation end
>
> I am having the same behavior both with Django 1.2.5 and 1.3 RC
> any ideas?
> thanks

I have solved this by downgrading the cx_Oracle library from 5.1 to
5.0.1
I am using Oracle 11.2
Now works well both on Django 1.2.5 and 1.3 RC with Python 2.6
best regards
P

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Localization of CharField entries

2011-03-22 Thread bruno desthuilliers
On 22 mar, 12:12, Luca Casagrande  wrote:
> Right now the db is full populated, and I have seen that transmeta
> need to
> create new columns.
> Should do thi by hand or there's another approach to this operation
> (i.e. South) ?
>
It's actually documented:

http://code.google.com/p/django-transmeta/#Adding_new_languages

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sanity check regarding ModelForm

2011-03-22 Thread Kenneth Gonsalves
On Tue, 2011-03-22 at 08:15 -0400, Karen Tracey wrote:
> > that the same code is being written twice)
> >
> 
> Russ has already answered so I'm not going to repeat what he said.
> I'll
> note, though, that there's some good doc on this (overriding default
> field
> values in a model form) here:
> http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets
>  

thanks for the link - I had been overriding __init__ before this feature
had come up, so was just continuing to do what I used to do. Coding is
going to be faster now.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: Problem with template syntax.

2011-03-22 Thread Malte Swart
On Tuesday, March 22, 2011 11:25:41 am dvdmchl wrote:
> I'm getting error: Invalid block tag: 'endblock', expected 'endif' in
> tempate:
> 
> {% extends "base.html" %}
> 
> {% block title %}{% endblock %}
> 
> {% block header %}
>   Header
> {% endblock %}
> 
> {% block content %}
>   {% if wiwto_category_name|length > 1 %}
>   {% for category in wiwto_category %}
>   
>   {{ 
> category.name }}
>   
>   {% endfor %}
>   {% else %}
>   List is empty.
>   {% endif% }
you have mixed the blank and %
try:
{% endif %}
> {% endblock %}   #On this
> line is the error
> 
> {% block footer %}
> 
> {% endblock %}

bye,
Malte.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sanity check regarding ModelForm

2011-03-22 Thread Karen Tracey
On Tue, Mar 22, 2011 at 2:31 AM, Kenneth Gonsalves
wrote:

> on running this, I get a form with two fields, name and age. Which is
> what is wanted. So is there anything wrong in coding it this way? I am
> asking this because a co-worker submitted code like this and it is
> working, so I do not know how to react (apart from the obvious comment
> that the same code is being written twice)
>

Russ has already answered so I'm not going to repeat what he said. I'll
note, though, that there's some good doc on this (overriding default field
values in a model form) here:
http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem with template syntax.

2011-03-22 Thread Kenneth Gonsalves
On Tue, 2011-03-22 at 03:25 -0700, dvdmchl wrote:
> {% endif% }

{% endif %}
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: About database composite keys.

2011-03-22 Thread Kenneth Gonsalves
On Tue, 2011-03-22 at 10:31 +, Andre Lopes wrote:
> I have read that Django does not support composite keys. True?

afaik the devs are working on composite keys - but it is not there yet
> 
> How is the philosophy of database design in Django... All the tables
> must to have one sequence(in PostgreSQL) for the PK and use unique
> keys to do the same that a composite key does? 

there is a workaround called unique_together that fits most use cases
(though not all)
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



DatabaseError: ORA-03127: no new operations allowed until the active operation ends

2011-03-22 Thread Paolo Corti
Hi
I had to migrate a GeoDjango project based on a Postgres/PostGIS
backend to a Oracle/Oracle Spatial backend.

I could sync the database without problems and now I can successfully
read and create new data from the shell, but as soon as I try to
access my Django web application I am getting in this error:

Traceback (most recent call last):
  File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
  File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
django/contrib/staticfiles/handlers.py", line 68, in __call__
return self.application(environ, start_response)
  File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
django/core/handlers/wsgi.py", line 275, in __call__
signals.request_finished.send(sender=self.__class__)
  File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
django/db/__init__.py", line 85, in close_connection
conn.close()
  File "/home/pcorti/virtualenv/forest_env/lib/python2.6/site-packages/
django/db/backends/__init__.py", line 244, in close
self.connection.close()

DatabaseError: ORA-03127: no new operations allowed until the active
operation end

I am having the same behavior both with Django 1.2.5 and 1.3 RC
any ideas?
thanks

--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @paolo_corti

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



About database composite keys.

2011-03-22 Thread Andre Lopes
Hi,

I'm new to Django and I have some doubts about the Database Design. I
design Databases two years from now but I'm not accustomed to design
databases without composite keys.

I have read that Django does not support composite keys. True?

How is the philosophy of database design in Django... All the tables
must to have one sequence(in PostgreSQL) for the PK and use unique
keys to do the same that a composite key does?

Do you recommend some Database Design readings about Django?

Best Regards,

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



Problem with template syntax.

2011-03-22 Thread dvdmchl
I'm getting error: Invalid block tag: 'endblock', expected 'endif' in
tempate:

{% extends "base.html" %}

{% block title %}{% endblock %}

{% block header %}
Header
{% endblock %}

{% block content %}
{% if wiwto_category_name|length > 1 %}
{% for category in wiwto_category %}

{{ 
category.name }}

{% endfor %}
{% else %}
List is empty.
{% endif% }
{% endblock %}   #On this
line is the error

{% block footer %}

{% endblock %}


Anyone knows, where is the problem?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django multiple databases router

2011-03-22 Thread dy
Hi,all!
I have two models and need to store to different dbs.The codes are:
# model in app test1,store to default
class Test1(models.Model):
name = models.CharField(max_length=30,verbose_name="name")

class Meta:
verbose_name = "test1"
verbose_name_plural = "test1"
def __unicode__(self):
return self.name

# model in app test2,store to test2
class Test2(models.Model):
name = models.CharField(max_length=30,verbose_name="test2")
test1 =
models.ForeignKey('test1.Test1',verbose_name="FK_test1",blank=True,null=True)

class Meta:
verbose_name = "test2"
verbose_name_plural = "test2"
def __unicode__(self):
return self.name

# my dbrouter
#The code is written in the root directory of the __init__.py file
class MyDBRouter(object):
def db_for_read(self, model, **hints):
return self.__app_router(model)

def db_for_write(self, model, **hints):
return self.__app_router(model)

def allow_relation(self, obj1, obj2, **hints):
#return obj1._meta.app_label == obj2._meta.app_label
return True

def allow_syncdb(self, db, model):
return self.__app_router(model) == db

def __app_router(self, model):
# Can also be written like this,it also works well
# if model.__name__ == 'test2':
if model._meta.app_label == 'test2':
return 'test2'
else:
return 'default'

# at last,my settings
DATABASES = {
'default': {
'ENGINE': 'mysql',
'NAME': 'test1',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '3306',
},
'test2': {
'ENGINE': 'mysql',
'NAME': 'test2',
'USER': 'root',
'PASSWORD': 'root',
'HOST': '',
'PORT': '3306',
}
}
DATABASE_ROUTERS = ['my_project_name.MyDBRouter',]


Questions:
All of these code work well on django 1.2.3,but once I use django
1.2.5 or 1.3 rc1,It does not work and have same exception.The
exception information is:

DatabaseError at /admin/test2/test2/add/
(1146, "Table 'test1.test2_test2' doesn't exist")
Request Method: POST
Request URL:http://192.168.1.111/admin/test2/test2/add/
Django Version: 1.3 rc 1
Exception Type: DatabaseError
Exception Value:
(1146, "Table 'test1.test2_test2' doesn't exist")
Exception Location: build/bdist.linux-i686/egg/MySQLdb/connections.py
in defaulterrorhandler, line 36
Python Executable:  /usr/local/bin/python
Python Version: 2.6.5
Python Path:
['/root/testadmin',
 '/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
 '/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-
linux-i686.egg',
 '/usr/local/lib/python26.zip',
 '/usr/local/lib/python2.6',
 '/usr/local/lib/python2.6/plat-linux2',
 '/usr/local/lib/python2.6/lib-tk',
 '/usr/local/lib/python2.6/lib-old',
 '/usr/local/lib/python2.6/lib-dynload',
 '/usr/local/lib/python2.6/site-packages']


But the most strange thing is that:use the following command:
python manage.py syncdb
python manage.py syncdb --database='test2'
I can create table correctly in different database,also on django
1.2.5 or 1.3 rc1,I do not know whether other people come across this
problem.I also compared the differences between the different versions
of the django source codes about this feature,but did not find
problems.
I use the test environment is:centos5.X+python2.6+mysql

any suggestions?
thx for your time,

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Localization of CharField entries

2011-03-22 Thread Kenneth Gonsalves
On Tue, 2011-03-22 at 04:12 -0700, Luca Casagrande wrote:
> Thanks for your answer.
> Right now the db is full populated, and I have seen that transmeta
> need to
> create new columns.
> Should do thi by hand or there's another approach to this operation
> (i.e. South) ? 

as far as I recall transmeta creates the columns by itself with syncdb
or its own utility - I did it with a fully populated database. The only
thing you have to be careful about is whether the fields to be
translated is mandatory or not - I was a bit careless about that.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: Localization of CharField entries

2011-03-22 Thread Luca Casagrande

On 22 Mar, 10:22, bruno desthuilliers 
wrote:
> on 22 mar, 09:26, Luca Casagrande  wrote:
>
> > Hello everyone,
> > I'm working on the localization of a Django project and I met some
> > difficulties. Following the documentation in the section
> > "Internationalization ", I could easily translate the contents of the
> > templates and the verbose_name of the model's attributes.
> > The problem is that one of my models has a notes field (CharField)
> > with different text for each entry.
> > What is the best way to translate those values​​, if possible, always
> > working with po files?
>
> gettext / po files are for the "static" text only (that is, text in
> your source code). Translations of your application data has to be
> handled at the, well, application data level (IOW: in your db). There
> are quite a few "multilingual model" solutions around, I've been
> mostly happy with transmet so far but didn't have to handle more than
> 3 languages at once - not sure how it would scale for a dozen or more.
>
> http://code.google.com/p/django-transmeta/

Thanks for your answer.
Right now the db is full populated, and I have seen that transmeta
need to
create new columns.
Should do thi by hand or there's another approach to this operation
(i.e. South) ?

Luca

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Localization of CharField entries

2011-03-22 Thread bruno desthuilliers
on 22 mar, 09:26, Luca Casagrande  wrote:
> Hello everyone,
> I'm working on the localization of a Django project and I met some
> difficulties. Following the documentation in the section
> "Internationalization ", I could easily translate the contents of the
> templates and the verbose_name of the model's attributes.
> The problem is that one of my models has a notes field (CharField)
> with different text for each entry.
> What is the best way to translate those values​​, if possible, always
> working with po files?

gettext / po files are for the "static" text only (that is, text in
your source code). Translations of your application data has to be
handled at the, well, application data level (IOW: in your db). There
are quite a few "multilingual model" solutions around, I've been
mostly happy with transmet so far but didn't have to handle more than
3 languages at once - not sure how it would scale for a dozen or more.

http://code.google.com/p/django-transmeta/

HTH

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Localization of CharField entries

2011-03-22 Thread Luca Casagrande
Hello everyone,
I'm working on the localization of a Django project and I met some
difficulties. Following the documentation in the section
"Internationalization ", I could easily translate the contents of the
templates and the verbose_name of the model's attributes.
The problem is that one of my models has a notes field (CharField)
with different text for each entry.
What is the best way to translate those values​​, if possible, always
working with po files?

Thank you very much
Luca

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sanity check regarding ModelForm

2011-03-22 Thread Kenneth Gonsalves
On Tue, 2011-03-22 at 14:41 +0800, Russell Keith-Magee wrote:
> > working, so I do not know how to react (apart from the obvious
> comment
> > that the same code is being written twice)
> 
> Aside from the redundancy, there's nothing inherently wrong with this.
> 
> The fact that this is allowed at all is actually a design feature --
> the intention is that you can define a ModelForm that explicitly
> overrides the default field types (e.g., I want a Password field to be
> used for this sensitive information in a CharField on my model). 

that is interesting - so far I have been doing this by overriding
__init__ in the ModelField
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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