Django-viewflow - 保持模型与流程流分离

时间:2018-03-19 02:00:28

标签: django-viewflow

此问题由designing models in django-viewflow

触发

在保持模型与视图流程分离的同时,获得以下错误 -

File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/related.py", line 625, in resolve_related_fields raise ValueError('Related model %r cannot be resolved' % self.remote_field.model) ValueError: Related model'mymodel.MyModel' cannot be resolved 

以下是我的模型和视图流程流程模型类

MyModel(models.Model): 
   field1 = models.IntegerField(default=None) 
   field2 = models.IntegerField(default=None) 
   field3 = models.CharField(null=True, max_length=60, default=None) 
   approved = models.BooleanField(default=False) approved_at = models.DateTimeField(null=True) 

1 个答案:

答案 0 :(得分:0)

创建了一个单独的迁移脚本(appname_initial_01.py),其中包含' mymodel'的详细信息。并在包含' MyProcess'的迁移脚本(appname_initial_02.py)的依赖列表中引用它。解决了这个问题。

dependencies = [
    ('appname', 'appname_initial_01'),
]