Skip to content

Instantly share code, notes, and snippets.

@ychennay
Created March 18, 2020 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ychennay/341149f110796ca52ff5c9cef6cce229 to your computer and use it in GitHub Desktop.
Save ychennay/341149f110796ca52ff5c9cef6cce229 to your computer and use it in GitHub Desktop.
Abstract
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