Re: static models methods

2009-10-26 Thread Daniel Roseman
On Oct 26, 4:22 pm, Alessandro Ronchi wrote: > I need to create a static method for a model class like this. The line > Settore.objects.all()[0].id gives error  ( > psycopg2.InternalError: current transaction is aborted) when creating > the tables at first syncdb. What's the correct way to do tha

Re: static models methods

2009-10-26 Thread Bill Freeman
I have to wonder whether "get_default" is a name that already means something to Django. On Mon, Oct 26, 2009 at 12:22 PM, Alessandro Ronchi wrote: > > I need to create a static method for a model class like this. The line > Settore.objects.all()[0].id gives error  ( > psycopg2.InternalError: cu

Re: static models methods

2009-10-26 Thread Ethan Jucovy
I don't know what the error means, but this looks like the sort of thing you might want to put on a custom Manager instead -- then you could say `Settore.objects.get_default()`. http://docs.djangoproject.com/en/dev/topics/db/managers/#topics-db-managers (I have a feeling the error wouldn't happe