Skip to content

Commit

Permalink
Merge pull request #34 from moshthepitt/add-django-model-reviews
Browse files Browse the repository at this point in the history
Add django model reviews
  • Loading branch information
moshthepitt authored Jun 23, 2020
2 parents 99fd555 + 39dc6ad commit e2156d1
Show file tree
Hide file tree
Showing 45 changed files with 2,918 additions and 2,424 deletions.
6 changes: 6 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name-template: v$NEXT_PATCH_VERSION
tag-template: v$NEXT_PATCH_VERSION
template: |
## What’s Changed
$CHANGES
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
exclude: '/snapshots/'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
Expand Down
5 changes: 3 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extension-pkg-whitelist=

# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS,tests,migrations,local_settings.py
ignore=CVS,tests,migrations,local_settings.py,snapshots

# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
Expand Down Expand Up @@ -126,7 +126,8 @@ disable=print-statement,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating
dict-values-not-iterating,
bad-continuation

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ include LICENSE
include README.md
recursive-include small_small_hr/static *
recursive-include small_small_hr/templates *

recursive-exclude tests *
2 changes: 2 additions & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ black
pre-commit
mypy
tblib
snapshottest
freezegun
47 changes: 29 additions & 18 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,77 +6,88 @@
#

appdirs==1.4.4 # via black, virtualenv
asgiref==3.2.7 # via django
astroid==2.4.1 # via pylint
asgiref==3.2.10 # via django
astroid==2.4.2 # via pylint
attrs==19.3.0 # via black
autopep8==1.5.3
babel==2.8.0 # via django-phonenumber-field
backcall==0.1.0 # via ipython
backcall==0.2.0 # via ipython
black==19.10b0
cfgv==3.1.0 # via pre-commit
click==7.1.2 # via black
coverage==5.1
decorator==4.4.2 # via ipython, traitlets
distlib==0.3.0 # via virtualenv
django-braces==1.14.0 # via django-model-reviews
django-contrib-comments==1.9.2 # via django-model-reviews
django-crispy-forms==1.9.1
django-js-asset==1.2.2 # via django-mptt
django-model-reviews==1.0.2
django-mptt==0.11.0
django-phonenumber-field==4.0.0
django-private-storage==2.2.2
django==3.0.7 # via django-phonenumber-field, djangorestframework, model-mommy
django==3.0.7 # via django-braces, django-contrib-comments, django-model-reviews, django-mptt, django-phonenumber-field, djangorestframework, model-mommy
djangorestframework==3.11.0
fastdiff==0.2.0 # via snapshottest
filelock==3.0.12 # via tox, virtualenv
flake8==3.8.2
identify==1.4.19 # via pre-commit
flake8==3.8.3
freezegun==0.3.15
identify==1.4.20 # via pre-commit
importlib-metadata==1.6.1 # via flake8, importlib-resources, pluggy, pre-commit, tox, virtualenv
importlib-resources==1.5.0 # via pre-commit, virtualenv
ipdb==0.13.2
importlib-resources==2.0.1 # via pre-commit, virtualenv
ipdb==0.13.3
ipython-genutils==0.2.0 # via traitlets
ipython==7.15.0 # via ipdb
isort==4.3.21
jedi==0.17.0 # via ipython
jedi==0.17.1 # via ipython
lazy-object-proxy==1.4.3 # via astroid
mccabe==0.6.1 # via flake8, pylint
model-mommy==2.0.0
mypy-extensions==0.4.3 # via mypy
mypy==0.780
mypy==0.782
nodeenv==1.4.0 # via pre-commit
packaging==20.4 # via tox
parso==0.7.0 # via jedi
pathspec==0.8.0 # via black
pep8==1.7.1
pexpect==4.8.0 # via ipython
phonenumberslite==8.12.5
phonenumberslite==8.12.6
pickleshare==0.7.5 # via ipython
pillow==7.1.2
pluggy==0.13.1 # via tox
pre-commit==2.4.0
pre-commit==2.5.1
prompt-toolkit==3.0.5 # via ipython
psycopg2-binary==2.8.5
ptyprocess==0.6.0 # via pexpect
py==1.8.1 # via tox
py==1.8.2 # via tox
pycodestyle==2.6.0
pydocstyle==5.0.2
pyflakes==2.2.0 # via flake8
pygments==2.6.1 # via ipython
pylint-django==2.0.15
pylint-plugin-utils==0.6 # via pylint-django
pylint==2.5.2
pylint==2.5.3
pyparsing==2.4.7 # via packaging
python-dateutil==2.8.1 # via freezegun
pytz==2020.1 # via babel, django
pyyaml==5.3.1 # via pre-commit
regex==2020.5.14 # via black
six==1.15.0 # via astroid, packaging, tox, traitlets, virtualenv
regex==2020.6.8 # via black
six==1.15.0 # via astroid, django-braces, django-contrib-comments, freezegun, packaging, python-dateutil, snapshottest, tox, traitlets, virtualenv
snapshottest==0.5.1
snowballstemmer==2.0.0 # via pydocstyle
sorl-thumbnail==12.6.3
sqlparse==0.3.1 # via django
tblib==1.6.0
termcolor==1.1.0 # via snapshottest
toml==0.10.1 # via autopep8, black, pre-commit, pylint, tox
tox==3.15.2
traitlets==4.3.3 # via ipython
typed-ast==1.4.1 # via astroid, black, mypy
typing-extensions==3.7.4.2 # via mypy
virtualenv==20.0.21 # via pre-commit, tox
virtualenv==20.0.25 # via pre-commit, tox
voluptuous==0.11.7
wcwidth==0.2.3 # via prompt-toolkit
wasmer==0.4.1 # via fastdiff
wcwidth==0.2.5 # via prompt-toolkit
wrapt==1.12.1 # via astroid
yapf==0.30.0
zipp==3.1.0 # via importlib-metadata, importlib-resources
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ line_length = 88

