File: settings_ddf.py

package info (click to toggle)
python-django-dynamic-fixture 4.0.1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 616 kB
  • sloc: python: 3,909; makefile: 237; sh: 6
file content (47 lines) | stat: -rw-r--r-- 1,373 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from distutils.version import StrictVersion
import django
DJANGO_VERSION = django.get_version()[0:3]

DEBUG = True

IMPORT_DDF_MODELS = True

SECRET_KEY = 'ddf-secret-key'

ALLOWED_HOSTS = ['*'] # Since Django 1.11, it is verified when running tests


INSTALLED_APPS = ()

INSTALLED_APPS += (
    'queries',
    'django_dynamic_fixture',
    'django.contrib.contenttypes',
)
try:
    import polymorphic
    INSTALLED_APPS += ('polymorphic',)
except ImportError:
    pass


# EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
# EMAIL_FILE_PATH = '/tmp/invest-messages'  # change this to a proper location
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# python manage.py test --with-coverage --cover-inclusive --cover-html --cover-package=django_dynamic_fixture.* --with-queries --with-ddf-setup


# To avoid warnings
MIDDLEWARE_CLASSES = ()

# Example of DDF plugins for Custom fields
import json
DDF_FIELD_FIXTURES = {
    'django_dynamic_fixture.models_test.CustomDjangoField': {'ddf_fixture': lambda: 123456789},
    'django_dynamic_fixture.models_test.CustomDjangoField2': lambda: 987654321,

    # https://github.com/bradjasper/django-jsonfield
    'jsonfield.fields.JSONCharField': {'ddf_fixture': lambda: json.dumps({'some random value': 'c'})},
    'jsonfield.fields.JSONField': {'ddf_fixture': lambda: json.dumps([1, 2, 3])},
}