Add a pdm script to run code formatters

This commit is contained in:
Adam Goldsmith 2022-02-16 16:32:51 -05:00
parent 24e8bf819b
commit 55bccb930f
2 changed files with 21 additions and 0 deletions

View File

@ -47,6 +47,7 @@ lint = [
[tool.pdm.scripts] [tool.pdm.scripts]
start = "./manage.py runserver" start = "./manage.py runserver"
fmt.shell = "black . && djlint --reformat ."
[build-system] [build-system]
requires = ["pdm-pep517"] requires = ["pdm-pep517"]

20
rentals/forms.py Normal file
View File

@ -0,0 +1,20 @@
from django import forms
from rentals.models import LockerInfo
class BoostrapModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field in self.fields.values():
field.widget.attrs["class"] = "form-control"
class LockerInfoForm(BoostrapModelForm):
class Meta:
model = LockerInfo
fields = [
"blind_code",
"bitting_code",
"renter",
]