Skip to content

Commit

Permalink
wip: wire in django filters
Browse files Browse the repository at this point in the history
  • Loading branch information
ngurenyaga committed Jul 23, 2021
1 parent 8007f9f commit 9c230f2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 30 deletions.
12 changes: 12 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@
"allauth",
"allauth.account",
"allauth.socialaccount",
"django_filters",
"rest_framework",
"rest_framework.authtoken",
"rest_framework_datatables",
"corsheaders",
"mjml",
"jet",
Expand Down Expand Up @@ -271,6 +273,16 @@
# django-rest-framework
# -------------------------------------------------------------------------------
REST_FRAMEWORK = {
"DEFAULT_RENDERER_CLASSES": (
"rest_framework.renderers.JSONRenderer",
"rest_framework.renderers.BrowsableAPIRenderer",
"rest_framework_datatables.renderers.DatatablesRenderer",
),
"DEFAULT_FILTER_BACKENDS": ("rest_framework_datatables.filters.DatatablesFilterBackend",),
"DEFAULT_PAGINATION_CLASS": (
"rest_framework_datatables.pagination.DatatablesPageNumberPagination"
),
"PAGE_SIZE": 50,
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.SessionAuthentication",
"rest_framework.authentication.TokenAuthentication",
Expand Down
3 changes: 3 additions & 0 deletions fahari/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class FacilityView(LoginRequiredMixin, ApprovedMixin, TemplateView):
template_name = "pages/common/facilities.html"
permission_required = "common.view_facility"

# TODO Get base DRF settings from ERP
# TODO Get base serializer, view, filter etc from ERP
# TODO Lib: https://django-rest-framework-datatables.readthedocs.io/en/latest/
# TODO Actions
# TODO Export
# TODO Sort
Expand Down
50 changes: 24 additions & 26 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
pytz~=2021.1 # https://github.com/stub42/pytz
python-slugify~=5.0.2 # https://github.com/un33k/python-slugify
Fraction~=1.5.1
Pillow~=8.3.1 # https://github.com/python-pillow/Pillow
rcssmin~=1.0.6 # https://github.com/ndparker/rcssmin
argon2-cffi~=20.1.0 # https://github.com/hynek/argon2_cffi
whitenoise~=5.3.0 # https://github.com/evansd/whitenoise
flower~=0.9.7 # https://github.com/mher/flower
uvicorn[standard]~=0.14.0 # https://github.com/encode/uvicorn
django-phonenumber-field~=5.2.0
phonenumbers~=8.12.28
Fraction~=1.5.1
coveralls~=3.2.0
google-cloud-secret-manager~=2.6.0
cifrazia-django-jet~=1.1.4
google-api-core~=1.31.0
google-api-python-client~=2.14.0
google-auth~=1.33.1
google-cloud-storage~=1.41.1

# Django
# ------------------------------------------------------------------------------
django~=3.2.5 # pyup: < 3.2 # https://www.djangoproject.com/
django-environ~=0.4.5 # https://github.com/joke2k/django-environ
django-model-utils~=4.1.1 # https://github.com/jazzband/django-model-utils
coveralls~=3.2.0
django-allauth~=0.45.0 # https://github.com/pennersr/django-allauth
django-crispy-forms~=1.12.0 # https://github.com/django-crispy-forms/django-crispy-forms
django-anymail[mailgun]~=8.4 # https://github.com/anymail/django-anymail
django-compressor~=2.4.1 # https://github.com/django-compressor/django-compressor
# Django REST Framework
djangorestframework~=3.12.4 # https://github.com/encode/django-rest-framework
django-cors-headers~=3.7.0 # https://github.com/adamchainz/django-cors-headers
django-storages[google]~=1.11.1 # https://github.com/jschneier/django-storages
django-anymail[mailgun]~=8.4 # https://github.com/anymail/django-anymail
django-crispy-forms~=1.12.0 # https://github.com/django-crispy-forms/django-crispy-forms
django-environ~=0.4.5 # https://github.com/joke2k/django-environ
django-filter~=2.4.0
django-mjml[requests]~=0.11.0
django-model-utils~=4.1.1 # https://github.com/jazzband/django-model-utils
django-phonenumber-field~=5.2.0
django-storages[google]~=1.11.1 # https://github.com/jschneier/django-storages
djangorestframework-datatables~=0.6.0
djangorestframework~=3.12.4 # https://github.com/encode/django-rest-framework
django~=3.2.5 # pyup: < 3.2 # https://www.djangoproject.com/
flower~=0.9.7 # https://github.com/mher/flower
google-api-core~=1.31.0
google-api-python-client~=2.14.0
google-auth~=1.33.1
google-cloud-secret-manager~=2.6.0
google-cloud-storage~=1.41.1
phonenumbers~=8.12.28
python-slugify~=5.0.2 # https://github.com/un33k/python-slugify
pytz~=2021.1 # https://github.com/stub42/pytz
rcssmin~=1.0.6 # https://github.com/ndparker/rcssmin
requests~=2.26.0
uvicorn[standard]~=0.14.0 # https://github.com/encode/uvicorn
whitenoise~=5.3.0 # https://github.com/evansd/whitenoise
4 changes: 2 additions & 2 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ coverage~=5.5 # https://github.com/nedbat/coveragepy
black~=21.6b0 # https://github.com/psf/black
pylint-django~=2.4.4 # https://github.com/PyCQA/pylint-django
pre-commit~=2.13.0 # https://github.com/pre-commit/pre-commit
Faker~=8.10.1
pylint>=2.9.5

# Django
# ------------------------------------------------------------------------------
Expand All @@ -36,8 +38,6 @@ django-debug-toolbar~=3.2.1 # https://github.com/jazzband/django-debug-toolbar
django-extensions~=3.1.3 # https://github.com/django-extensions/django-extensions
django-coverage-plugin~=2.0.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django~=4.4.0 # https://github.com/pytest-dev/pytest-django
Faker~=8.10.1
pylint>=2.9.5

# mypy type definitions
types-pytz>=2021.1.0
Expand Down
2 changes: 0 additions & 2 deletions requirements/production.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# PRECAUTION: avoid production dependencies that aren't in development

-r local.txt

gunicorn~=20.1.0 # https://github.com/benoitc/gunicorn
Expand Down

0 comments on commit 9c230f2

Please sign in to comment.