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)

相关文章:

  • 2021-06-28
  • 2021-08-03
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2021-12-24
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-06-26
相关资源
相似解决方案