-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not handle ForeignKey model fields #21
Comments
carlio
added a commit
that referenced
this issue
Sep 24, 2014
carlio
added a commit
that referenced
this issue
Sep 24, 2014
… OneToOneField attributes on model classes with an AST node representing the type they "point" to. This will remove all of the "instance of ForeignKey has no attribute X" warnings. In addition, unused import warnings for OneToOneField and ForeignKey have been suppressed, as by replacing the AST node, pylint has no way of knowing that the imports really are used. This is not a perfect solution, as it will suppress genuine unused import warnings, and so may need to be revisited in the future
This was referenced Jul 16, 2017
This fixes only for the first time an attribute is called, not if you have multiple methods e.g. @property
def name(self):
return self.item.name
@property
def category(self):
return self.item.category.name
@property
def family(self):
return self.item.category.family
@property
def outlet_category(self):
return OutletCategory.objects.get(category=self.item.category, outlet=self.outlet).id the category, family and outlet_category will raise the error. |
@ysfjwd please open a new issue for your problem and post the entire model class which reproduces the issue and all error logs that you have. What you've given is not enough to reproduce since I have no idea what |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A
ForeignKey
field on a model results in logs of "instance of ForeignKey has no member x" warnings as pylint does not know that Django swaps out the attribute.The text was updated successfully, but these errors were encountered: