def setUp(self): target = ForeignKeyTarget(name='target-1') target.save() for idx in range(1, 4): if idx == 3: target = None source = NullableForeignKeySource(name='source-%d' % idx, target=target) source.save()
def setUp(self): target = ForeignKeyTarget(name='target-1') target.save() new_target = ForeignKeyTarget(name='target-2') new_target.save() for idx in range(1, 4): source = ForeignKeySource(name='source-%d' % idx, target=target) source.save()
def setUp(self): """ Create 3 BasicModel instances. """ items = ['foo', 'bar', 'baz'] for item in items: t = ForeignKeyTarget(name=item) t.save() ForeignKeySource(name='source_' + item, target=t).save() self.objects = ForeignKeySource.objects self.data = [ {'id': obj.id, 'name': obj.name} for obj in self.objects.all() ] self.view = FKInstanceView.as_view()
def setUp(self): """ Create 3 BasicModel instances. """ items = ['foo', 'bar', 'baz'] for item in items: t = ForeignKeyTarget(name=item) t.save() ForeignKeySource(name='source_' + item, target=t).save() self.objects = ForeignKeySource.objects self.data = [{ 'id': obj.id, 'name': obj.name } for obj in self.objects.all()] self.view = FKInstanceView.as_view()
def setUp(self): target = ForeignKeyTarget(name="target-1") target.save() new_target = ForeignKeyTarget(name="target-2") new_target.save() for idx in range(1, 4): source = ForeignKeySource(name="source-%d" % idx, target=target) source.save()