This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move test models to test_app, add migrations, fix tests
- Loading branch information
1 parent
42aa4c7
commit aee8dee
Showing
24 changed files
with
182 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 4.1 on 2022-09-02 20:04 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
import timedelta.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="MinMaxTestModel", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"min", | ||
timedelta.fields.TimedeltaField( | ||
min_value=datetime.timedelta(days=1) | ||
), | ||
), | ||
( | ||
"max", | ||
timedelta.fields.TimedeltaField( | ||
max_value=datetime.timedelta(days=1) | ||
), | ||
), | ||
( | ||
"minmax", | ||
timedelta.fields.TimedeltaField( | ||
max_value=datetime.timedelta(days=7), | ||
min_value=datetime.timedelta(days=1), | ||
), | ||
), | ||
], | ||
), | ||
] |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
from django.db import models | ||
from timedelta.fields import TimedeltaField | ||
import datetime | ||
|
||
|
||
class MinMaxTestModel(models.Model): | ||
min = TimedeltaField(min_value=datetime.timedelta(1)) | ||
max = TimedeltaField(max_value=datetime.timedelta(1)) | ||
minmax = TimedeltaField(min_value=datetime.timedelta(1), max_value=datetime.timedelta(7)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
""" | ||
Django settings for test_project project. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/1.7/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/1.7/ref/settings/ | ||
""" | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
import os | ||
from typing import List | ||
|
||
|
||
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = "f8fkupu8pa%%u$wgk6c!os39el41v7i7^u*8xf#g5p@+c&)b#^" | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"APP_DIRS": True, | ||
"OPTIONS": { | ||
"debug": True, | ||
"context_processors": [ | ||
"django.contrib.auth.context_processors.auth", | ||
"django.template.context_processors.debug", | ||
"django.template.context_processors.i18n", | ||
"django.template.context_processors.media", | ||
"django.template.context_processors.static", | ||
"django.template.context_processors.tz", | ||
"django.template.context_processors.request", | ||
"django.contrib.messages.context_processors.messages", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
ALLOWED_HOSTS: List[str] = [] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = ( | ||
"django.contrib.admin", | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.messages", | ||
"django.contrib.staticfiles", | ||
"timedelta", | ||
"test_app", | ||
) | ||
|
||
MIDDLEWARE = ( | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.middleware.common.CommonMiddleware", | ||
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
) | ||
MIDDLEWARE_CLASSES = MIDDLEWARE | ||
|
||
# ROOT_URLCONF = "test_project.urls" | ||
|
||
# WSGI_APPLICATION = "test_project.wsgi.application" | ||
|
||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases | ||
|
||
DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.sqlite3", | ||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"), | ||
} | ||
} | ||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/1.7/topics/i18n/ | ||
|
||
LANGUAGE_CODE = "en-us" | ||
|
||
TIME_ZONE = "UTC" | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/1.7/howto/static-files/ | ||
|
||
STATIC_URL = "/static/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters