Re: Choices as a callable.. but no parameters?

2015-04-20 Thread Stephen J. Butler
On Mon, Apr 20, 2015 at 9:45 PM, Vijay Khemlani  wrote:
> Overwrite the constructor of the form (__init__), pass the user or whatever
> parameters you may need and overwrite the choices of the field in the body
> of the method.

This is the same strategy I've used to filter ForeignKey fields on the
current user. If you're using class based views you should override
get_form_kwargs() to add the user parameter to the form's __init__().

It's a little trickier if you want to make this work in a ModelAdmin
subclass though. I don't see a similar method to override. What I've
done is to override ModelAdmin.get_form() like this:

def get_form(self, request, obj=None, **kwargs):
form_class = super(MyModelAdmin, self).get_form(request, obj, **kwargs)
class _Form(form_class):
def __init__(form_self, *args, **kwargs):
super(_Form, form_self).__init__(user=request.user, *args, **kwargs)
return _Form

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD4ANxWy%2Bs351iJcZHxqJgDQScMHa%3DNvbc5uqUqCTXmz6QEawA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Choices as a callable.. but no parameters?

2015-04-20 Thread Vijay Khemlani
Overwrite the constructor of the form (__init__), pass the user or whatever
parameters you may need and overwrite the choices of the field in the body
of the method.

On Mon, Apr 20, 2015 at 10:56 PM, Steve Hiemstra 
wrote:

> I am trying to build a form with dynamic choices. e.g., the choices should
> depend on the user.
>
> https://docs.djangoproject.com/en/1.8/ref/forms/fields/#choicefield
>
> Says choices may now be a callable, and sure enough it is called in `
> django/forms/fields.py(818)` – but without any parameters.
>
> How can I get access to the current user, view, or any bit of context.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4a74be7f-e3cc-4e72-9a15-6a1ca43c9677%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1O%3DXvKT7G%3DkwW4TjZvLpT5iw%2BmdBkwux%2B5bGZkidxfiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Choices as a callable.. but no parameters?

2015-04-20 Thread Steve Hiemstra
I am trying to build a form with dynamic choices. e.g., the choices should 
depend on the user.

https://docs.djangoproject.com/en/1.8/ref/forms/fields/#choicefield

Says choices may now be a callable, and sure enough it is called in `
django/forms/fields.py(818)` – but without any parameters.

How can I get access to the current user, view, or any bit of context.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4a74be7f-e3cc-4e72-9a15-6a1ca43c9677%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread Erik Cederstrand

> Den 20/04/2015 kl. 19.46 skrev SHINTO PETER :
> 
> Working with linux/unix

If unix includes FreeBSD, check out 
https://www.freebsd.org/doc/en/books/handbook/security-resourcelimits.html

Erik

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/452CBB5B-7837-45A8-94B9-0CBBAA62ECAD%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread Tim Chase
On 2015-04-20 16:01, François Schiettecatte wrote:
> I did a little research on this and found cpulimit, you can also
> use nice and renice,

