Пример #1
0
 def _build_instance(self, model, kwargs, objs, create):
     if kwargs is not None:
         obj = create_instance(model, **kwargs)
     else:
         obj = create_instance(model)
     if create:
         obj.save()
     objs.append(obj)
Пример #2
0
 def _build_instance(self, model, kwargs, objs, create):
     if kwargs is not None:
         obj = create_instance(model, **kwargs)
     else:
         obj = create_instance(model)
     if create:
         obj.save()
     objs.append(obj)
    def setUp(self):
        self.model_one = create_instance(ModelOne)

        if PY3:
            self.basestring = (str, bytes)
        else:
            self.basestring = basestring
Пример #4
0
    def setUp(self):
        self.model_one = create_instance(ModelOne)

        if PY3:
            self.basestring = (str, bytes)
        else:
            self.basestring = basestring
 def setUp(self):
     self.model_one = create_instance(ModelOne)
     self.model_two_rand = create_instance(ModelTwo)
     self.model_two_kwarg = create_instance(ModelTwo,
                                            foreign_key=self.model_one)
Пример #6
0
 def setUp(self):
     self.model_one = create_instance(ModelOne)
     self.model_two_rand = create_instance(ModelTwo)
     self.model_two_kwarg = create_instance(
         ModelTwo, foreign_key=self.model_one)
Пример #7
0
 def _handle_build(self, *args):
     model, kwargs_iter = self._resolve_args(*args)
     return (create_instance(model, **(kwargs if kwargs else {}))
             for kwargs in kwargs_iter)