Creating JSON file

2013-04-08 Thread Seth Gordon
You want to output a list of one dict per object, and you want that dict to contain another dict inside it. So you don’t need dict2. Instead f = file('report.json','a+') sys.stdout = f result = [] objects = game_objects.objects.all() for obj in objects: time =

Re: removing the source of a OneToOneField relationship

2011-05-04 Thread Seth Gordon
On 05/04/2011 12:43 AM, Andy McKay wrote: > > On 2011-05-03, at 2:05 PM, Seth Gordon wrote: >> I get an exception, complaining that Target.source does not allow >> null values. > > You'll probably want to allow null values on your OneToOne field then: > > http:/

removing the source of a OneToOneField relationship

2011-05-03 Thread Seth Gordon
I have one Django model that points to another one with a OneToOneField, sort of like this: class Target(models.model): # stuff class Source(models.Model): target = models.OneToOneField(Target) Sometimes, given an object that is an instance of Target, I want to navigate to its Source

Re: Japanese Text Sort Order

2011-01-05 Thread Seth Gordon
On 01/05/2011 07:57 AM, James Hancock wrote: > I think it does the same thing, but I was talking about how you cant set > 'ordering' under the Meta class in a model. > http://docs.djangoproject.com/en/1.2/ref/models/options/#django.db.models.Options.ordering > >

Re: django test framework with no models.py

2010-12-30 Thread Seth Gordon
On 12/27/2010 09:58 AM, Henrik Genssen wrote: > Hi, > > I wanted to write a test for an app, that does not have a models.py itself. > Doing so I get: > django.core.exceptions.ImproperlyConfigured: App with label service could not > be found > > if I create a models.py with just a "pass" in it