Yes, nice/renice and their I/O friend ionice (in my Debian
installation, it's part of the "util-linux" package) work quite
nicely.  It's the memory-limiting that I wish would work.

> and (on fedora core 21 at least) you can do
> 'cat /proc/###/status’ where ### is the process ID which will give
> you memory stats on a process. Not ideal but you can wrap all of
> these in some python to make it easier to manage. 

Yes, I suppose you could have a watch-dog that will monitor memory
usage and then kill the process.  I'd rather the process get an
out-of-memory error if it tried surpassing a set threshold (what
ulimit is *supposed* to do).

-tkc


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150420160642.62433676%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


upgrading from Django 1.6 and south to Django 1.8

2015-04-20 Thread Scott Hostovich
I'm upgrading from Django 1.6 and south to Django 1.8. 

Following the instructions 
at: 
https://docs.djangoproject.com/en/1.8/topics/migrations/#upgrading-from-south 
seems to work initially but then realize that the user model wasn't 
updated: 
https://github.com/django/django/tree/1.8/django/contrib/auth/migrations.

I am using a custom user model but it only tacks on a field and some 
properties. Anyone else come across this?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75e22f40-5beb-405c-8360-cb6a98e8f87f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


moving from Django 1.6 and south to Django 1.8 -- auth migrations not applied

2015-04-20 Thread Scott Hostovich
I moving from Django 1.6 and south to Django 1.8. I followed the 
instructions 
at 
https://docs.djangoproject.com/en/1.8/topics/migrations/#upgrading-from-south 
and things seemed to work fine. Then I noticed that the auth migrations did 
not get applied to the database 
(https://github.com/django/django/tree/1.8/django/contrib/auth/migrations).

Anyone else encounter this?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00a2fab4-c6bf-4936-80ec-bc4e38570d3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread François Schiettecatte
I did a little research on this and found cpulimit, you can also use nice and 
renice, and (on fedora core 21 at least) you can do 'cat /proc/###/status’ 
where ### is the process ID which will give you memory stats on a process. Not 
ideal but you can wrap all of these in some python to make it easier to manage. 

François

> On Apr 20, 2015, at 1:58 PM, Tim Chase  wrote:
> 
> On 2015-04-20 13:54, François Schiettecatte wrote:
>> Peter, why do you want to limit memory and CPU usage? To prevent
>> someone from killing the machine ?
> 
> I know I've wanted it to help prevent malicious data that could suck
> up my RAM and push things into swap.  Absent "ulimit -a", I've had to
> work around it with extra care to ensure that huge files or pessimal
> instructions don't drag my machine to the ground.
> 
> -tkc
> 
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/20150420125834.3faf7102%40bigbox.christie.dr.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47D4DCD3-F55D-41A2-A4D9-4B6746C7BEA9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread Tim Chase
On 2015-04-20 13:54, François Schiettecatte wrote:
> Peter, why do you want to limit memory and CPU usage? To prevent
> someone from killing the machine ?

I know I've wanted it to help prevent malicious data that could suck
up my RAM and push things into swap.  Absent "ulimit -a", I've had to
work around it with extra care to ensure that huge files or pessimal
instructions don't drag my machine to the ground.

-tkc


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150420125834.3faf7102%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread François Schiettecatte
Bummer, shows how long it has been since I have used that.

Peter, why do you want to limit memory and CPU usage? To prevent someone from 
killing the machine ?

F.

> On Apr 20, 2015, at 1:47 PM, Tim Chase  wrote:
> 
> On 2015-04-20 13:13, François Schiettecatte wrote:
>> You don’t say what platform you are running on, but on linux/unix
>> you can use ulimit, see http://ss64.com/bash/ulimit.html
> 
> I've wanted this occasionally, but "ulimit -m" doesn't appear to work
> on most modern Linux installations.  See
> 
> http://unix.stackexchange.com/questions/129587/does-ulimit-m-not-work-on-modern-linux
> 
> for more info.
> 
> I'm not sure *why* it was removed, as there have been times I wanted
> this functionality (I'm looking at you, Firefox, and your
> memory-gorging habits) so it would be awfully helpful to have
> around.  I also just tested "ulimit -m" on OpenBSD and it too seems
> to let the RSS of the process grow beyond the specified limit.  I've
> got a FreeBSD laptop around here that I could test as well if I can
> find the power adaptor.
> 
> -tkc
> 
> 
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/20150420124711.0f49d04d%40bigbox.christie.dr.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E8425E9D-C9B9-4474-B6BC-3B719C599D23%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread SHINTO PETER
Working with linux/unix

On Monday, 20 April 2015 22:44:17 UTC+5:30, François Schiettecatte wrote:
>
> You don’t say what platform you are running on, but on linux/unix you can 
> use ulimit, see http://ss64.com/bash/ulimit.html 
>
> François 
>
> > On Apr 20, 2015, at 1:09 PM, SHINTO PETER  > wrote: 
> > 
> > how to limit memory utilization for a particular python script ? 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/8bed3762-1dde-45e2-8573-4be58ab4d090%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9e12b909-40e2-48c5-9c7e-58918a4d7b2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread Tim Chase
On 2015-04-20 13:13, François Schiettecatte wrote:
> You don’t say what platform you are running on, but on linux/unix
> you can use ulimit, see http://ss64.com/bash/ulimit.html

I've wanted this occasionally, but "ulimit -m" doesn't appear to work
on most modern Linux installations.  See

http://unix.stackexchange.com/questions/129587/does-ulimit-m-not-work-on-modern-linux

for more info.

I'm not sure *why* it was removed, as there have been times I wanted
this functionality (I'm looking at you, Firefox, and your
memory-gorging habits) so it would be awfully helpful to have
around.  I also just tested "ulimit -m" on OpenBSD and it too seems
to let the RSS of the process grow beyond the specified limit.  I've
got a FreeBSD laptop around here that I could test as well if I can
find the power adaptor.

-tkc



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150420124711.0f49d04d%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Choices in DecimalField - django 1.8.

2015-04-20 Thread Elton Pereira
In the model below, using the Django admin, no matter what value I choose, 
it always displays the default value. But writes the correct value in the 
 database. Am I doing something wrong or is this a bug?

TENSAO_220 = Decimal(220)
TENSAO_110 = Decimal(110)
TENSOES = ((TENSAO_220, '220 volts'),
   (TENSAO_110, '110 volts'))

class Equipamento(models.Model):
nome = models.CharField(max_length=128)
  tensao = models.DecimalField(max_digits=8,
   decimal_places=3,
   choices=TENSOES,
   default=TENSAO_220)

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dae72145-de71-48b2-9fd8-33f010e11ee1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread François Schiettecatte
You don’t say what platform you are running on, but on linux/unix you can use 
ulimit, see http://ss64.com/bash/ulimit.html

François

> On Apr 20, 2015, at 1:09 PM, SHINTO PETER  wrote:
> 
> how to limit memory utilization for a particular python script ?
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/8bed3762-1dde-45e2-8573-4be58ab4d090%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/704F864E-CD2D-4A31-9D83-5E7BD35F83FA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Putting Limits on Memory and CPU Usage in python ?

2015-04-20 Thread SHINTO PETER
how to limit memory utilization for a particular python script ?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8bed3762-1dde-45e2-8573-4be58ab4d090%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Serialize QuerySet Q (not the result)

2015-04-20 Thread Vijay Khemlani
Are the queries associated with a certain form? Or they are arbitrary
queries?

On Mon, Apr 20, 2015 at 10:01 AM, guettli  wrote:

> We want to store the QuerySet query (not the result) some how.
>
> Background: users should be able to save a complex query as "my favorite
> query".
>
> Pickling querysets is possible, but version updates are not supported:
>
>
> https://docs.djangoproject.com/en/1.8/ref/models/querysets/#pickling-querysets
>
> Simple queries (without OR) could be saved as dictionary.
>
> I have in mind some mini language which enables to store Q object
> instances:
>
>  Q(foo='bar', blu='bla') | Q(foo='x', blu='y')
>
> And ordering 
>
> Before reinventing the wheel, I want to ask if someone has seen or done
> something like this before.
>
> I could not find an existing project. But maybe I used the wrong keywords
> for
> my favorite search engine.
>
> Regards,
>   Thomas Güttler
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3f75c38e-d2c9-480c-9103-e4ea1bad8f88%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3kEofK5gEe8e1xwFTTAnargxoj15sK_SrB1ax2y4o-WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about run bash scripts on Django-Python

2015-04-20 Thread Larry Martell
On Mon, Apr 20, 2015 at 10:31 AM, David Pineda  wrote:
> Hello
> I'm a begginner in django and i need to work with a form (send a file) and
> when the file it's ok run a bash scripts to process that.
>
> I investigate and the common recomendation si use 'subprocess'  an 'sys'
> So, i can set the path with de bash app, but the system only recognize the
> 'echo' command but the another like grep, awk or sed they say 'command not
> found'. eg:
>
> "home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 70: xlsx2csv: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 71: xlsx2csv: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 72: sed: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 73: sed: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 74: sed: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 77: awk: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 77: sed: command not found
> /home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
> line 79: sed: command not found"
>
> So,  i think the bin path it loose when i run from django, and in this point
> i'm confused.
>
> How to solve it?

You could specify the full path to the commands in your script, e.g.:
/usr/bin/sed, or where every they are on your system.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY74M2XCvuuYkHnqJr8sUNQyJ9Y69%2BUVUoisUTGL%2BSLRCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Question about run bash scripts on Django-Python

2015-04-20 Thread David Pineda
Hello
I'm a begginner in django and i need to work with a form (send a file) and
when the file it's ok run a bash scripts to process that.

I investigate and the common recomendation si use 'subprocess'  an 'sys'
So, i can set the path with de bash app, but the system only recognize the
'echo' command but the another like grep, awk or sed they say 'command not
found'. eg:

"home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 70: xlsx2csv: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 71: xlsx2csv: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 72: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 73: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 74: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 77: awk: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 77: sed: command not found
/home/david/Documents/WEB_PROJ/gestion_docs/procesa_fl/procesa_sse/extrac_data_oficial.sh:
line 79: sed: command not found"

So,  i think the bin path it loose when i run from django, and in this
point i'm confused.

How to solve it?

Thanks, very thanks!
-- 
David A. Pineda Osorio
F:+56 9 82142267
Ingeniero Civil Electricista
Universidad de Chile

*http://www.cultura-libre.cl/ *

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAn3imzaozSL-dGPT_U30AP_X4rqVx5cTFV1PMusE81nApHM_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cannot delete with overridden ModelAdmin.save_formset()

2015-04-20 Thread Carsten Fuchs

Hi all,

Am 20.04.2015 um 15:29 schrieb Carsten Fuchs:

I use a ModelAdmin.save_formset() method exactly like in the Django Admin 
documentation:
https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset

[...]

The problem is, if I check the "delete?" checkbox of an AUB inline instance in 
order to
delete it, there is no error, but the instance is not deleted.



Found the problem, along with suggested solution/improvement:
https://code.djangoproject.com/ticket/24668

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5535072D.7070406%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: Testing request parameters in Django (“+” behaves differently)

2015-04-20 Thread Eneko Illarramendi
Thank you Tom.

Somehow it seemed strange to test this view using client.get('/page/', {
'filter': 'one and two'})
but I get why it is like this.

Cheers,
Eneko


On Monday, April 20, 2015 at 3:30:55 PM UTC+2, Tom Evans wrote:
>
> On Sat, Apr 18, 2015 at 12:13 PM, Eneko Illarramendi 
>  wrote: 
> > Previously posted in SO: 
> > 
> http://stackoverflow.com/questions/29703930/testing-request-parameters-in-django-behaves-differently
>  
> > --- 
> > 
> > I have a Django View that uses a query parameter to so some content 
> > filtering. Something like this: 
> > 
> > /page/?filter=one+and+two 
> > /page/?filter=one,or,two 
> > 
> > I have noticed that Django converts the + to a space 
> > (request.GET.get('filter') returns one and two), and I´m OK with that. I 
> > just need to adjust the split() function I use in the View accordingly. 
>
> The arguments in a query string are urlencoded. Spaces are urlencoded 
> as '+'. Django's request.GET is a dict like object with the query 
> string arguments decoded. 
>
> > 
> > But... 
> > 
> > When I try to test this View, and I call: 
> > 
> > from django.test import Client 
> > client = Client() 
> > client.get('/page/', {'filter': 'one+and+two'}) 
>
> The test client takes a dictionary of raw strings, not urlencoded 
> strings. If you like, you are telling it to test the URL 
> '/page/?filter=one%2Band%2Btwo', as '+' is urlencoded as '%2B'. 
>
> Django is consistent, the test client takes raw un-encoded strings, 
> and request.GET delivers raw un-encoded strings. 
>
> Cheers 
>
> Tom 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/274a6eb9-dfa5-42ba-aff9-d564fad4e0c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Testing request parameters in Django (“+” behaves differently)

2015-04-20 Thread Tom Evans
On Sat, Apr 18, 2015 at 12:13 PM, Eneko Illarramendi
 wrote:
> Previously posted in SO:
> http://stackoverflow.com/questions/29703930/testing-request-parameters-in-django-behaves-differently
> ---
>
> I have a Django View that uses a query parameter to so some content
> filtering. Something like this:
>
> /page/?filter=one+and+two
> /page/?filter=one,or,two
>
> I have noticed that Django converts the + to a space
> (request.GET.get('filter') returns one and two), and I´m OK with that. I
> just need to adjust the split() function I use in the View accordingly.

The arguments in a query string are urlencoded. Spaces are urlencoded
as '+'. Django's request.GET is a dict like object with the query
string arguments decoded.

>
> But...
>
> When I try to test this View, and I call:
>
> from django.test import Client
> client = Client()
> client.get('/page/', {'filter': 'one+and+two'})

The test client takes a dictionary of raw strings, not urlencoded
strings. If you like, you are telling it to test the URL
'/page/?filter=one%2Band%2Btwo', as '+' is urlencoded as '%2B'.

Django is consistent, the test client takes raw un-encoded strings,
and request.GET delivers raw un-encoded strings.

Cheers

Tom

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Lt7hvVA3mzR%2BZ4-srnr3pAvuwSDWRfxe_uV%2B%3D5Zoohig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Cannot delete with overridden ModelAdmin.save_formset()

2015-04-20 Thread Carsten Fuchs

Dear Django fellows,

I use a ModelAdmin.save_formset() method exactly like in the Django Admin 
documentation:
https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset

This is the exact code:

def save_formset(self, request, form, formset, change):
if formset.model == AUB:
instances = formset.save(commit=False)

for instance in instances:
# For testing, intentionally do nothing else here!
instance.save()

formset.save_m2m()
else:
return super(StaffAdmin, self).save_formset(request, form, formset, 
change)


The problem is, if I check the "delete?" checkbox of an AUB inline instance in order to 
delete it, there is no error, but the instance is not deleted.


Why is this, and what can I do please?

Many thanks and 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5534FF21.6030303%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: Django Performance

2015-04-20 Thread jogaserbia
You might want to start by posting what you have learned so far (with some 
effort shown). Otherwise, you are asking people to complete your homework 
for you.  Otherwise, post most specific questions for clarification.  

On Saturday, April 18, 2015 at 8:52:13 AM UTC-4, Jasvir Singh wrote:
>
> Hi all. I have an school assignment in which I have to describe a
> piece of code of any open source software and I am going to write
> about django login function (django.contrib.auth.views). I have to add
> "Performance and Drawbacks" also. Can anyone please help me?
>
> I need to know how much efficient and secure django login system is.
> Is there any drawback of django login system?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8db64de1-d164-4dc5-bb50-4a3cc7f86dc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Serialize QuerySet Q (not the result)

2015-04-20 Thread guettli
We want to store the QuerySet query (not the result) some how.

Background: users should be able to save a complex query as "my favorite 
query".

Pickling querysets is possible, but version updates are not supported:

  
https://docs.djangoproject.com/en/1.8/ref/models/querysets/#pickling-querysets

Simple queries (without OR) could be saved as dictionary.

I have in mind some mini language which enables to store Q object instances:

 Q(foo='bar', blu='bla') | Q(foo='x', blu='y')

And ordering 

Before reinventing the wheel, I want to ask if someone has seen or done
something like this before.

I could not find an existing project. But maybe I used the wrong keywords 
for
my favorite search engine.

Regards,
  Thomas Güttler

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f75c38e-d2c9-480c-9103-e4ea1bad8f88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


JSON to relational database

2015-04-20 Thread ankit . rana
Hi everyone,
i had one json data like this to table say "data"
 
{
id:##,
name:{fname:##,lname:##},
class:##,
age:##,
courses:[###,###,###,###]
}

How to map this json data to a relational database??
i understand that only two things are possible :make fname and lname as a 
column of data table or make another table having foreign key and multiple 
courses.
what i want to know is that does django provide way to do it or i have to 
do it manually..because actual data with me is very big.. 
help me.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1028308-27d0-4523-8359-e0d5e2e5c872%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django, JavaScript, Python, HTML : Print on html a variable running on python file

2015-04-20 Thread Marc Patermann

Beatrice,

Beatrice Galvani schrieb (16.04.2015 17:34 Uhr):

Hi, I'm using Django 1.7.2, Python 3.4.

My trouble is: I have a simple function in some directory written in 
python (e.g. a counter since 0 to 10); I would like to see these numbers 
on my monitor on the HTML page.. I know how start the function but I am 
not able to print the variables!  

My formatted question is *HERE on Stack Overflow 
.*


I hope someone can help me , I do not know how to proceed.

noramlly you have a template for an URL.
The template is generated by a view.
Views are python functions.
- You should call your python function from a view, the function must
  return your variable to the view function.
- The view should return your variable to the template.
- The template should be able to display your variable.


Marc

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5534B816.3050507%40ofd-z.niedersachsen.de.
For more options, visit https://groups.google.com/d/optout.