Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Erik Cederstrand
> Den 12/08/2015 kl. 04.47 skrev yakkades...@gmail.com: > > for row in rows: > dp = DataPoint.objects.get(Taken_datetime=row['date']) > > sensorToAdd = [] > for sensor in sensors: > s = Sensor.objects.get(Name=sensor.name, Value=sensor.value ) > sensorToAdd.append( s

Supprimer un COMMIT sur git

2015-08-12 Thread Bassirou Ndiaye
Bonjour j'ai commité une une nouvelle application sur GIT avec django et je veux l'annuler Comment faire? -- 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 dj

Is it possible to specifyc validate_min and validate_max on contrib.Admin formset ? (From Django's code, it seems not)

2015-08-12 Thread boitoletre
Hi, I would need to enforce the max_num and min_num attributes of formsets on my admin pages at validation time. >From the documentation and the source, it seems that validate_max and validate_min would be the FormSet attributes that need to set to True for that to happen. Yet, while investi

ANN: eGenix mxODBC 3.3.4 - Python ODBC Database Interface

2015-08-12 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Python ODBC Database Interface Version 3.3.4 mxODBC is our commercially supported Python extension providing

Re: Generic forms (ModelForm) provide HTML for a form! Can generic views (DetailView) do same?

2015-08-12 Thread Bernd Wechner
OK, I give up, seriously dismayed that Django doesn't have this built in already I did as I threatened to and derived a class as follows: from django.utils import six from django.utils.safestring import mark_safe from django.utils.html import conditional_escape from django.utils.encoding import

Re: Generic forms (ModelForm) provide HTML for a form! Can generic views (DetailView) do same?

2015-08-12 Thread Mike Dewhirst
On 12/08/2015 8:54 PM, Bernd Wechner wrote: OK, I give up, seriously dismayed that Django doesn't have this built in already Well done Bernd! Welcome to open source. Unfortunately, I can't use your code unless it is part of Django. I have tried implementing my own improvements in the past but

Re: Console Routes With Django ??

2015-08-12 Thread Prabath Peiris
Looks like there is room for some new development. On Tuesday, August 11, 2015 at 3:29:55 PM UTC-4, Prabath Peiris wrote: > > Hi > > I am new to (kind of) Django framework and just finish the > Django-REST-framework tutorials and it looks really cool. I am a big fan of > ZendFramework2.0 (with

limit insert rows into model database

2015-08-12 Thread Tony Peña
Hi exist some settings to only insert X number of rows in a model? django.db. (i guess, restrict 5 rows) as simple way ? or setting directly into MySQL ? because, i override the save method to check if: # models.py class domain(model.Model): ... max_accounts = models.IntegerField(de

Re: Serving uploaded files from multiple storages

2015-08-12 Thread 'Hugo Osvaldo Barrera' via Django users
On Tue, Aug 11, 2015, at 23:10, Javier Guerra Giraldez wrote: > On Tue, Aug 11, 2015 at 6:17 PM, 'Hugo Osvaldo Barrera' via Django > users wrote: > > I've an app where files are uploaded to differente storages: > > > i would create a new storage object with a configuration that > associates som

Re: Problems installing a Django package

2015-08-12 Thread girish ramnani
Is wheel in latest version? Also your wheel package is installed in wheel in /usr/local/lib/python3.2/dist-packages but the django-muro-humoristas is being installed in /home/rompepc/.local/lib/python3.2/site-packages So have you activated a virtualenv ? Also i tried to installed a packa

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread yakkadesign
Hi Erik, In the actually code I create and preload all the DataPoints and Sensors outside the loop. I found a dict was too slow for DataPoints. I ended up sorting the DataPoints query by date and using the fact that they were in the same order as the CSV to speed things up. Looping through

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Erik Cederstrand
> Den 12/08/2015 kl. 20.00 skrev yakkades...@gmail.com: > > In the actually code I create and preload all the DataPoints and Sensors > outside the loop. I found a dict was too slow for DataPoints. That's suspicious. Compared to loading data from the database, Python dicts are not slow, for an

Re: Generic forms (ModelForm) provide HTML for a form! Can generic views (DetailView) do same?

2015-08-12 Thread Bernd Wechner
Mike, Thanks. This was just a quick hack ripped off from ModelForm (although not as quick as I'd have liked as reverse engineering never is and had to read through ModelForm and get my head around bits) In any case wouldn't be ready for adding to Django as is, but others could improve it to mee

1.8 RawSQL Parameter Issue

2015-08-12 Thread yongfeng
I'm using the new RawSQL class with annotate suggested by the django documentation. I noticed the second parameter the constructor takes is a tuple. When I used it in my project, however, I got a 'tuple object does not have attribute 'extend'' error. I looked at the trace back and source code,

Re: 1.8 RawSQL Parameter Issue

2015-08-12 Thread Tim Graham
Could you try adding a failing test case to Django's test suite based on your code in tests/expressions? On Wednesday, August 12, 2015 at 5:47:53 PM UTC-4, yong...@bloomsky.com wrote: > > I'm using the new RawSQL class with annotate suggested by the django > documentation. I noticed the second

Re: Supprimer un COMMIT sur git

2015-08-12 Thread reduxionist
On Wednesday, August 12, 2015 at 5:01:03 PM UTC+7, Bassirou Ndiaye wrote: > > Bonjour j'ai commité une une nouvelle application sur GIT avec django et > je veux l'annuler Comment faire? > Vous n'êtes pas sur la bonne liste, ici c'est du Django en anglais, ce n'est pas de git en français, mai

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread yakkadesign
I'll run a test with the dict vs list+position counter. I know I saw a speed improvement but I can't remember if that was the only thing I changed. I'd have to change a lot of code if I change the DB scheme so I'm not wanting to create an intermediate table. I'm going to go down the SQL pa

Re: Generic forms (ModelForm) provide HTML for a form! Can generic views (DetailView) do same?

2015-08-12 Thread Mike Dewhirst
On 13/08/2015 7:20 AM, Bernd Wechner wrote: Mike, Thanks. This was just a quick hack ripped off from ModelForm (although not as quick as I'd have liked as reverse engineering never is and had to read through ModelForm and get my head around bits) In any case wouldn't be ready for adding to Djang

Re: bulk add m2m relationship for multiple instances

2015-08-12 Thread Derek
This Python wiki (https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Choose_the_Right_Data_Structure) suggests: * Membership testing with sets and dictionaries is much faster, O(1), than searching sequences, O(n). When testing "a in b", b should be a set or dictionary instead of a list