示例#1
0
 def __init__(self, *fields, **kwargs):
     django_compositekey_patch()
     self.is_composite_primarykeys_field = True
     kwargs['primary_key'] = True
     self._field_names = fields
     assert isinstance(self._field_names, (list, tuple)) and len(self._field_names) > 0, \
            "%ss must have fields=[..] with at least 2 fields" % self.__class__.__name__
     kwargs['blank'] = True
     kwargs['serialize'] = False
     super(MultiFieldPK, self).__init__(**kwargs)
示例#2
0
 def __init__(self, *fields, **kwargs):
     django_compositekey_patch()
     self.is_composite_primarykeys_field = True
     kwargs['primary_key'] = True
     self._field_names = fields
     assert isinstance(self._field_names, (list, tuple)) and len(self._field_names) > 0, \
            "%ss must have fields=[..] with at least 2 fields" % self.__class__.__name__
     kwargs['blank'] = True
     kwargs['serialize'] = False
     super(MultiFieldPK, self).__init__(**kwargs)
# This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more information:
#
# http://docs.djangoproject.com/en/dev/internals/contributing/#unit-tests
#
# The different databases that Django supports behave differently in certain
# situations, so it is recommended to run the test suite against as many
# database backends as possible.  You may want to create a separate settings
# file for each of the backends you test against.

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir, "src"))


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3'
    },
    'other': {
        'ENGINE': 'django.db.backends.sqlite3',
    }
}

from compositekey.patch import django_compositekey_patch
django_compositekey_patch()
# This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more information:
#
# http://docs.djangoproject.com/en/dev/internals/contributing/#unit-tests
#
# The different databases that Django supports behave differently in certain
# situations, so it is recommended to run the test suite against as many
# database backends as possible.  You may want to create a separate settings
# file for each of the backends you test against.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3'
    },
    'other': {
        'ENGINE': 'django.db.backends.sqlite3',
    }
}

SECRET_KEY = "django_tests_secret_key"

from compositekey.patch import django_compositekey_patch
django_compositekey_patch()