-
Notifications
You must be signed in to change notification settings - Fork 103
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
Custom API key model w/o default APIKey
table or admin
#180
Comments
Hi @virogenesis, I am not sure I understood your question. You might need to expand on your use case with as many specifics as necessary. But trying to understand, do you mean…
In the first case, does not installing the app suffice? In the latter case, have you explored Meta.managed?
|
This is correct.
This is false, I would just like to upgrade the model on top of the AbstractAPIKey.
It does not, because when I inherit from models.py if the app is not installed, I get a not installed error because the ApiKey gets imported:
Sure, I am aware of the managed False, can't see how it would help me :) Hope that this clears up the question, thanks for the quick reply! |
@virogenesis Thanks. Do you have some realistic sample code to illustrate what you'd like to do? I'm trying to be helpful, but I'm still not sure what "upgrade the model on top of |
Sure thing, I will test, fork, make a pull request, and i'm sure it will click. PR's speak a thousand words :) Thanks |
I have a similar need here. Would like to
Not installing the app causes a similar error as discussion above: Is there a way to do that? Thanks! |
Experiencing the same issue as @stpddream. +1 for a feature that would allow replacing the default API key with a customized version. |
My idea was to move away the abstractModel into a different python file, so that including the AbstractModel wouldn't trigger django's models.py RuntimeError for app not installed. It should be fairly easy to implement, but when I checked out the tests suite I think I will need to employ a bit of refactoring in order to test this functionality. Basically if I remember correctly I was a bit confused with conftest configuring installed_apps, as well as settings.py in the test application. perhaps @florimondmanca can advise. I would need a test case scenario where we use heroes project, with and without |
oh, test_project is not a part of the test suite, it's only for documentation purposes. |
@virogenesis Right — the entire |
So, if I understand correctly, the need here would be that in cases where one only uses custom models, and doesn't need the default |
@florimondmanca Thank you for the write-up. This is 100% correct for my use case.
You are right, currently, it is possible to unregister the default Please note, that I am willing to help with the implementation if needed. |
question I may have is, will leaving out the entire app from installed_apps be sufficient for future features. In case so then my approach will be sufficient, otherwise we may need to add some configuration flag that decides whether admin will get registered and model created in the database schema. |
I think there's a parallel to explore with There, we've got…
… Should we be considering an Edit: turns out there's an unofficial project with guidelines on implementing swappable models — https://github.com/openwisp/django-swappable-models. It's much simpler for us since we don't ship models that link to |
I think we'd also want to remove the |
APIKey
table or admin
I would like to be able to inherit AbstractAPIKey directly from the model, without having to reference it via foreignkey, and also I would like django, to not create these tables at all:
I would like to:
Inherit the Abstract class, without having to reference the model.
I would solve it by:
Not installing the app at all, if we migrated the code of the abstract base class away from models.py, we would be able to inherit without problems.
The text was updated successfully, but these errors were encountered: