Created
March 18, 2020 04:23
-
-
Save ychennay/341149f110796ca52ff5c9cef6cce229 to your computer and use it in GitHub Desktop.
Abstract
This file contains 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
if abstract: | |
# Abstract base models can't be instantiated and don't appear in | |
# the list of models for an app. We do the final setup for them a | |
# little differently from normal models. | |
attr_meta.abstract = False | |
new_class.Meta = attr_meta | |
return new_class | |
new_class._prepare() | |
new_class._meta.apps.register_model(new_class._meta.app_label, new_class) | |
return new_class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment