We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When accessing model's field, DescriptorWrapper returns itself as an object, which breaks the logic. See more in examples.
DescriptorWrapper
class A(models.Model): pass class B(models.Model): x = models.ForeignKey(A, on_delete=models.CASCADE) tracker = FieldTracker(fields=["x"]) # This throws B.x.get_queryset()
The text was updated successfully, but these errors were encountered:
Also happens with B.x.field, the wrapper breaks anything that introspects models
B.x.field
Sorry, something went wrong.
This works fwiw
from model_utils.tracker import DescriptorWrapper @property def field(self): return self.descriptor.field @property def get_queryset(self): return self.descriptor.get_queryset DescriptorWrapper.field = field DescriptorWrapper.get_queryset = get_queryset
I am really not sure what's going on with DescriptorWrapper or why it doesn't quack like a duck if it's wrapping fields.
I am kind of surprised this doesn't cause more issues, you'd think lots of things would access .field.
.field
@lucaswiman any suggestions? would this be a reasonable addition to DescriptorWrapper?
def __getattr__(self, attr): return getattr(self.descriptor, attr)
No branches or pull requests
Problem
When accessing model's field,
DescriptorWrapper
returns itself as an object, which breaks the logic. See more in examples.Environment
Code examples
The text was updated successfully, but these errors were encountered: