Problems with removing South after upgrading to 1.7

2014-09-04 Thread Koed00
Not sure if this is a bug , so I'll report it here. After upgrading to Django 1.7 and running all the migrations, I removed South from the installed apps. This led to to this error popping up on every migration: duplicate key value violates unique constraint >

Re: Django admin list sort error

2014-09-04 Thread Collin Anderson
try sorting by place__name instead. -- 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

Re: Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread Simon Charette
The following should do: Item.objects.bulk_create([ Item(pool_cd=pool_cd.unique_code) for pool_cd in pool_cds ]) Le jeudi 4 septembre 2014 12:44:08 UTC-4, James P a écrit : > > I forgot to include the code where I set the pool codes to NOTFREE, here > is the whole snippet. > >

Re: Django admin list sort error

2014-09-04 Thread Derek
Well, this is an "internal" project ... but a "translation" of some of the fields of some of the models would look something those below (NB this is a subset with just a few models - and any 'grammatical' errors are from the "translation" - the originals work perfectly in every respect except for

RE: Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread James Schneider
I believe it does, all you do is provide a list of lazily populated models (as if you were going to create them one by one) and give it to bulk_create. This SO post has a pretty good write up in the accepted answer, along with a few other options that may save you some time:

Re: Django admin list sort error

2014-09-04 Thread Collin Anderson
do you want to paste in your models? -- 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

Re: static files

2014-09-04 Thread Dariusz Mysior
Ok I set it :) W dniu środa, 3 września 2014 20:01:26 UTC+2 użytkownik Dariusz Mysior napisał: > > I have my path like below: > > home > darmys > > dom >

Re: Long-term support (LTS)

2014-09-04 Thread Collin Anderson
It hasn't been decided yet, and it's not necessarily 1.7. See the thread on django-developers. https://groups.google.com/d/topic/django-developers/KweKHgdIiz0/discussion -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: static files

2014-09-04 Thread Dariusz Mysior
I dont't understand Now I have like You said and it's not work. I try with app name and without. W dniu środa, 3 września 2014 20:01:26 UTC+2 użytkownik Dariusz Mysior napisał: > > I have my path like below: > > home > darmys >

Re: Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread James P
The issue is that a bulk create doesn't allow me to use my unique values for each create which I need from the code pool. Does it? On Thursday, September 4, 2014 10:42:52 AM UTC-6, James Schneider wrote: > > You probably want to look at bulk_create and do all of the inserts as a > single query:

Re: Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread James P
I forgot to include the code where I set the pool codes to NOTFREE, here is the whole snippet. code_count=5000 pool_cds = CodePool.objects.filter(free_indicator=True)[:code_count] for pool_cd in pool_cds: new_item = Item.objects.create(

Re: Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread James Schneider
You probably want to look at bulk_create and do all of the inserts as a single query: https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create This will probably be seconds, if not minutes faster. -James On Thursday, September 4, 2014, James P wrote: > I

Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread James P
I have what is essentially a table which is a pool of available codes/sequences for unique keys when I create records elsewhere in the DB. Right now I run a transaction where I might grab 5000 codes out of an available pool of 1 billion codes using the slice operator [:code_count] where

Re: Catching AttributeError exceptions in widget media

2014-09-04 Thread Zachary McCord
I simply didn't believe it at first, but sure enough, in python 2.7: >>> class Bomb(object): ... def __getattr__(self, id): ... assert False ... >>> bomb = Bomb() >>> bomb.foo Traceback (most recent call last): File "", line 1, in File "", line 3, in __getattr__

Re: Catching AttributeError exceptions in widget media

2014-09-04 Thread Collin Anderson
believe it or not, hasattr is the same as: try: getattr(obj, name) return True except: # yikes! naked except! return False https://docs.python.org/2/library/functions.html#hasattr So, excepting AttributeError will at least narrow down the error slightly, rather than hasattr

django DecimalField and scientific notation when displayed

2014-09-04 Thread Michael
Hello, How to display the DecimalField without the E (scientific) notation in the django admin? Here is my field: models.DecimalField(max_digits=12, decimal_places=8, null=True) Here is what I see in the admin: 0E-8.# on the table 0E-8 # in the form

Re: Django admin list sort error

2014-09-04 Thread Derek
No one else? Strange... The closest related issue I could find"out there" relates to the way that the MySQLdb cursor returns its results i.e. with the tablename prefixes stripped off. So fields called 'name' or 'code' (that commonly appear in many tables) all now clash with each other. I

Models inside tests - Django 1.7 problem

2014-09-04 Thread galgal
Hi, I'm trying to port my project to use Django 1.7. Everything is fine except 1 thing. Models inside tests folders. Django 1.7 new migrations run *migrate* command internally. Before *syncdb *was ran. That means if a model is not included in migrations - it won't be populated to DB (and also

Long-term support (LTS)

2014-09-04 Thread Philippe O. Wagner
Hi all, Django 1.4 is the current Long-term support (LTS) release that lasts until end of March 2015. I am curious which is the next LTS release? Is it Django 1.7? Regards, Philippe -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: ORM performance

2014-09-04 Thread Michael P. Soulier
On 04/09/14 Benjamin Scherrey said: > The short answer to your question is no, the Django ORM is not inherently > slower in that regard and it's very likely something you're doing. The Given that it's basically for obj in foo.objects.all(): obj.prop = new_value obj.save() I fail to see

Re: ORM performance

2014-09-04 Thread Michael P. Soulier
On 03/09/14 Tom Lockhart said: > I haven't had to deal with this myself, but the speed difference smacks of > transactional issues. If you can run your loop by wrapping all of it or > pieces of it (say, 100 or 1000 chunks) in a single transaction you'll > probably see some significant speedup.

Re: ORM performance

2014-09-04 Thread Michael P. Soulier
On 04/09/14 Tom Evans said: > Is the update invariant? By using the ORM like this: As I said, each update is unique and they cannot be batched. > Are both Django and the sqlalchemy doing the same sort of update? Yes. Identical. Mike -- You received this message because you are subscribed to

Re: celery problems

2014-09-04 Thread Tom Evans
On Tue, Sep 2, 2014 at 7:43 PM, Dima wrote: > The question is not really about Django, but can someone faced. Trying to > run on the server - > /manage.py celeryd -l INFO > > output > Running a worker with superuser privileges when the > worker accepts messages serialized with

Re: ORM performance

2014-09-04 Thread Tom Evans
On Thu, Sep 4, 2014 at 12:22 AM, msoulier wrote: > Hi, > > I am looking at Django's performance with respect to modifying large numbers > of objects, each in a unique way that cannot be batched. If I make a simple > change to one of my Django models and save(), and then

Re: static files

2014-09-04 Thread Tom Evans
On Wed, Sep 3, 2014 at 10:32 PM, Collin Anderson wrote: > it should be relative do your /static/ directory like so: > > {% static "images/pilka.jpg" %} > Alternatively, it is good to include the app name in the static path, so it might be better to move the file to

Re: How do I save an object under two different classes using the admin page

2014-09-04 Thread Alex Chiaranda
Hi, in your admin.py you can implement your own version for the save_model function. Follow the documentation: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model Regards, On Wednesday, September 3, 2014 3:36:42 PM UTC-3, Alejandro Greppi

Re: Catching AttributeError exceptions in widget media

2014-09-04 Thread Michael Jones
Hi, Thanks for the reply, but I'm not sure I follow. I was hoping that the following might work: if hasattr(sup_cls, 'media'): base = sup_cls.media else: base = Media() Would that swallow additional exceptions? Cheers, Michael On Wednesday, September 3, 2014 10:45:22

Free Course on Django - From Essentials to Advance Topics

2014-09-04 Thread MelbDjango School
MelbDjango School is giving a free course on Django. The classes are going to be fortnightly starting Sep. 11. They will be going through the essentials of Django to advance topics. The course will be given by leading Django Developers in the industry. Please bring a laptop and your