diff --git a/Makefile b/Makefile index 9eec126..094204c 100644 --- a/Makefile +++ b/Makefile @@ -24,3 +24,6 @@ upload-testpypi: i-have-tested-with-testpypi-and-am-ready-to-release: python3 -m twine upload --repository pypi dist/django_admin_confirm-$(VERSION)* + +install-testpypi: + python -m pip install --index-url https://test.pypi.org/simple/ django_admin_confirm diff --git a/README.md b/README.md index 04f5167..71fa10b 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,42 @@ pip install -e . make run ``` +### Release process + +Honestly this part is just for my reference. But who knows :) maybe we'll have another maintainer in the future. + +Run tests, check coverage, check readme, run tox + +``` +make test +make check-readme +tox +``` + +Update version in `setup.py` + +``` +make package +make upload-testpypi +``` + +Install new version locally +First you have to uninstall if you used `pip install -e` earlier + +``` +pip uninstall django_admin_confirm +make install-testpypi +``` + +Update version in `requirements.txt` +Add test locally + +``` +make run +``` + +Go on github and make a release in UI + ## Feature List This is a list of features which could potentially be added in the future. Some of which might make more sense in their own package. diff --git a/admin_confirm/admin.py b/admin_confirm/admin.py index f5f0e61..1a777e6 100644 --- a/admin_confirm/admin.py +++ b/admin_confirm/admin.py @@ -147,6 +147,9 @@ class AdminConfirmMixin: else: # Parse the changed data - Note that using form.changed_data would not work because initial is not set for name, field in form.fields.items(): + # Since the form considers initial as the value first shown in the form + # It could be incorrect when user hits save, and then hits "No, go back to edit" + obj.refresh_from_db() initial_value = getattr(obj, name) new_value = getattr(new_object, name) if ( diff --git a/requirements.txt b/requirements.txt index 48ea57d..b11c86a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ Django>=1.7.0 factory-boy~=3.0.1 -django-admin-confirm~=0.2.1 +django-admin-confirm~=0.2.2 coverage~=5.4 pytest~=6.2.2 tox~=3.21.4 diff --git a/setup.py b/setup.py index 300be52..0de82f3 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ README = open(os.path.join(here, "README.md")).read() setup( name="django-admin-confirm", - version="0.2.1", + version="0.2.2", packages=["admin_confirm"], description="Adds confirmation to Django Admin changes, additions and actions", long_description_content_type="text/markdown",