def hosts(self, create, extracted, **kwargs):
if not create:
return
if extracted:
for host in extracted:
self.hosts.add(host)Вот так создаю объекты
factories.TaskTemplateFactory.create(hosts=(host_with_test, ), host_groups=(group_with_test, ))На выхлопе получаю вот такое
ValueError: "<TaskTemplate: Test name task template>" needs to have a value for field "tasktemplate" before this many-to-many relationship can be used.Что делаю не так?
Тут же ответ: needs to have a value for field "tasktemplate" before this many-to-many relationship can be used
Обсуждают сегодня