fj~,71 r d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZ G d d e Z
dS )
)absolute_importN)BaseChecker)check_messages)IAstroidChecker)BASE_ID)
foreignkeyc e Zd ZdZdZefZdZdddddd ffZd
e ddd
efde ddiZ
fdZd Z e
d
d Z xZS )ForeignKeyStringsCheckera<
Adds transforms to be able to do type inference for model ForeignKeyField
properties which use a string to name the foreign relationship. This uses
Django's model name resolution and this checker wraps the setup to ensure
Django is able to configure itself before attempting to use the lookups.
a/ Finding foreign-key relationships from strings in pylint-django requires configuring Django.
This can be done via the DJANGO_SETTINGS_MODULE environment variable or the pylint option django-settings-module, eg:
`pylint --load-plugins=pylint_django --django-settings-module=myproject.settings`
. This can also be set as an option in a .pylintrc configuration file.
Some basic default settings were used, however this will lead to less accurate linting.
Consider passing in an explicit Django configuration file to match your project to improve accuracy.z)Django foreign keys referenced by stringszdjango-settings-moduleNstringz