File tree Expand file tree Collapse file tree 13 files changed +156
-9
lines changed Expand file tree Collapse file tree 13 files changed +156
-9
lines changed Original file line number Diff line number Diff line change
1
+ name : django-ckc
2
+
3
+ on :
4
+ push :
5
+ branches : [ '*' ]
6
+
7
+ jobs :
8
+ build :
9
+
10
+ runs-on : ubuntu-latest
11
+ strategy :
12
+ matrix :
13
+ python-version : [3.6, 3.7, 3.8]
14
+ django-version : ['<2', '<3', '>=3']
15
+
16
+ steps :
17
+ - uses : actions/checkout@v2
18
+ - name : Set up Python ${{ matrix.python-version }}
19
+ uses : actions/setup-python@v1
20
+ with :
21
+ python-version : ${{ matrix.python-version }}
22
+ - name : Set up Django ${{ matrix.django-version }}
23
+ run : |
24
+ sed 's/Django==.*/Django==${{ matrix.django-version }}/' requirements.txt
25
+ - name : Cache pip
26
+ uses : actions/cache@v1
27
+ with :
28
+ path : ~/.cache/pip
29
+ # Look to see if there is a cache hit for the corresponding requirements file
30
+ key : ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
31
+ restore-keys : |
32
+ ${{ runner.os }}-pip-
33
+ ${{ runner.os }}-
34
+ - name : Install dependencies
35
+ run : |
36
+ python -m pip install --upgrade pip
37
+ pip install -r requirements.txt
38
+ - name : Lint with flake8
39
+ run : |
40
+ # stop the build if there are Python syntax errors or undefined names
41
+ flake8
42
+ - name : Test with pytest
43
+ run : |
44
+ pytest
Original file line number Diff line number Diff line change @@ -3,7 +3,25 @@ django-ckc [<img src="https://ckcollab.com/assets/images/badges/badge.svg" alt="
3
3
tools, utilities, etc. we use across projects @ ckc
4
4
5
5
6
- # distributing
6
+ ## installing
7
+
8
+ ``` bash
9
+ pip install django-ckc
10
+ ```
11
+
12
+ ``` python
13
+ # settings.py
14
+ INSTALLED_APPS = (
15
+ " django.contrib.auth" ,
16
+ " django.contrib.contenttypes" ,
17
+ " django.contrib.sessions" ,
18
+ " django.contrib.staticfiles" ,
19
+ # ... add ckc
20
+ " ckc" ,
21
+ )
22
+ ```
23
+
24
+ ## distributing
7
25
8
26
``` bash
9
27
$ ./setup.py sdist
Original file line number Diff line number Diff line change @@ -5,14 +5,12 @@ class SoftDeleteModelManager(models.Manager):
5
5
def get_queryset (self ):
6
6
return super ().get_queryset ().exclude (deleted = True )
7
7
8
- def all_objects (self ):
9
- return super ().get_queryset ()
10
-
11
8
12
9
class SoftDeletableModel (models .Model ):
13
10
deleted = models .BooleanField (default = False )
14
11
15
12
objects = SoftDeleteModelManager ()
13
+ all_objects = models .Manager ()
16
14
17
15
class Meta :
18
16
abstract = True
Original file line number Diff line number Diff line change 1
1
twine == 3.1.1
2
+ Django == 3.0.5
3
+ pytest == 5.4.1
4
+ pytest-django == 3.9.0
5
+ pytest-pythonpath == 0.7.3
6
+ flake8 == 3.7.9
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ per-file-ignores =
25
25
26
26
27
27
[tool:pytest]
28
- addopts = --reuse-db --ds =settings.test
28
+ addopts = --reuse-db
29
+ DJANGO_SETTINGS_MODULE = testproject.settings
30
+ python_paths = testproject
29
31
python_files =
30
32
tests/integration/*.py
31
33
tests/functional/*.py
@@ -62,10 +64,10 @@ zip_safe: False
62
64
; install_requires =
63
65
; # colorama
64
66
65
- [options.extras_require]
66
- tests =
67
- pytest
68
- flake8
67
+ ; [options.extras_require]
68
+ ; tests =
69
+ ; pytest
70
+ ; flake8
69
71
70
72
; [options.entry_points]
71
73
; console_scripts =
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ import os
3
+ import sys
4
+
5
+ if __name__ == "__main__" :
6
+ os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , "settings" )
7
+
8
+ from django .core .management import execute_from_command_line
9
+
10
+ execute_from_command_line (sys .argv )
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+
4
+ DEBUG = True
5
+
6
+ BASE_DIR = os .path .dirname (__file__ )
7
+
8
+ DATABASES = {
9
+ "default" : {
10
+ "ENGINE" : "django.db.backends.sqlite3" ,
11
+ "NAME" : os .path .join (BASE_DIR , "db.sqlite3" ),
12
+ }
13
+ }
14
+
15
+ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
16
+
17
+ SECRET_KEY = "_"
18
+
19
+ MIDDLEWARE = (
20
+ 'django.middleware.security.SecurityMiddleware' ,
21
+ 'django.contrib.sessions.middleware.SessionMiddleware' ,
22
+ 'django.middleware.common.CommonMiddleware' ,
23
+ 'django.middleware.csrf.CsrfViewMiddleware' ,
24
+ 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
25
+ 'django.contrib.messages.middleware.MessageMiddleware' ,
26
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware' ,
27
+ )
28
+
29
+
30
+ INSTALLED_APPS = (
31
+ "django.contrib.auth" ,
32
+ "django.contrib.contenttypes" ,
33
+ "django.contrib.sessions" ,
34
+ "django.contrib.staticfiles" ,
35
+
36
+ "ckc" ,
37
+
38
+ "testapp" ,
39
+ )
40
+
41
+ STATIC_URL = "/static/"
42
+
43
+ ROOT_URLCONF = "urls"
44
+
45
+ TEMPLATES = [
46
+ {
47
+ "BACKEND" : "django.template.backends.django.DjangoTemplates" ,
48
+ "APP_DIRS" : True
49
+ }
50
+ ]
Original file line number Diff line number Diff line change
1
+ from django .db import models
2
+
3
+ from ckc .models import SoftDeletableModel
4
+
5
+
6
+ class TestModel (SoftDeletableModel ):
7
+ title = models .CharField (max_length = 255 , default = "I'm a test!" )
You can’t perform that action at this time.
0 commit comments