Skip to content

Commit

Permalink
Merge pull request #9 from AnimalFoodBank/wip/20230921-users
Browse files Browse the repository at this point in the history
[#20230921] Users and Profiles
  • Loading branch information
delano authored Sep 29, 2023
2 parents df15a90 + 1d053ed commit 479b18e
Show file tree
Hide file tree
Showing 27 changed files with 515 additions and 95 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/workflow.yml → .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
#
# The `django-test-action` action is used to run the tests and requires a
# requirements file and a settings directory path.
#
# The `pypa/gh-action-pip-audit` action is used to audit the requirements file
# for security vulnerabilities. It requires a requirements file and can be
# configured to require hashes for all packages.
#
# See:
# - https://github.com/pypa/gh-action-pip-audit
# - https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions


name: Django CI (actions)
name: Audit
on:
push:
branches: [main]
Expand Down Expand Up @@ -46,12 +54,9 @@ jobs:
# run: |
# pip install --upgrade pip

- name: Django Test CI
uses: UKnowWhoIm/[email protected]
with:
requirements-file: afb/requirements.txt
settings-dir-path: afb/afb
parallel-tests: false

- name: gh-action-pip-audit
uses: pypa/[email protected]
with:
inputs: afb/requirements.txt
summary: true
require-hashes: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ local_settings.py
.env*
!.env.empty
db.sqlite3
*.txt
.vscode/
tmp/*
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
#
# To use pre-commit, install it using pip:
#
# pip install pre-commit
#
# Then, run it on all the files in this repo:
#
# pre-commit run --all-files
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

# TODO: Enable black after formatting is standardized.
# - repo: https://github.com/psf/black
# rev: 22.10.0
# hooks:
# - id: black
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

project_type = "python"
#python_version = "3.8"
python_version = "3.10"
linter = "flake8"
formatter = "black"
test_framework = "pytest"
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# afb-requests -- 2023-09-21


## Commands


```bash
$ pip-compile --output-file=- requirements.in > requirements.txt

$ pip-compile --upgrade --output-file=- requirements.in | tee requirements.txt

$ pip-compile --output-file=- > requirements.txt

```
9 changes: 9 additions & 0 deletions afb/afb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'phonenumber_field',
'crispy_forms',
'tailwind',
"crispy_tailwind",
Expand All @@ -54,6 +55,12 @@
CRISPY_TEMPLATE_PACK = "tailwind"


PHONENUMBER_DB_FORMAT = "INTERNATIONAL"
PHONENUMBER_DEFAULT_FORMAT = "E164"
PHONENUMBER_DEFAULT_REGION = 'CA'



MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand All @@ -72,6 +79,8 @@

TAILWIND_APP_NAME = 'theme'

AUTH_USER_MODEL = 'afbcore.User'

INTERNAL_IPS = [
# Add local IP addresses here for tailwind to work, then run:
# * (Dev) `python manage.py tailwind install`
Expand Down
9 changes: 6 additions & 3 deletions afb/afb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
from django.contrib import admin
from django.urls import include, path

from afbcore.views import AboutView, ClientCreateView, CreateClientFormView, DashboardView

from afbcore.views import AboutView, ClientCreateView, CreateClientFormView, DashboardView, MyLoginView
from afbcore.views import ClientRequestView

urlpatterns = [
path('admin/', admin.site.urls),

path('dashboard', DashboardView.as_view()),
path('dashboard', DashboardView.as_view(), name='dashboard'),

path('', CreateClientFormView.as_view()),

Expand All @@ -33,5 +33,8 @@
# See https://django-tailwind.readthedocs.io/en/latest/installation.html#configuration
path('__reload__/', include('django_browser_reload.urls')),

path('request/', ClientRequestView.as_view(), name='create_request'),
path('login/', MyLoginView.as_view(), name='login'),

path('about/', AboutView.as_view()),
]
2 changes: 1 addition & 1 deletion afb/afb/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'afb.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "afb.settings")

application = get_wsgi_application()
9 changes: 9 additions & 0 deletions afb/afbcore/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import Client, Manager, Volunteer, User

admin.site.register(User, UserAdmin)
admin.site.register(Client)
admin.site.register(Manager)
admin.site.register(Volunteer)


# Register your models here.
7 changes: 7 additions & 0 deletions afb/afbcore/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#

from django import forms

from .client import ClientForm


class LoginForm(forms.Form):
username = forms.CharField(max_length=100)
password = forms.CharField(widget=forms.PasswordInput)
Loading

0 comments on commit 479b18e

Please sign in to comment.