我在两个相互导入的文件中有两个模型。其中一个通过外键连接到另一个。为了避免循环导入,我试图在引号中定义外键:
from pubscout.models import Campaign
class RuleSuite(models.Model):
campaign = models.ForeignKey('Campaign', verbose_name="Кампания")
之前在其他型号上有效,但这次我收到错误:
...
...
File "/Users/1111/.virtualenvs/django_cpa/lib/python2.7/site-packages/django/contrib/admin/checks.py", line 719, in _check_list_filter_item
get_fields_from_path(model, field)
File "/Users/1111/.virtualenvs/django_cpa/lib/python2.7/site-packages/django/contrib/admin/utils.py", line 479, in get_fields_from_path
parent = get_model_from_relation(fields[-1])
File "/Users/1111/.virtualenvs/django_cpa/lib/python2.7/site-packages/django/contrib/admin/utils.py", line 430, in get_model_from_relation
return field.get_path_info()[-1].to_opts.model
File "/Users/1111/.virtualenvs/django_cpa/lib/python2.7/site-packages/django/db/models/fields/related.py", line 661, in get_path_info
opts = self.remote_field.model._meta
AttributeError: 'unicode' object has no attribute '_meta'
我应该在哪里修理它?
答案 0 :(得分:0)
您需要使用应用程序标签限定模型名称:
$file_url