Python django.db.models.options.DEFAULT_NAMES Examples
The following are 1
code examples of django.db.models.options.DEFAULT_NAMES().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.db.models.options
, or try the search function
.
Example #1
Source File: __init__.py From django-cassandra-engine with BSD 2-Clause "Simplified" License | 5 votes |
def add_to_class(cls, name, value): django_meta_default_names = options.DEFAULT_NAMES # patch django so Meta.get_pk_field can be specified these models options.DEFAULT_NAMES = django_meta_default_names + ('get_pk_field',) # We should call the contribute_to_class method only if it's bound if not inspect.isclass(value) and hasattr(value, 'contribute_to_class'): value.contribute_to_class(cls, name) else: try: setattr(cls, name, value) except AttributeError: raise AttributeError('failed to set attribute {}'.format(name)) options.DEFAULT_NAMES = django_meta_default_names