field_object.rel.model.objects.filter(**db_condition)

 

报错

AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

 

 

forekey中存在rel,为什么不能调用?

AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

 

 AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

 

 通过以下语句观察

print(field_object)
print(type(field_object))
print(db_condition)
print(field_object.__dic__)

AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

故:

self.remote_field = rel

 

 sSO 将rel改成remote_field即可

          
field_object.remote_field.model.objects.filter(**db_condition)
field_object.rel.model.objects.filter(**db_condition)

 

报错

AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

 

 

forekey中存在rel,为什么不能调用?

AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

 

 AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

 

 通过以下语句观察

print(field_object)
print(type(field_object))
print(db_condition)
print(field_object.__dic__)

AttributeError: 'ForeignKey' object has no attribute 're' 解决办法
    





		
使用

故:

self.remote_field = rel

 

 sSO 将rel改成remote_field即可

          
field_object.remote_field.model.objects.filter(**db_condition)

相关文章: