django-searchkit 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_searchkit-0.1/LICENCE +27 -0
- django_searchkit-0.1/MANIFEST.in +3 -0
- django_searchkit-0.1/PKG-INFO +82 -0
- django_searchkit-0.1/README.md +34 -0
- django_searchkit-0.1/django_searchkit.egg-info/PKG-INFO +82 -0
- django_searchkit-0.1/django_searchkit.egg-info/SOURCES.txt +40 -0
- django_searchkit-0.1/django_searchkit.egg-info/dependency_links.txt +1 -0
- django_searchkit-0.1/django_searchkit.egg-info/requires.txt +1 -0
- django_searchkit-0.1/django_searchkit.egg-info/top_level.txt +3 -0
- django_searchkit-0.1/django_searchkit.egg-info/zip-safe +1 -0
- django_searchkit-0.1/example/example/__init__.py +0 -0
- django_searchkit-0.1/example/example/admin.py +16 -0
- django_searchkit-0.1/example/example/asgi.py +16 -0
- django_searchkit-0.1/example/example/management/__init__.py +0 -0
- django_searchkit-0.1/example/example/management/commands/__init__.py +0 -0
- django_searchkit-0.1/example/example/management/commands/createtestdata.py +62 -0
- django_searchkit-0.1/example/example/migrations/0001_initial.py +48 -0
- django_searchkit-0.1/example/example/migrations/__init__.py +0 -0
- django_searchkit-0.1/example/example/models.py +38 -0
- django_searchkit-0.1/example/example/settings.py +125 -0
- django_searchkit-0.1/example/example/urls.py +23 -0
- django_searchkit-0.1/example/example/wsgi.py +16 -0
- django_searchkit-0.1/searchkit/__init__.py +0 -0
- django_searchkit-0.1/searchkit/__version__.py +16 -0
- django_searchkit-0.1/searchkit/admin.py +30 -0
- django_searchkit-0.1/searchkit/apps.py +6 -0
- django_searchkit-0.1/searchkit/filters.py +31 -0
- django_searchkit-0.1/searchkit/forms/__init__.py +2 -0
- django_searchkit-0.1/searchkit/forms/fields.py +55 -0
- django_searchkit-0.1/searchkit/forms/search.py +45 -0
- django_searchkit-0.1/searchkit/forms/searchkit.py +192 -0
- django_searchkit-0.1/searchkit/forms/utils.py +149 -0
- django_searchkit-0.1/searchkit/migrations/0001_initial.py +30 -0
- django_searchkit-0.1/searchkit/migrations/__init__.py +0 -0
- django_searchkit-0.1/searchkit/models.py +23 -0
- django_searchkit-0.1/searchkit/templatetags/__init__.py +0 -0
- django_searchkit-0.1/searchkit/templatetags/searchkit.py +47 -0
- django_searchkit-0.1/searchkit/tests.py +197 -0
- django_searchkit-0.1/searchkit/urls.py +8 -0
- django_searchkit-0.1/searchkit/views.py +30 -0
- django_searchkit-0.1/setup.cfg +4 -0
- django_searchkit-0.1/setup.py +75 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) 2024, Thomas Leichtfuß.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
12
|
+
documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
3. Neither the name of the author nor the names of contributors
|
15
|
+
may be used to endorse or promote products derived from this software
|
16
|
+
without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: django-searchkit
|
3
|
+
Version: 0.1
|
4
|
+
Summary: Finally a real searchkit for django!
|
5
|
+
Home-page: https://github.com/thomst/django-searchkit
|
6
|
+
Author: Thomas Leichtfuß
|
7
|
+
Author-email: thomas.leichtfuss@posteo.de
|
8
|
+
License: BSD License
|
9
|
+
Platform: OS Independent
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
11
|
+
Classifier: Framework :: Django
|
12
|
+
Classifier: Framework :: Django :: 3.0
|
13
|
+
Classifier: Framework :: Django :: 3.1
|
14
|
+
Classifier: Framework :: Django :: 3.2
|
15
|
+
Classifier: Framework :: Django :: 4.0
|
16
|
+
Classifier: Framework :: Django :: 4.1
|
17
|
+
Classifier: Framework :: Django :: 4.2
|
18
|
+
Classifier: Framework :: Django :: 5.0
|
19
|
+
Classifier: Framework :: Django :: 5.1
|
20
|
+
Classifier: Environment :: Web Environment
|
21
|
+
Classifier: Intended Audience :: Developers
|
22
|
+
Classifier: License :: OSI Approved :: BSD License
|
23
|
+
Classifier: Operating System :: OS Independent
|
24
|
+
Classifier: Programming Language :: Python
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
26
|
+
Classifier: Programming Language :: Python :: 3.7
|
27
|
+
Classifier: Programming Language :: Python :: 3.8
|
28
|
+
Classifier: Programming Language :: Python :: 3.9
|
29
|
+
Classifier: Programming Language :: Python :: 3.10
|
30
|
+
Classifier: Programming Language :: Python :: 3.11
|
31
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
32
|
+
Classifier: Topic :: Software Development
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
34
|
+
Description-Content-Type: text/markdown
|
35
|
+
License-File: LICENCE
|
36
|
+
Requires-Dist: Django>=3.0
|
37
|
+
Dynamic: author
|
38
|
+
Dynamic: author-email
|
39
|
+
Dynamic: classifier
|
40
|
+
Dynamic: description
|
41
|
+
Dynamic: description-content-type
|
42
|
+
Dynamic: home-page
|
43
|
+
Dynamic: license
|
44
|
+
Dynamic: license-file
|
45
|
+
Dynamic: platform
|
46
|
+
Dynamic: requires-dist
|
47
|
+
Dynamic: summary
|
48
|
+
|
49
|
+
# Welcome to django-searchkit
|
50
|
+
|
51
|
+
[<img src="https://github.com/thomst/django-searchkit/actions/workflows/ci.yml/badge.svg">](https://github.com/thomst/django-searchkit/)
|
52
|
+
[<img src="https://coveralls.io/repos/github/thomst/django-searchkit/badge.svg?branch=main">](https://coveralls.io/github/thomst/django-searchkit?branch=main)
|
53
|
+
[<img src="https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue">](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
|
54
|
+
[<img src="https://img.shields.io/badge/django-3.1%20%7C%203.2%20%7C%204.0%20%7C%204.1%20%7C%204.2%20%7C%205.0%20%7C%205.1-orange">](https://img.shields.io/badge/django-3.1%20%7C%203.2%20%7C%204.0%20%7C%204.1%20%7C%204.2%20%7C%205.0%20%7C%205.1-orange)
|
55
|
+
|
56
|
+
|
57
|
+
## Description
|
58
|
+
|
59
|
+
TODO
|
60
|
+
|
61
|
+
## Setup
|
62
|
+
|
63
|
+
Install via pip:
|
64
|
+
```
|
65
|
+
pip install django-searchkit
|
66
|
+
```
|
67
|
+
|
68
|
+
Add `searchkit` to your `INSTALLED_APPS`:
|
69
|
+
```
|
70
|
+
INSTALLED_APPS = [
|
71
|
+
'searchkit',
|
72
|
+
...
|
73
|
+
]
|
74
|
+
```
|
75
|
+
|
76
|
+
## Getting started
|
77
|
+
|
78
|
+
TODO
|
79
|
+
|
80
|
+
## Usage
|
81
|
+
|
82
|
+
TODO
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Welcome to django-searchkit
|
2
|
+
|
3
|
+
[<img src="https://github.com/thomst/django-searchkit/actions/workflows/ci.yml/badge.svg">](https://github.com/thomst/django-searchkit/)
|
4
|
+
[<img src="https://coveralls.io/repos/github/thomst/django-searchkit/badge.svg?branch=main">](https://coveralls.io/github/thomst/django-searchkit?branch=main)
|
5
|
+
[<img src="https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue">](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
|
6
|
+
[<img src="https://img.shields.io/badge/django-3.1%20%7C%203.2%20%7C%204.0%20%7C%204.1%20%7C%204.2%20%7C%205.0%20%7C%205.1-orange">](https://img.shields.io/badge/django-3.1%20%7C%203.2%20%7C%204.0%20%7C%204.1%20%7C%204.2%20%7C%205.0%20%7C%205.1-orange)
|
7
|
+
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
TODO
|
12
|
+
|
13
|
+
## Setup
|
14
|
+
|
15
|
+
Install via pip:
|
16
|
+
```
|
17
|
+
pip install django-searchkit
|
18
|
+
```
|
19
|
+
|
20
|
+
Add `searchkit` to your `INSTALLED_APPS`:
|
21
|
+
```
|
22
|
+
INSTALLED_APPS = [
|
23
|
+
'searchkit',
|
24
|
+
...
|
25
|
+
]
|
26
|
+
```
|
27
|
+
|
28
|
+
## Getting started
|
29
|
+
|
30
|
+
TODO
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
TODO
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: django-searchkit
|
3
|
+
Version: 0.1
|
4
|
+
Summary: Finally a real searchkit for django!
|
5
|
+
Home-page: https://github.com/thomst/django-searchkit
|
6
|
+
Author: Thomas Leichtfuß
|
7
|
+
Author-email: thomas.leichtfuss@posteo.de
|
8
|
+
License: BSD License
|
9
|
+
Platform: OS Independent
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
11
|
+
Classifier: Framework :: Django
|
12
|
+
Classifier: Framework :: Django :: 3.0
|
13
|
+
Classifier: Framework :: Django :: 3.1
|
14
|
+
Classifier: Framework :: Django :: 3.2
|
15
|
+
Classifier: Framework :: Django :: 4.0
|
16
|
+
Classifier: Framework :: Django :: 4.1
|
17
|
+
Classifier: Framework :: Django :: 4.2
|
18
|
+
Classifier: Framework :: Django :: 5.0
|
19
|
+
Classifier: Framework :: Django :: 5.1
|
20
|
+
Classifier: Environment :: Web Environment
|
21
|
+
Classifier: Intended Audience :: Developers
|
22
|
+
Classifier: License :: OSI Approved :: BSD License
|
23
|
+
Classifier: Operating System :: OS Independent
|
24
|
+
Classifier: Programming Language :: Python
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
26
|
+
Classifier: Programming Language :: Python :: 3.7
|
27
|
+
Classifier: Programming Language :: Python :: 3.8
|
28
|
+
Classifier: Programming Language :: Python :: 3.9
|
29
|
+
Classifier: Programming Language :: Python :: 3.10
|
30
|
+
Classifier: Programming Language :: Python :: 3.11
|
31
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
32
|
+
Classifier: Topic :: Software Development
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
34
|
+
Description-Content-Type: text/markdown
|
35
|
+
License-File: LICENCE
|
36
|
+
Requires-Dist: Django>=3.0
|
37
|
+
Dynamic: author
|
38
|
+
Dynamic: author-email
|
39
|
+
Dynamic: classifier
|
40
|
+
Dynamic: description
|
41
|
+
Dynamic: description-content-type
|
42
|
+
Dynamic: home-page
|
43
|
+
Dynamic: license
|
44
|
+
Dynamic: license-file
|
45
|
+
Dynamic: platform
|
46
|
+
Dynamic: requires-dist
|
47
|
+
Dynamic: summary
|
48
|
+
|
49
|
+
# Welcome to django-searchkit
|
50
|
+
|
51
|
+
[<img src="https://github.com/thomst/django-searchkit/actions/workflows/ci.yml/badge.svg">](https://github.com/thomst/django-searchkit/)
|
52
|
+
[<img src="https://coveralls.io/repos/github/thomst/django-searchkit/badge.svg?branch=main">](https://coveralls.io/github/thomst/django-searchkit?branch=main)
|
53
|
+
[<img src="https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue">](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
|
54
|
+
[<img src="https://img.shields.io/badge/django-3.1%20%7C%203.2%20%7C%204.0%20%7C%204.1%20%7C%204.2%20%7C%205.0%20%7C%205.1-orange">](https://img.shields.io/badge/django-3.1%20%7C%203.2%20%7C%204.0%20%7C%204.1%20%7C%204.2%20%7C%205.0%20%7C%205.1-orange)
|
55
|
+
|
56
|
+
|
57
|
+
## Description
|
58
|
+
|
59
|
+
TODO
|
60
|
+
|
61
|
+
## Setup
|
62
|
+
|
63
|
+
Install via pip:
|
64
|
+
```
|
65
|
+
pip install django-searchkit
|
66
|
+
```
|
67
|
+
|
68
|
+
Add `searchkit` to your `INSTALLED_APPS`:
|
69
|
+
```
|
70
|
+
INSTALLED_APPS = [
|
71
|
+
'searchkit',
|
72
|
+
...
|
73
|
+
]
|
74
|
+
```
|
75
|
+
|
76
|
+
## Getting started
|
77
|
+
|
78
|
+
TODO
|
79
|
+
|
80
|
+
## Usage
|
81
|
+
|
82
|
+
TODO
|
@@ -0,0 +1,40 @@
|
|
1
|
+
LICENCE
|
2
|
+
MANIFEST.in
|
3
|
+
README.md
|
4
|
+
setup.py
|
5
|
+
django_searchkit.egg-info/PKG-INFO
|
6
|
+
django_searchkit.egg-info/SOURCES.txt
|
7
|
+
django_searchkit.egg-info/dependency_links.txt
|
8
|
+
django_searchkit.egg-info/requires.txt
|
9
|
+
django_searchkit.egg-info/top_level.txt
|
10
|
+
django_searchkit.egg-info/zip-safe
|
11
|
+
example/example/__init__.py
|
12
|
+
example/example/admin.py
|
13
|
+
example/example/asgi.py
|
14
|
+
example/example/models.py
|
15
|
+
example/example/settings.py
|
16
|
+
example/example/urls.py
|
17
|
+
example/example/wsgi.py
|
18
|
+
example/example/management/__init__.py
|
19
|
+
example/example/management/commands/__init__.py
|
20
|
+
example/example/management/commands/createtestdata.py
|
21
|
+
example/example/migrations/0001_initial.py
|
22
|
+
example/example/migrations/__init__.py
|
23
|
+
searchkit/__init__.py
|
24
|
+
searchkit/__version__.py
|
25
|
+
searchkit/admin.py
|
26
|
+
searchkit/apps.py
|
27
|
+
searchkit/filters.py
|
28
|
+
searchkit/models.py
|
29
|
+
searchkit/tests.py
|
30
|
+
searchkit/urls.py
|
31
|
+
searchkit/views.py
|
32
|
+
searchkit/forms/__init__.py
|
33
|
+
searchkit/forms/fields.py
|
34
|
+
searchkit/forms/search.py
|
35
|
+
searchkit/forms/searchkit.py
|
36
|
+
searchkit/forms/utils.py
|
37
|
+
searchkit/migrations/0001_initial.py
|
38
|
+
searchkit/migrations/__init__.py
|
39
|
+
searchkit/templatetags/__init__.py
|
40
|
+
searchkit/templatetags/searchkit.py
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Django>=3.0
|
@@ -0,0 +1 @@
|
|
1
|
+
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from django.contrib import admin
|
2
|
+
from searchkit.filters import SearchkitFilter
|
3
|
+
from .models import ModelA
|
4
|
+
from .models import ModelB
|
5
|
+
|
6
|
+
|
7
|
+
@admin.register(ModelA)
|
8
|
+
class ModelAAdmin(admin.ModelAdmin):
|
9
|
+
list_display = [f.name for f in ModelA._meta.fields]
|
10
|
+
list_filter = [SearchkitFilter, 'chars_choices']
|
11
|
+
|
12
|
+
|
13
|
+
@admin.register(ModelB)
|
14
|
+
class ModelBAdmin(admin.ModelAdmin):
|
15
|
+
list_display = [f.name for f in ModelB._meta.fields]
|
16
|
+
list_filter = [SearchkitFilter]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"""
|
2
|
+
ASGI config for example project.
|
3
|
+
|
4
|
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
5
|
+
|
6
|
+
For more information on this file, see
|
7
|
+
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
|
12
|
+
from django.core.asgi import get_asgi_application
|
13
|
+
|
14
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')
|
15
|
+
|
16
|
+
application = get_asgi_application()
|
File without changes
|
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import random
|
2
|
+
from datetime import timedelta
|
3
|
+
from decimal import Decimal
|
4
|
+
from django.utils import timezone
|
5
|
+
from django.core.management.base import BaseCommand
|
6
|
+
from django.contrib.auth.models import User
|
7
|
+
from example.models import ModelA, ModelB, CHARS_CHOICES, INTEGER_CHOICES
|
8
|
+
|
9
|
+
|
10
|
+
class Command(BaseCommand):
|
11
|
+
help = 'Generate test data for ModelA and ModelB'
|
12
|
+
|
13
|
+
def handle(self, *args, **kwargs):
|
14
|
+
self.stdout.write("Creating test data...")
|
15
|
+
|
16
|
+
# Create a superuser
|
17
|
+
if not User.objects.filter(username='admin').exists():
|
18
|
+
User.objects.create_superuser(
|
19
|
+
username='admin',
|
20
|
+
email='admin@example.com',
|
21
|
+
password='adminpassword'
|
22
|
+
)
|
23
|
+
self.stdout.write(self.style.SUCCESS("Superuser 'admin' created successfully!"))
|
24
|
+
else:
|
25
|
+
self.stdout.write(self.style.WARNING("Superuser 'admin' already exists."))
|
26
|
+
|
27
|
+
# Generate test data for ModelA
|
28
|
+
model_a_instances = []
|
29
|
+
for i in range(10):
|
30
|
+
model_a = ModelA.objects.create(
|
31
|
+
boolean=random.choice([None, True, False]),
|
32
|
+
chars=f"ModelA_Chars_{i}",
|
33
|
+
chars_choices=random.choice([c[0] for c in CHARS_CHOICES]),
|
34
|
+
integer=random.randint(1, 100),
|
35
|
+
integer_choices=random.choice([c[0] for c in INTEGER_CHOICES]),
|
36
|
+
float=random.uniform(1.0, 100.0),
|
37
|
+
decimal=Decimal(f"{random.randint(1, 100)}.{random.randint(0, 99)}"),
|
38
|
+
date=timezone.now().date() - timedelta(days=random.randint(0, 365)), # Use timezone.now()
|
39
|
+
datetime=timezone.now() - timedelta(days=random.randint(0, 365)) # Use timezone.now()
|
40
|
+
)
|
41
|
+
model_a_instances.append(model_a)
|
42
|
+
|
43
|
+
# Generate test data for ModelB
|
44
|
+
model_b_instances = []
|
45
|
+
for i in range(10):
|
46
|
+
model_b = ModelB.objects.create(
|
47
|
+
chars=f"ModelB_Chars_{i}",
|
48
|
+
integer=random.randint(1, 100),
|
49
|
+
float=random.uniform(1.0, 100.0),
|
50
|
+
decimal=Decimal(f"{random.randint(1, 100)}.{random.randint(0, 99)}"),
|
51
|
+
date=timezone.now().date() - timedelta(days=random.randint(0, 365)), # Use timezone.now()
|
52
|
+
datetime=timezone.now() - timedelta(days=random.randint(0, 365)), # Use timezone.now()
|
53
|
+
model_a=random.choice(model_a_instances)
|
54
|
+
)
|
55
|
+
model_b_instances.append(model_b)
|
56
|
+
|
57
|
+
# Add modela -> modelb relation.
|
58
|
+
for index, model_a in enumerate(model_a_instances):
|
59
|
+
model_a.model_b = model_b_instances[index]
|
60
|
+
model_a.save()
|
61
|
+
|
62
|
+
self.stdout.write(self.style.SUCCESS("Test data created successfully!"))
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by Django 5.1.3 on 2025-05-25 05:46
|
2
|
+
|
3
|
+
import django.db.models.deletion
|
4
|
+
from django.db import migrations, models
|
5
|
+
|
6
|
+
|
7
|
+
class Migration(migrations.Migration):
|
8
|
+
|
9
|
+
initial = True
|
10
|
+
|
11
|
+
dependencies = [
|
12
|
+
]
|
13
|
+
|
14
|
+
operations = [
|
15
|
+
migrations.CreateModel(
|
16
|
+
name='ModelA',
|
17
|
+
fields=[
|
18
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
19
|
+
('boolean', models.BooleanField(null=True)),
|
20
|
+
('chars', models.CharField(max_length=255)),
|
21
|
+
('chars_choices', models.CharField(choices=[('one', 'One'), ('two', 'Two'), ('three', 'Three'), ('four', 'Four')], max_length=255)),
|
22
|
+
('integer', models.IntegerField()),
|
23
|
+
('integer_choices', models.IntegerField(choices=[(1, 1), (2, 2), (3, 3), (4, 4)])),
|
24
|
+
('float', models.FloatField()),
|
25
|
+
('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
|
26
|
+
('date', models.DateField()),
|
27
|
+
('datetime', models.DateTimeField()),
|
28
|
+
],
|
29
|
+
),
|
30
|
+
migrations.CreateModel(
|
31
|
+
name='ModelB',
|
32
|
+
fields=[
|
33
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
34
|
+
('chars', models.CharField(max_length=255)),
|
35
|
+
('integer', models.IntegerField()),
|
36
|
+
('float', models.FloatField()),
|
37
|
+
('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
|
38
|
+
('date', models.DateField()),
|
39
|
+
('datetime', models.DateTimeField()),
|
40
|
+
('model_a', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='example.modela')),
|
41
|
+
],
|
42
|
+
),
|
43
|
+
migrations.AddField(
|
44
|
+
model_name='modela',
|
45
|
+
name='model_b',
|
46
|
+
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='example.modelb'),
|
47
|
+
),
|
48
|
+
]
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from django.db import models
|
2
|
+
|
3
|
+
|
4
|
+
CHARS_CHOICES = (
|
5
|
+
('one', 'One'),
|
6
|
+
('two', 'Two'),
|
7
|
+
('three', 'Three'),
|
8
|
+
('four', 'Four'),
|
9
|
+
)
|
10
|
+
INTEGER_CHOICES = (
|
11
|
+
(1, 1),
|
12
|
+
(2, 2),
|
13
|
+
(3, 3),
|
14
|
+
(4, 4),
|
15
|
+
)
|
16
|
+
|
17
|
+
|
18
|
+
class ModelA(models.Model):
|
19
|
+
boolean = models.BooleanField(null=True)
|
20
|
+
chars = models.CharField(max_length=255)
|
21
|
+
chars_choices = models.CharField(max_length=255, choices=CHARS_CHOICES)
|
22
|
+
integer = models.IntegerField()
|
23
|
+
integer_choices = models.IntegerField(choices=INTEGER_CHOICES)
|
24
|
+
float = models.FloatField()
|
25
|
+
decimal = models.DecimalField(max_digits=5, decimal_places=2)
|
26
|
+
date = models.DateField()
|
27
|
+
datetime = models.DateTimeField()
|
28
|
+
model_b = models.OneToOneField('ModelB', on_delete=models.CASCADE, null=True)
|
29
|
+
|
30
|
+
|
31
|
+
class ModelB(models.Model):
|
32
|
+
chars = models.CharField(max_length=255)
|
33
|
+
integer = models.IntegerField()
|
34
|
+
float = models.FloatField()
|
35
|
+
decimal = models.DecimalField(max_digits=5, decimal_places=2)
|
36
|
+
date = models.DateField()
|
37
|
+
datetime = models.DateTimeField()
|
38
|
+
model_a = models.ForeignKey(ModelA, on_delete=models.CASCADE)
|
@@ -0,0 +1,125 @@
|
|
1
|
+
"""
|
2
|
+
Django settings for example project.
|
3
|
+
|
4
|
+
Generated by 'django-admin startproject' using Django 4.1.6.
|
5
|
+
|
6
|
+
For more information on this file, see
|
7
|
+
https://docs.djangoproject.com/en/4.1/topics/settings/
|
8
|
+
|
9
|
+
For the full list of settings and their values, see
|
10
|
+
https://docs.djangoproject.com/en/4.1/ref/settings/
|
11
|
+
"""
|
12
|
+
|
13
|
+
from pathlib import Path
|
14
|
+
|
15
|
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
16
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
17
|
+
|
18
|
+
|
19
|
+
# Quick-start development settings - unsuitable for production
|
20
|
+
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
21
|
+
|
22
|
+
# SECURITY WARNING: keep the secret key used in production secret!
|
23
|
+
SECRET_KEY = 'django-insecure-^@et7v8l)mu@#@tooytj77v&jtkqy&i^wgp9+ro&v!rb6f1y__'
|
24
|
+
|
25
|
+
# SECURITY WARNING: don't run with debug turned on in production!
|
26
|
+
DEBUG = True
|
27
|
+
|
28
|
+
ALLOWED_HOSTS = []
|
29
|
+
|
30
|
+
|
31
|
+
# Application definition
|
32
|
+
|
33
|
+
INSTALLED_APPS = [
|
34
|
+
'example',
|
35
|
+
'searchkit',
|
36
|
+
'django.contrib.admin',
|
37
|
+
'django.contrib.auth',
|
38
|
+
'django.contrib.contenttypes',
|
39
|
+
'django.contrib.sessions',
|
40
|
+
'django.contrib.messages',
|
41
|
+
'django.contrib.staticfiles',
|
42
|
+
]
|
43
|
+
|
44
|
+
MIDDLEWARE = [
|
45
|
+
'django.middleware.security.SecurityMiddleware',
|
46
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
47
|
+
'django.middleware.common.CommonMiddleware',
|
48
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
49
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
50
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
51
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
52
|
+
]
|
53
|
+
|
54
|
+
ROOT_URLCONF = 'example.urls'
|
55
|
+
|
56
|
+
TEMPLATES = [
|
57
|
+
{
|
58
|
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
59
|
+
'DIRS': [],
|
60
|
+
'APP_DIRS': True,
|
61
|
+
'OPTIONS': {
|
62
|
+
'context_processors': [
|
63
|
+
'django.template.context_processors.debug',
|
64
|
+
'django.template.context_processors.request',
|
65
|
+
'django.contrib.auth.context_processors.auth',
|
66
|
+
'django.contrib.messages.context_processors.messages',
|
67
|
+
],
|
68
|
+
},
|
69
|
+
},
|
70
|
+
]
|
71
|
+
|
72
|
+
WSGI_APPLICATION = 'example.wsgi.application'
|
73
|
+
|
74
|
+
|
75
|
+
# Database
|
76
|
+
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
|
77
|
+
|
78
|
+
DATABASES = {
|
79
|
+
'default': {
|
80
|
+
'ENGINE': 'django.db.backends.sqlite3',
|
81
|
+
'NAME': BASE_DIR / 'db.sqlite3',
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
# Password validation
|
87
|
+
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
|
88
|
+
|
89
|
+
AUTH_PASSWORD_VALIDATORS = [
|
90
|
+
{
|
91
|
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
92
|
+
},
|
93
|
+
{
|
94
|
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
95
|
+
},
|
96
|
+
{
|
97
|
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
98
|
+
},
|
99
|
+
{
|
100
|
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
101
|
+
},
|
102
|
+
]
|
103
|
+
|
104
|
+
|
105
|
+
# Internationalization
|
106
|
+
# https://docs.djangoproject.com/en/4.1/topics/i18n/
|
107
|
+
|
108
|
+
LANGUAGE_CODE = 'en-us'
|
109
|
+
|
110
|
+
TIME_ZONE = 'UTC'
|
111
|
+
|
112
|
+
USE_I18N = True
|
113
|
+
|
114
|
+
USE_TZ = True
|
115
|
+
|
116
|
+
|
117
|
+
# Static files (CSS, JavaScript, Images)
|
118
|
+
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
119
|
+
|
120
|
+
STATIC_URL = 'static/'
|
121
|
+
|
122
|
+
# Default primary key field type
|
123
|
+
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
124
|
+
|
125
|
+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""example URL Configuration
|
2
|
+
|
3
|
+
The `urlpatterns` list routes URLs to views. For more information please see:
|
4
|
+
https://docs.djangoproject.com/en/4.1/topics/http/urls/
|
5
|
+
Examples:
|
6
|
+
Function views
|
7
|
+
1. Add an import: from my_app import views
|
8
|
+
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
9
|
+
Class-based views
|
10
|
+
1. Add an import: from other_app.views import Home
|
11
|
+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
12
|
+
Including another URLconf
|
13
|
+
1. Import the include() function: from django.urls import include, path
|
14
|
+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
15
|
+
"""
|
16
|
+
from django.contrib import admin
|
17
|
+
from django.urls import path, include
|
18
|
+
|
19
|
+
|
20
|
+
urlpatterns = [
|
21
|
+
path('', include('searchkit.urls')),
|
22
|
+
path('admin/', admin.site.urls),
|
23
|
+
]
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"""
|
2
|
+
WSGI config for example project.
|
3
|
+
|
4
|
+
It exposes the WSGI callable as a module-level variable named ``application``.
|
5
|
+
|
6
|
+
For more information on this file, see
|
7
|
+
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
|
12
|
+
from django.core.wsgi import get_wsgi_application
|
13
|
+
|
14
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')
|
15
|
+
|
16
|
+
application = get_wsgi_application()
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"""
|
2
|
+
This project uses the Semantic Versioning scheme in conjunction with PEP 0440:
|
3
|
+
<http://semver.org/>
|
4
|
+
<https://www.python.org/dev/peps/pep-0440>
|
5
|
+
|
6
|
+
Major versions introduce significant changes to the API, and backwards
|
7
|
+
compatibility is not guaranteed. Minor versions are for new features and other
|
8
|
+
backwards-compatible changes to the API. Patch versions are for bug fixes and
|
9
|
+
internal code changes that do not affect the API. Development versions are
|
10
|
+
incomplete states of a release .
|
11
|
+
|
12
|
+
Version 0.x should be considered a development version with an unstable API,
|
13
|
+
and backwards compatibility is not guaranteed for minor versions.
|
14
|
+
"""
|
15
|
+
|
16
|
+
__version__ = "0.1"
|