Re: Django 1.5.1 and formsets with more than 1000 initials

2013-04-24 Thread Xavier Ordoquy
Hi Carsten,

When you create your FormSet with formset_factory, the max_number is set to the 
max of 1000 and max_num.
The fact that you set a bigger number of initials doesn't affect this number.
I'm not sure whether the FormSet could extends itself this number if the 
initial_data is larger than 1000. You probably could open a ticket about that.

Please note that a more flexible workaround would be:
> >>> ArticleFormSet = formset_factory(ArticleForm, max_num=len(MyInitials), 
> >>> extra=0)


Regards,
Xavier Ordoquy,
Linovia.


Le 24 avr. 2013 à 21:42, Carsten Fuchs  a écrit :

> Hi all,
> 
> using Django 1.5.1, having read 
> ,
>  I still have trouble creating a formset with more than 1000 initial forms:
> 
> Following the example at that page, what I'd like to do is, with MyInitials 
> being a list of e.g. 1500 initial values:
> 
> >>> ArticleFormSet = formset_factory(ArticleForm, extra=0)
> >>> formset = ArticleFormSet(initial=MyInitials)
> 
> Now, accessing formset.forms[1000] throws an IndexError exception.
> 
> I understand that this is related to the "Formset denial-of-service" issue 
> mentioned at https://www.djangoproject.com/weblog/2013/feb/19/security/, but 
> isn't max_num supposed to limited the number of *extra* formsets only?
> 
> It is relatively easy to work-around my original problem:
> 
> >>> ArticleFormSet = formset_factory(ArticleForm, max_num=3, extra=0)
> 
> but shouldn't a larger number of initials automatically extend the max_num?
> 
> Best regards,
> Carsten
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

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




Re: performance of delete

2013-04-24 Thread Nick Santos
Related to the use of IN, but not an answer, I've found this series of
article from ExplainExtended to be super helpful in optimizing some of my
DB queries. These two are for MySQL, but the author has versions for
Postgres and SQL Server as well. I know this help is limited with an ORM,
but maybe with some clever django-ing you can utilize the core principles
of this.

IN vs JOIN vs EXISTS:
http://explainextended.com/2009/06/16/in-vs-join-vs-exists/
NOT IN vs NOT EXISTS vs LEFT JOIN / IS NULL:
http://explainextended.com/2009/09/18/not-in-vs-not-exists-vs-left-join-is-null-mysql/

Nick Santos
Executive Director, The Environmental Consumer

You sent this email to ultraa...@gmail.com - please note that my current
address is n...@enviroconsumer.org


On Wed, Apr 24, 2013 at 7:22 PM, Matt Long  wrote:

> I'm curious how long manually running a single delete query with the
> appropriate where clause would take. Surely there's a way to do that
> through the Django ORM without having to drop into raw SQL?
>
> That being said, there are limits to how long a given query can be, so the
> ORM would have to do some intelligent batching of your IN clause, so maybe
> it does make sense to leave that hairy logic out of the ORM :-)
>
> --
> Matt Long
> Sent with Sparrow 
>
> On Wednesday, April 24, 2013 at 18:31, Larry Martell wrote:
>
> I changed it to delete one row at a time and it's taking 3 minutes.
>
> On Wed, Apr 24, 2013 at 6:38 PM, Setiaman Lee 
> wrote:
>
> Larry,
>
>
> Avoid to use IN clause. I'd say to insert the events you want to delete
> into
> the temp table. You can put the session id or user id in temp table to
> differentiate set of data from other users. Then do the delete by joining
> the temp table to the Event_Message_ldx table. your sql might look like
> this:
>
> delete event_message_ldx
> from temp
> where event_message_ldx.event_id = temp.event_id
> and temp.userid = %s
>
> above SQL can be executed in Django using RAW SQL. See the link below.
> https://docs.djangoproject.com/en/dev/topics/db/sql/
>
> Test the SQL in the MySQL workspace when it works then move the code to the
> Django.
>
> Rgrds,
> Setiaman Lee
>
>
>
>
>
> On Thu, Apr 25, 2013 at 8:12 AM, Larry Martell 
> wrote:
>
>
> I have a table that has 2.5 million rows and 9 columns that are all
> int except for 2 varchar(255) - i.e. not that big of a table. I am
> executing this statement:
>
> Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()
>
> Where event_ids has around 1,500 items in it. There is an index on
> event_id. This statement is taking 1 hour and 5 minutes to run. There
> is nothing else hitting the database at that time, and the machine
> it's running on is 97% idle and has plenty of free memory. This seems
> extremely excessive to me. I would guess it's because of the in
> clause. Perhaps this is more of a MySQL question when a django one,
> but is there some better way to do a delete like this in django?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

Re: performance of delete

2013-04-24 Thread Matt Long
I'm curious how long manually running a single delete query with the 
appropriate where clause would take. Surely there's a way to do that through 
the Django ORM without having to drop into raw SQL?

That being said, there are limits to how long a given query can be, so the ORM 
would have to do some intelligent batching of your IN clause, so maybe it does 
make sense to leave that hairy logic out of the ORM :-) 

-- 
Matt Long
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Wednesday, April 24, 2013 at 18:31, Larry Martell wrote:

> I changed it to delete one row at a time and it's taking 3 minutes.
> 
> On Wed, Apr 24, 2013 at 6:38 PM, Setiaman Lee  wrote:
> > Larry,
> > 
> > 
> > Avoid to use IN clause. I'd say to insert the events you want to delete into
> > the temp table. You can put the session id or user id in temp table to
> > differentiate set of data from other users. Then do the delete by joining
> > the temp table to the Event_Message_ldx table. your sql might look like
> > this:
> > 
> > delete event_message_ldx
> > from temp
> > where event_message_ldx.event_id = temp.event_id
> > and temp.userid = %s
> > 
> > above SQL can be executed in Django using RAW SQL. See the link below.
> > https://docs.djangoproject.com/en/dev/topics/db/sql/
> > 
> > Test the SQL in the MySQL workspace when it works then move the code to the
> > Django.
> > 
> > Rgrds,
> > Setiaman Lee
> > 
> > 
> > 
> > 
> > 
> > On Thu, Apr 25, 2013 at 8:12 AM, Larry Martell 
> > wrote:
> > > 
> > > I have a table that has 2.5 million rows and 9 columns that are all
> > > int except for 2 varchar(255) - i.e. not that big of a table. I am
> > > executing this statement:
> > > 
> > > Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()
> > > 
> > > Where event_ids has around 1,500 items in it. There is an index on
> > > event_id. This statement is taking 1 hour and 5 minutes to run. There
> > > is nothing else hitting the database at that time, and the machine
> > > it's running on is 97% idle and has plenty of free memory. This seems
> > > extremely excessive to me. I would guess it's because of the in
> > > clause. Perhaps this is more of a MySQL question when a django one,
> > > but is there some better way to do a delete like this in django?
> > > 
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an
> > > email to django-users+unsubscr...@googlegroups.com.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > > 
> > 
> > 
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> > 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 


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




Re: performance of delete

2013-04-24 Thread Larry Martell
I changed it to delete one row at a time and it's taking 3 minutes.

On Wed, Apr 24, 2013 at 6:38 PM, Setiaman Lee  wrote:
> Larry,
>
>
> Avoid to use IN clause. I'd say to insert the events you want to delete into
> the temp table. You can put the session id or user id in temp table to
> differentiate set of data from other users. Then do the delete by joining
> the temp table to the Event_Message_ldx table. your sql might look like
> this:
>
> delete event_message_ldx
> from temp
> where event_message_ldx.event_id = temp.event_id
> and temp.userid = %s
>
> above SQL can be executed in Django using RAW SQL. See the link below.
> https://docs.djangoproject.com/en/dev/topics/db/sql/
>
> Test the SQL in the MySQL workspace when it works then move the code to the
> Django.
>
> Rgrds,
> Setiaman Lee
>
>
>
>
>
> On Thu, Apr 25, 2013 at 8:12 AM, Larry Martell 
> wrote:
>>
>> I have a table that has 2.5 million rows and 9 columns that are all
>> int except for 2 varchar(255) - i.e. not that big of a table. I am
>> executing this statement:
>>
>> Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()
>>
>> Where event_ids has around 1,500 items in it. There is an index on
>> event_id. This statement is taking 1 hour and 5 minutes to run. There
>> is nothing else hitting the database at that time, and the machine
>> it's running on is 97% idle and has plenty of free memory. This seems
>> extremely excessive to me. I would guess it's because of the in
>> clause. Perhaps this is more of a MySQL question when a django one,
>> but is there some better way to do a delete like this in django?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

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




Re: performance of delete

2013-04-24 Thread Setiaman Lee
Larry,


Avoid to use IN clause. I'd say to insert the events you want to delete
into the temp table. You can put the session id or user id in temp table to
differentiate set of data from other users. Then do the delete by joining
the temp table to the Event_Message_ldx table. your sql might look like
this:

delete event_message_ldx
from temp
where event_message_ldx.event_id = temp.event_id
and temp.userid = %s

above SQL can be executed in Django using RAW SQL. See the link below.
https://docs.djangoproject.com/en/dev/topics/db/sql/

Test the SQL in the MySQL workspace when it works then move the code to the
Django.

Rgrds,
Setiaman Lee





On Thu, Apr 25, 2013 at 8:12 AM, Larry Martell wrote:

> I have a table that has 2.5 million rows and 9 columns that are all
> int except for 2 varchar(255) - i.e. not that big of a table. I am
> executing this statement:
>
> Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()
>
> Where event_ids has around 1,500 items in it. There is an index on
> event_id. This statement is taking 1 hour and 5 minutes to run. There
> is nothing else hitting the database at that time, and the machine
> it's running on is 97% idle and has plenty of free memory. This seems
> extremely excessive to me. I would guess it's because of the in
> clause. Perhaps this is more of a MySQL question when a django one,
> but is there some better way to do a delete like this in django?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




performance of delete

2013-04-24 Thread Larry Martell
I have a table that has 2.5 million rows and 9 columns that are all
int except for 2 varchar(255) - i.e. not that big of a table. I am
executing this statement:

Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()

Where event_ids has around 1,500 items in it. There is an index on
event_id. This statement is taking 1 hour and 5 minutes to run. There
is nothing else hitting the database at that time, and the machine
it's running on is 97% idle and has plenty of free memory. This seems
extremely excessive to me. I would guess it's because of the in
clause. Perhaps this is more of a MySQL question when a django one,
but is there some better way to do a delete like this in django?

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




Re: Abridged summary of django-users@googlegroups.com - 43 Messages in 19 Topics

2013-04-24 Thread Simon Pickles


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




Re: Using Django and R in a production environment?

2013-04-24 Thread lgautier

> (...) You don't 
really want all your 
> users using the same R session anyways. 

Particularly is users are allowed to run their own code, as the original 
post suggested it.
A sandboxing+quota mechanism would also be necessary.


L.


