Created
June 6, 2019 11:34
-
-
Save caramelchocolate/ec109a6beedb3f85adf5593b54936515 to your computer and use it in GitHub Desktop.
modelsでproxyを使った場合のadmin.ModelAdmin周りのコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| """ | |
| admin側ではproxyなどを使うと __str__ がうまく継承されない。 | |
| 単純に継承したほうがいいかも。 | |
| """ | |
| @admin.register(parendeModel) | |
| class parentAdmin(admin.ModelAdmin): | |
| pass | |
| class derivedAdmin(parentAdmin): | |
| form = derivedForm | |
| admin.site.register(derivedModel, derivedAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment