Skip to content
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

Forward class creation keyword arguments #2627

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions peewee.py
Expand Up @@ -6268,9 +6268,9 @@ class ModelBase(type):
'only_save_dirty', 'legacy_table_names',
'table_settings', 'strict_tables'])

def __new__(cls, name, bases, attrs):
def __new__(cls, name, bases, attrs, **kwargs):
if name == MODEL_BASE or bases[0].__name__ == MODEL_BASE:
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
return super(ModelBase, cls).__new__(cls, name, bases, attrs, **kwargs)

meta_options = {}
meta = attrs.pop('Meta', None)
Expand Down Expand Up @@ -6310,7 +6310,7 @@ def __new__(cls, name, bases, attrs):
Schema = meta_options.get('schema_manager_class', SchemaManager)

# Construct the new class.
cls = super(ModelBase, cls).__new__(cls, name, bases, attrs)
cls = super(ModelBase, cls).__new__(cls, name, bases, attrs, **kwargs)
cls.__data__ = cls.__rel__ = None

cls._meta = Meta(cls, **meta_options)
Expand Down