On Wednesday, April 24, 2013 7:52:19 PM UTC+2, Alex wrote:
>
> There is another large potential gotcha, R is very memory heavy. 
> I do think the route of using Celery or other job management tools makes 
> sense, especially if you can use R across multiple backend machines. 
> Would celery mean one rpy2 per celery? You don't really want all your 
> users using the same R session anyways. 
>
> Thanks, 
> Alex 
>
> On 04/23/2013 11:08 PM, Derek wrote: 
> > Thanks Per-Olof 
> > 
> > No, it has more to do with the issue raised here: 
> > 
> https://github.com/Sleepingwell/DjangoRpyDemo/blob/master/README.md#django-configuration
>  
> > 
> > Possibly Celery could solve that (?) but I really would like to hear 
> from 
> > someone who actually has a production configuration set up and working. 
> > Perhaps there are less people in the sciences using Django than I 
> thought... 
> > 
> > Derek 
> > 
> > On Tuesday, 23 April 2013 21:32:12 UTC+2, Per-Olof �strand wrote: 
> >> 
> >> I am not sure I understand your question, but is it really related to 
> >> using specifically R? Could it be any kind of heavy number-crunching 
> that 
> >> needs to be done in the background by a scheduler/task manager? In that 
> >> case, django-celery may be an option: 
> >> http://docs.celeryproject.org/en/latest/index.html 
> >> 
> >> Per-Olof 
> >> 
> >> On Monday, April 22, 2013 9:26:05 PM UTC+2, Derek wrote: 
> >>> 
> >>> Based on googling around this topic, it seems that using RPy2 is the 
> most 
> >>> common way to interface with R from Python.  However all the 
> discussions on 
> >>> this seem to centre around working in a desktop (single user) 
> environment. 
> >>> 
> >>> The one discussion I could find that deals with the issue of working 
> with 
> >>> R "at scale" is this one - 
> >>> 
> https://github.com/Sleepingwell/DjangoRpyDemo/blob/master/README.md#django-configuration
>  
> >>> - which indicates problems with this approach; and suggests it might 
> be 
> >>> able to be overcome via creating distinct processes dedicated to run a 
> WSGI 
> >>> application (although this article does not give any steps on how to 
> do 
> >>> this, or whether it would work in practice). 
> >>> 
> >>> Another approach seems to be to use RPy2, with Twisted to enable 
> multiple 
> >>> sessions: 
> >>> 
> https://docs.google.com/presentation/d/11LJxej6jnbYKzJftpDudYFfVKjaB0BhOzrBSKaxJ2ME/edit#slide=id.p
>  
> >>> . 
> >>> 
> >>> Yet another approach might be to use Rserve ( 
> >>> http://www.rforge.net/Rserve/) and PyRserve ( 
> >>> http://pythonhosted.org/pyRserve/manual.html), but the latter seems 
> to 
> >>> currently be in beta. 
> >>> 
> >>> Question is: does anyone have any practical experience actually using 
> >>> Django with R in a production environment (i.e dozens or hundreds of 
> users 
> >>> doing high volume number crunching)? 
> >>> 
> >>> Thanks 
> >>> Derek 
> >>> 
> >>> PS Yes, we do need R and not one of the Python-based alternatives, as 
> R 
> >>> offers many routines simply not available in those as yet (also, the 
> client 
> >>> needs to re-use, and create new, R scripts themselves) 
> >>> 
> >> 
> > 
>
>

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




Django 1.5.1 and formsets with more than 1000 initials

2013-04-24 Thread Carsten Fuchs

Hi all,

using Django 1.5.1, having read 
, 
I still have trouble creating a formset with more than 1000 initial forms:


Following the example at that page, what I'd like to do is, with MyInitials being a list 
of e.g. 1500 initial values:


>>> ArticleFormSet = formset_factory(ArticleForm, extra=0)
>>> formset = ArticleFormSet(initial=MyInitials)

Now, accessing formset.forms[1000] throws an IndexError exception.

I understand that this is related to the "Formset denial-of-service" issue mentioned at 
https://www.djangoproject.com/weblog/2013/feb/19/security/, but isn't max_num supposed 
to limited the number of *extra* formsets only?


It is relatively easy to work-around my original problem:

>>> ArticleFormSet = formset_factory(ArticleForm, max_num=3, extra=0)

but shouldn't a larger number of initials automatically extend the max_num?

Best regards,
Carsten

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




Re: Admin pagination not digg-style

2013-04-24 Thread Andre Terra
Override the default template and add a for loop with {%
forloop.counter %}'s from 0 to max-pages or whatever the variable is
called.

Assuming you're talking about the change form, please see this:
http://stackoverflow.com/a/3729995/447485

Otherwise you can still probably work from the info provided there.



Cheers,
AT

On Mon, Apr 22, 2013 at 6:26 PM, Stanislav Mihaylov
wrote:

> I can't seem to find an easy and simple way to make the Django admin
> paginator display all page numbers rather then displaying them in 'Digg'
> style in the footer navigation.
>
> I read plenty of articles on how to make it Digg style, but it seems in
> the new Django versions it is Digg style by default, so how can I make it
> display all numbers?
>
> Thank you in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Using Django and R in a production environment?

2013-04-24 Thread Alex Mandel

There is another large potential gotcha, R is very memory heavy.
I do think the route of using Celery or other job management tools makes 
sense, especially if you can use R across multiple backend machines. 
Would celery mean one rpy2 per celery? You don't really want all your 
users using the same R session anyways.


Thanks,
Alex

On 04/23/2013 11:08 PM, Derek wrote:

Thanks Per-Olof

No, it has more to do with the issue raised here:
https://github.com/Sleepingwell/DjangoRpyDemo/blob/master/README.md#django-configuration

Possibly Celery could solve that (?) but I really would like to hear from
someone who actually has a production configuration set up and working.
Perhaps there are less people in the sciences using Django than I thought...

Derek

On Tuesday, 23 April 2013 21:32:12 UTC+2, Per-Olof Åstrand wrote:


I am not sure I understand your question, but is it really related to
using specifically R? Could it be any kind of heavy number-crunching that
needs to be done in the background by a scheduler/task manager? In that
case, django-celery may be an option:
http://docs.celeryproject.org/en/latest/index.html

Per-Olof

On Monday, April 22, 2013 9:26:05 PM UTC+2, Derek wrote:


Based on googling around this topic, it seems that using RPy2 is the most
common way to interface with R from Python.  However all the discussions on
this seem to centre around working in a desktop (single user) environment.

The one discussion I could find that deals with the issue of working with
R "at scale" is this one -
https://github.com/Sleepingwell/DjangoRpyDemo/blob/master/README.md#django-configuration
- which indicates problems with this approach; and suggests it might be
able to be overcome via creating distinct processes dedicated to run a WSGI
application (although this article does not give any steps on how to do
this, or whether it would work in practice).

Another approach seems to be to use RPy2, with Twisted to enable multiple
sessions:
https://docs.google.com/presentation/d/11LJxej6jnbYKzJftpDudYFfVKjaB0BhOzrBSKaxJ2ME/edit#slide=id.p
.

Yet another approach might be to use Rserve (
http://www.rforge.net/Rserve/) and PyRserve (
http://pythonhosted.org/pyRserve/manual.html), but the latter seems to
currently be in beta.

Question is: does anyone have any practical experience actually using
Django with R in a production environment (i.e dozens or hundreds of users
doing high volume number crunching)?

Thanks
Derek

PS Yes, we do need R and not one of the Python-based alternatives, as R
offers many routines simply not available in those as yet (also, the client
needs to re-use, and create new, R scripts themselves)







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




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Wissal Khadrouf WBC
I went the hard way and changed all the null values untill I found out
which one caused a problem
Thanks


2013/4/24 Shawn Milochik 

> Ah, I missed that point. You could temporarily create an __init__ override
> in your model and put the code there.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/r4VivI6pwOs/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Cordialement.


 Wissal KHADROUF
Web Development Engineer
81 Avenue Mers sultan, Grand Casablanca, Maroc
0660 347 547
wissal.khadr...@wbc.ma

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




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Shawn Milochik
Ah, I missed that point. You could temporarily create an __init__ override
in your model and put the code there.

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




Remove Django Documentation Items

2013-04-24 Thread Trevor Reed
Hello guys, is it possible to remove entries from the Django generated 
Documentation?


Thanks

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




Django Documentation

2013-04-24 Thread Trevor Reed
Hello, 
 


 I am relatively new to Django, but I love it so far. Is it possible to 
remove categories from the application documentation page, such as Tags, 
Filters, and Views.



Thank You

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




handling IntegrityError: Duplicate entry in UserCreationForm

2013-04-24 Thread sachin
Hello,

I m extending my auth user model to add addition entries like phone numbers 
and emp_id. In the model I m marking both the fields as unique=True.
Form generation is using UserCreationForm. But whenever I try to save same 
phone number or emp_id it throws 

*IntegrityError: (1062, "Duplicate entry '447' for key 'phone_num'")*

How to handle this error and show it to user during form input?

Also how do the same UserCreationForm validates duplicate entry for 
username etc ??

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




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Wissal Khadrouf WBC
it's the admin view you're telling me to modify
I'm sorry I'm faily new to django and I'm afraid I will do something wrong!


2013/4/24 Shawn Milochik 

> See what I said above about iterating through the fields in your view. Use
> logging, print statements, or dump output to a file.
>
>
> On Wed, Apr 24, 2013 at 10:39 AM, Wissal Khadrouf WBC <
> wissal.khadr...@wbc.ma> wrote:
>
>> That's what I was thinking,it's from the data
>> But I dont know wich field and how to find out
>>
>>
>> 2013/4/24 Shawn Milochik 
>>
>>> Try iterating through your output in the view and look at field,
>>> field.content, and if field.help_text. Somewhere you have a null value
>>> which is None in Python.
>>>
>>> Since the traceback you posted (if it's complete) is all from Django's
>>> code and not yours, then the error must be in your data.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-users/r4VivI6pwOs/unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Cordialement.
>>
>>
>>  Wissal KHADROUF
>> Web Development Engineer
>> 81 Avenue Mers sultan, Grand Casablanca, Maroc
>> 0660 347 547
>> wissal.khadr...@wbc.ma
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> e-mail: sh...@milochik.com
> voicemail or fax: 206-350-8781
> blog: http://milocast.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/r4VivI6pwOs/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Cordialement.


 Wissal KHADROUF
Web Development Engineer
81 Avenue Mers sultan, Grand Casablanca, Maroc
0660 347 547
wissal.khadr...@wbc.ma

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




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Shawn Milochik
See what I said above about iterating through the fields in your view. Use
logging, print statements, or dump output to a file.


On Wed, Apr 24, 2013 at 10:39 AM, Wissal Khadrouf WBC <
wissal.khadr...@wbc.ma> wrote:

> That's what I was thinking,it's from the data
> But I dont know wich field and how to find out
>
>
> 2013/4/24 Shawn Milochik 
>
>> Try iterating through your output in the view and look at field,
>> field.content, and if field.help_text. Somewhere you have a null value
>> which is None in Python.
>>
>> Since the traceback you posted (if it's complete) is all from Django's
>> code and not yours, then the error must be in your data.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/r4VivI6pwOs/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Cordialement.
>
>
>  Wissal KHADROUF
> Web Development Engineer
> 81 Avenue Mers sultan, Grand Casablanca, Maroc
> 0660 347 547
> wissal.khadr...@wbc.ma
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
e-mail: sh...@milochik.com
voicemail or fax: 206-350-8781
blog: http://milocast.com

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




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Wissal Khadrouf WBC
That's what I was thinking,it's from the data
But I dont know wich field and how to find out


2013/4/24 Shawn Milochik 

> Try iterating through your output in the view and look at field,
> field.content, and if field.help_text. Somewhere you have a null value
> which is None in Python.
>
> Since the traceback you posted (if it's complete) is all from Django's
> code and not yours, then the error must be in your data.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/r4VivI6pwOs/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Cordialement.


 Wissal KHADROUF
Web Development Engineer
81 Avenue Mers sultan, Grand Casablanca, Maroc
0660 347 547
wissal.khadr...@wbc.ma

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




Re: Upload csv file

2013-04-24 Thread Hélio Miranda
That was it, I managed

Thank you

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




Re: Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread Shawn Milochik
Try iterating through your output in the view and look at field,
field.content, and if field.help_text. Somewhere you have a null value
which is None in Python.

Since the traceback you posted (if it's complete) is all from Django's code
and not yours, then the error must be in your data.

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




Re: Upload csv file

2013-04-24 Thread Shawn Milochik
http://docs.python.org/2/library/csv.html#csv.DictReader

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




Re: Upload csv file

2013-04-24 Thread Hélio Miranda
I have a problem that I am not able to resolve.
With the code I left in the previous post, you are entering data in csv db 
without problems, but for example the csv file looks like this:

Namo,Sobrenome
Rui,Gomes
Renato,Aimar

And I just want it to be inserted into the db (Renato Aimar and Rui Gomes) 
and what is happening is that you're putting everything (Nome Sobrenome, 
Rui Gomes and Renato AImar).

How can I solve this problem?

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




Re: Upload csv file

2013-04-24 Thread Hélio Miranda
I have a problem that I am not able to resolve.
With the code I left in the previous post, you are entering data in csv db 
without problems, but for example the csv file looks like this:

Name, Surname
Rui Gomes
Renato, Aimar

And I just want it to be inserted into the db (Renato Gomes and Rui, Aimar) 
and what is happening is that you're putting everything (Name Surname, Rui 
Gomes and RenatoAImar).

How can I solve this problem?

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




Re: Upload csv file

2013-04-24 Thread Hélio Miranda
It was because I first had to enter the fields and now wanted by csv.

So now I removed the fields, and only got the upload. How are here:
http://plnkr.co/edit/hoaPt2ljRDZbw7XdW80Q

And it's ok.
Already inserting data from csv.

Thank you for your help

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




Re: Upload csv file

2013-04-24 Thread abhijeet shete
According to form you used in your template it will send only csv file
after clicking on submit button.


  {% csrf_token %}

Submit
  

If you want to access Nome and Sobrenome in views on submit button, then
you need to pass these inputs in the same form you used for submit as

 
  {% csrf_token %}





Submit
  

 Currently you are using two different forms for uploading file and Nome &
Sobrenome.

And why there are 2 functions with same name index in your views ?

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




django development server timeout too quick

2013-04-24 Thread Hadi Sunyoto
The problem is like this:

i am using django admin, and in several forms, it might take around 10-20 
minutes to fill up.
By the time save button is pressed, i am always redirected to login page.

The question is: how can i make the timeout longer (or maybe last forever)

I set the cache to file and session_engine to db

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': 'some/path',
'TIMEOUT': 10,
}
}
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"

What else am i missing here? any direction will be much appreciated

i also have tried to set --noreload in runserver so that file changed does 
not get reloaded, but i still get the same problem.

i don't plan on using apache/ngix/etc because this is only for my personal 
use

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




Choices with many to many

2013-04-24 Thread BOLKAN
Hi to all
thi is my first post on django group.
I'm new on django and I'm going crazy for a week on this question:
 
I have these models: 
 
class Linea(models.Model):
linea = models.CharField(unique=True, max_length=10, verbose_name = 
"Linea")
class Meta:
  verbose_name_plural = "Linee"
def __unicode__(self):
   return self.linea
 
class Board(models.Model):
board = models.CharField(unique=True, max_length=15, verbose_name = 
"Board")
life = models.IntegerField(max_length=4, verbose_name = "Ore di vita")
class Meta:
 verbose_name_plural = "Boards"
def __unicode__(self):
 return u'%s' % self.board
 
class Package(models.Model):
 package = models.CharField(unique=True, max_length=10, verbose_name = 
"Package")
 class Meta:
  verbose_name_plural = "Packages"
 def __unicode__(self):
  return self.package
 
class Prodotto(models.Model):
 linea = models.ForeignKey(Linea, verbose_name = "Linea")
 prodotto = models.CharField(unique=True, max_length=15, verbose_name = 
"Prodotto")
 package = models.ManyToManyField(Package, related_name="packages", 
verbose_name = "Package")
 board = models.ManyToManyField(Board, related_name="boards", 
verbose_name = "Board")
 
class Prove(models.Model):
 nomeprova = models.CharField(unique=True, max_length=20, verbose_name 
= "Nome prova")# *
 TIPOPROVA = (
   ('c1', c1',),(c2', c2.',),(c3.', 
c3.',),
 )
 tipodiprova = models.CharField(unique=True, max_length=10, choices = 
TIPOPROVA, default = 'c1', verbose_name = "Tipo di prova")
 linea = models.ForeignKey(Linea, verbose_name = "Linea")
 prodotto = models.ForeignKey(Prodotto, verbose_name = "Prodotto")
 package = models.CharField(max_length=20, verbose_name = "Package")# *
 board = models.CharField(max_length=20, verbose_name = "Board")# *
 
In admin form of  "Prove" for the the fields package and board  I need to 
choice from the list of boards and packages that belong prodotto, because 
prodotto (as you can see ) contain a list of pakage and boards (Many to 
many ).
For do that the only thing I do until now is to override rthe Prove.board 
and Prove.package fields to forms.ChoiceField but how can I take the list 
from the current product and put it in these fields?
 
Tanks in advance

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




Re: Upload csv file

2013-04-24 Thread abhijeet shete
According to form you used in your template it will send only file


  {% csrf_token %}

Submit


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




Re: Upload csv file

2013-04-24 Thread Hélio Miranda
Ok, I made the changes as you said.

But when I choose the csv file and then I click the submit button, it gives 
me the following error has:

*"Key 'Nome' not found in "*

*
*

I do not know why*
*

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




Re: Upload csv file

2013-04-24 Thread abhijeet shete
1. In your views.index function you have written something like this

   file = request.FILES
 for line in file:

You cant use file object directly instead try some thing like this

file = request.FILES['file']
for line in file.readlines():
  line = line.split(';')

2. You cant directly access model fields you need to access them with model
object.

Nome  = line[0] # wrong

report.Nome  = line[0] # Correct
report.Sobrenome = line[1]


Cheers.
Abhijeet Shete

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




Django admin error : coercing to Unicode: need string or buffer, NoneType found

2013-04-24 Thread slim
Hello everyone,

I have this error since a long time but can't figure it out :

*Caught TypeError while rendering: coercing to Unicode: need string or 
buffer, NoneType found*

It happens in admin when I try to add or modify on one of my models 
(display works fine)


This is the model:


class PS(models.Model):
id_ps = models.IntegerField(null=True)
client = models.ForeignKey(Client, null=True, blank=True)
nom_du_site = models.CharField(max_length=250)
rue_livraison = models.TextField(null=True)
complement_adresse = models.TextField(null=True)
code_postal_livraison = models.CharField(max_length=50, null=True)
ville_livraison = models.CharField(max_length=200, null=True)
pays_livraison = models.CharField(max_length=200, null=True)
distributeur = models.CharField(max_length=50, null=True)
tarif = models.CharField(max_length=250, null=True)
type_tarif = models.CharField(max_length=50, null=True)
type_installation = models.CharField(max_length=50, null=True)

def __unicode__(self):
return self.nom_du_site

@property
def pce(self):
try:
return PCE.objects.filter(ps=self)[0]
except IndexError:
return
#
def get_pce(self):
from pce.models import PCE
return PCE.objects.filter(ps=self).exclude(frequence='6M')
#
def get_pce_6m(self):
from pce.models import PCE
return PCE.objects.filter(ps=self,frequence='6M') 



Any idea what am i doing wrong here?


*Traceback:*

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8026/admin/ps/ps/add/
Django Version: 1.2.5
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'easy_thumbnails',
 'django_extensions',
 'contentadmin',
 'south',
 'sentry',
 'sentry.client',
 'indexer',
 'file_uploader',
 'paging',
 'pagination',
 'consommation',
 'ps',
 'pce',
 'profil',
 'analytics',
 'document']
Installed Middleware:
('annoying.middlewares.StaticServe',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'pagination.middleware.PaginationMiddleware')


Template error:
In template 
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/includes/fieldset.html,
 
error at line 19
   Caught TypeError while rendering: coercing to Unicode: need 
string or buffer, NoneType found
   9 : {% for field in line %}


   10 : 


   11 : {% if not line.fields|length_is:'1' and 
not field.is_readonly %}{{ field.errors }}{% endif %}


   12 : {% if field.is_checkbox %}


   13 : {{ field.field }}{{ field.label_tag 
}}


   14 : {% else %}


   15 : {{ field.label_tag }}


   16 : {% if field.is_readonly %}


   17 : {{ field.contents }}


   18 : {% else %}


   19 :   *   {{ field.field }} *


   20 : {% endif %}


   21 : {% endif %}


   22 : {% if field.field.field.help_text %}


   23 : {{ 
field.field.field.help_text|safe }}


   24 : {% endif %}


   25 : 


   26 : {% endfor %}


   27 : 


   28 : {% endfor %}


   29 : 


Traceback:
File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
get_response
  100. 

Re: Upload csv file

2013-04-24 Thread Hélio Miranda
What I'm doing is the following link:
http://plnkr.co/edit/hoaPt2ljRDZbw7XdW80Q

I can input the registration, filling and pressing the add.

But now, I wanted to select a csv file and insert the data. I'm trying the 
way the link is there, but do not know if it's correct, because I'm 
starting in Django

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




Re: Upload csv file

2013-04-24 Thread abhijeet shete
Can you please briefly explain your model structure and how you are trying
to save csv in MongoDB so that we can check whats going wrong.

>
Cheers.
Abhijeet Shete

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




Re: Upload csv file

2013-04-24 Thread Hélio Miranda
I mogodb to enter data in, can not pass data from csv into a model, you 
must be a Document

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




Template Caching with Messages

2013-04-24 Thread Venkatraman S
It looks to me that when i use a file based caching, and if append messages
in my templates(based on user action), that particular page(with message)
also gets cached. Since 'these' pages would never be created again, what is
the best possible option? (Well, i just used file-based cache to quickly
see what was happening, but i guess the same happens for any other cache
mode too)

One thing that i could think of is use cache-fragments for the rest of the
sections in the template and leave out the 'div' which displays the
messages.

Any other solutions or comments?

-V
@venkasub 

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




Re: Using Django and R in a production environment?

2013-04-24 Thread Derek
Thanks Per-Olof

No, it has more to do with the issue raised here:
https://github.com/Sleepingwell/DjangoRpyDemo/blob/master/README.md#django-configuration

Possibly Celery could solve that (?) but I really would like to hear from 
someone who actually has a production configuration set up and working.  
Perhaps there are less people in the sciences using Django than I thought...

Derek

On Tuesday, 23 April 2013 21:32:12 UTC+2, Per-Olof Åstrand wrote:
>
> I am not sure I understand your question, but is it really related to 
> using specifically R? Could it be any kind of heavy number-crunching that 
> needs to be done in the background by a scheduler/task manager? In that 
> case, django-celery may be an option: 
> http://docs.celeryproject.org/en/latest/index.html
>
> Per-Olof
>
> On Monday, April 22, 2013 9:26:05 PM UTC+2, Derek wrote:
>>
>> Based on googling around this topic, it seems that using RPy2 is the most 
>> common way to interface with R from Python.  However all the discussions on 
>> this seem to centre around working in a desktop (single user) environment.
>>
>> The one discussion I could find that deals with the issue of working with 
>> R "at scale" is this one - 
>> https://github.com/Sleepingwell/DjangoRpyDemo/blob/master/README.md#django-configuration
>>   
>> - which indicates problems with this approach; and suggests it might be 
>> able to be overcome via creating distinct processes dedicated to run a WSGI 
>> application (although this article does not give any steps on how to do 
>> this, or whether it would work in practice).
>>
>> Another approach seems to be to use RPy2, with Twisted to enable multiple 
>> sessions: 
>> https://docs.google.com/presentation/d/11LJxej6jnbYKzJftpDudYFfVKjaB0BhOzrBSKaxJ2ME/edit#slide=id.p
>> .
>>
>> Yet another approach might be to use Rserve (
>> http://www.rforge.net/Rserve/) and PyRserve (
>> http://pythonhosted.org/pyRserve/manual.html), but the latter seems to 
>> currently be in beta.
>>  
>> Question is: does anyone have any practical experience actually using 
>> Django with R in a production environment (i.e dozens or hundreds of users 
>> doing high volume number crunching)?
>>
>> Thanks
>> Derek
>>
>> PS Yes, we do need R and not one of the Python-based alternatives, as R 
>> offers many routines simply not available in those as yet (also, the client 
>> needs to re-use, and create new, R scripts themselves)
>>
>

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