-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
Add plugin support for apps.get_model()
#1725
base: master
Are you sure you want to change the base?
Conversation
Attempts to resolve the provided lazy reference to a model type. As such it can now return a specific model depending on what it was called with
Interestingly enough the test that is added doesn't fail locally... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
return None | ||
|
||
# Reference conforms to the structure of a lazy reference: '<app_label>.<object_name>' | ||
fullname = django_context.model_class_fullnames_by_label_lower.get(reference.lower()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question about lower
: why is that needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation is case insensitive:
Returns the Model with the given app_label and model_name. As a shortcut, this method also accepts a single argument in the form app_label.model_name. model_name is case-insensitive.
Ref: https://docs.djangoproject.com/en/4.2/ref/applications/#django.apps.apps.get_model
I really can't figure out how to reproduce locally.. @sobolevn would you mind checking out and try it, whenever you'd get a chance? |
Attempts to resolve the provided lazy reference to a model type. As such it can now return a specific model depending on what it was called with
Related issues
Closes: #1318
Closes: #304
Closes: #305
Closes: #814
High value comment/discussion: #814 (comment)