[flake8]
max-line-length=90
exclude = migrations
exclude = migrations, snapshots

[pycodestyle]
max-line-length=90
36 changes: 27 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
"""
Setup.py for small_small_hr
"""
from os import path
"""Setup.py for small_small_hr."""
import os
import sys

from setuptools import find_packages, setup

import small_small_hr as sshr

# read the contents of your README file
with open(
path.join(path.abspath(path.dirname(__file__)), "README.md"),
encoding="utf-8") as f:
os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md"),
encoding="utf-8",
) as f:
LONG_DESCRIPTION = f.read()

# convenience command to publish
if sys.argv[-1] == "publish":
if os.system("pip freeze | grep twine"):
print("twine not installed.\nUse `pip install twine`.\nExiting.")
sys.exit()
os.system("rm -rf build/ *.egg-info/")
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/* --skip-existing")
print("You probably want to also tag the version now:")
print(f" git tag -a v{sshr.__version__} -m 'version {sshr.__version__}'")
print(" git push --tags")
sys.exit()

setup(
name="small-small-hr",
version=__import__("small_small_hr").__version__,
version=sshr.__version__,
description="Minimal human resource management app for Django",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
license="MIT",
author="Kelvin Jayanoris",
author_email="[email protected]",
url="https://github.com/moshthepitt/small-small-hr",
packages=find_packages(exclude=["docs", "tests"]),
packages=find_packages(exclude=["docs", "*.egg-info", "build", "tests.*", "tests"]),
install_requires=[
"Django >= 2.0.11",
"Django >= 2.2",
"voluptuous",
"psycopg2-binary",
"sorl-thumbnail",
"django-private-storage",
"django-model-reviews",
"phonenumberslite",
"django-phonenumber-field",
"django-crispy-forms",
"djangorestframework",
"sorl-thumbnail",
"Pillow",
"django-mptt",
],
classifiers=[
"Programming Language :: Python",
Expand All @@ -44,4 +61,5 @@
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
],
include_package_data=True,
)
6 changes: 2 additions & 4 deletions small_small_hr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""
Main init file for small_small_hr
"""
VERSION = (0, 1, 9)
"""Main init file for small_small_hr."""
VERSION = (0, 2, 0)
__version__ = ".".join(str(v) for v in VERSION)
# pylint: disable=invalid-name
default_app_config = "small_small_hr.apps.SmallSmallHrConfig" # noqa
26 changes: 24 additions & 2 deletions small_small_hr/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,45 @@
Apps module for small-small-hr
"""
from django.apps import AppConfig
from django.db.models.signals import post_migrate
from django.utils.translation import gettext_lazy as _


def mptt_callback(sender, **kwargs): # pylint: disable=unused-argument
"""
Rebuild mptt tree.
We need to do this so that for existing objects we can rebuild the mptt tree
and set correct values for all the mptt fields. This is necessary because we
need to remove the defaults placed in the migrations file.
"""
# pylint: disable=import-outside-toplevel
from small_small_hr.models import StaffProfile

StaffProfile.objects.rebuild()


class SmallSmallHrConfig(AppConfig):
"""Apps config class."""
name = 'small_small_hr'
app_label = 'small_small_hr'

name = "small_small_hr"
app_label = "small_small_hr"
verbose_name = _("Small Small HR")

def ready(self):
"""Do stuff when the app is ready."""
# pylint: disable=import-outside-toplevel,unused-import

# post migrate function
post_migrate.connect(mptt_callback, sender=self)

# signals
import small_small_hr.signals # noqa

# set up app settings
from django.conf import settings
import small_small_hr.settings as defaults

for name in dir(defaults):
if name.isupper() and not hasattr(settings, name):
setattr(settings, name, getattr(defaults, name))
9 changes: 9 additions & 0 deletions small_small_hr/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Constants."""
HOURS = "hours"
MINUTES = "minutes"
STAFF = "staff"
OVERTIME_APPLICATION_EMAIL_TEMPLATE = "overtime_application"
OVERTIME_COMPLETED_EMAIL_TEMPLATE = "overtime_completed"
LEAVE_APPLICATION_EMAIL_TEMPLATE = "leave_application"
LEAVE_COMPLETED_EMAIL_TEMPLATE = "leave_completed"
EMAIL_TEMPLATE_PATH = "small_small_hr/email"
Loading

0 comments on commit e2156d1

Please sign in to comment.