Skip to content

Commit

Permalink
model hook
Browse files Browse the repository at this point in the history
  • Loading branch information
nitely committed Jun 13, 2016
1 parent fbe6067 commit 127107a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions hooks/modelhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def __init__(self):
@property
def plugins(self):
"""
Create a new class dynamically,\
inheriting all registered plugins.
Create a new abstract model class\
dynamically, inheriting all registered\
plugins.
This is similar to::
Expand All @@ -45,11 +46,11 @@ class MyAppModel(*plugins, ...):
class Meta:
abstract = True

# Convert to whatever str is
# to make it compatible with
# py2 and py3
# Convert strings to whatever
# str is to make it compatible
# with py2 and py3
return type(
str('Plugins'),
str('PluginsAbstractModel'),
tuple(self._registry) + (models.Model, ), # bases
{
str('__module__'): self.__module__,
Expand Down

0 comments on commit 127107a

Please sign in to comment.