diff --git a/admin_confirm/admin.py b/admin_confirm/admin.py index 0581864..834076d 100644 --- a/admin_confirm/admin.py +++ b/admin_confirm/admin.py @@ -1,10 +1,10 @@ from django.contrib.admin.exceptions import DisallowedModelAdminToField -from django.contrib.admin.utils import flatten_fieldsets, quote, unquote +from django.contrib.admin.utils import flatten_fieldsets, unquote from django.core.exceptions import PermissionDenied -from django.template.response import SimpleTemplateResponse, TemplateResponse -from django.contrib.admin.options import TO_FIELD_VAR, IS_POPUP_VAR -from django.utils.translation import gettext as _, ngettext +from django.template.response import TemplateResponse +from django.contrib.admin.options import TO_FIELD_VAR +from django.utils.translation import gettext as _ class AdminConfirmMixin(object): @@ -38,9 +38,8 @@ class AdminConfirmMixin(object): ) def change_view(self, request, object_id=None, form_url="", extra_context=None): - self.message_user(request, f"{request.POST}") + # self.message_user(request, f"{request.POST}") if request.method == "POST" and request.POST.get("_change_needs_confirmation"): - self.message_user(request, "Needs confirmation was inside the request") return self._change_confirmation_view( request, object_id, form_url, extra_context ) @@ -80,7 +79,6 @@ class AdminConfirmMixin(object): ) # Should we be validating the data here? Or just pass it to super? - form = ModelForm(request.POST, request.FILES, obj) form_validated = form.is_valid() if form_validated: @@ -88,7 +86,6 @@ class AdminConfirmMixin(object): else: new_object = form.instance - # End code copied from Django sourcecode if add: title = _("Add %s") elif self.has_change_permission(request, obj): @@ -101,13 +98,13 @@ class AdminConfirmMixin(object): save_action = action break + # Parse raw form data from POST form_data = {} for key in request.POST: if key.startswith("_") or key == 'csrfmiddlewaretoken': continue form_data[key] = request.POST.get(key) - # { k: v for k, v in request.POST.\\ if not(k.startswith('_') or k == 'csrfmiddlewaretoken')} context = { **self.admin_site.each_context(request), diff --git a/admin_confirm/template_tags/admin_modify.py b/admin_confirm/template_tags/admin_modify.py deleted file mode 100644 index bcebf7e..0000000 --- a/admin_confirm/template_tags/admin_modify.py +++ /dev/null @@ -1,18 +0,0 @@ -# import json -# -# from django import template -# from django.template.context import Context -# -# from django.contrib.admin.templatetags import admin_modify -# -# from django.contrib.admin.templatetags.base import InclusionAdminNode -# -# register = template.Library() -# -# def submit_row(context): -# ctx = admin_modify.submit_row(context) -# -# -# @register.tag(name='submit_row') -# def submit_row_tag(parser, token): -# return InclusionAdminNode(parser, token, func=submit_row, template_name='submit_line.html') \ No newline at end of file diff --git a/admin_confirm/templates/admin/change_confirmation.html b/admin_confirm/templates/admin/change_confirmation.html index 918cae6..83a139d 100644 --- a/admin_confirm/templates/admin/change_confirmation.html +++ b/admin_confirm/templates/admin/change_confirmation.html @@ -26,7 +26,6 @@ {% for key, value in form_data.items %} {% endfor %} -{# #} {% if is_popup %}{% endif %} {% if to_field %}{% endif %} diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d4bb2cb..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index bbe7723..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,52 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = 'Django Admin Confirm' -copyright = '2020, Thu Trang Pham' -author = 'Thu Trang Pham' - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 2009be8..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. Django Admin Confirm documentation master file, created by - sphinx-quickstart on Sat Oct 31 14:11:56 2020. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to Django Admin Confirm's documentation! -================================================ - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 2119f51..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/tests/market/tests.py b/tests/market/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/tests/market/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/tests/market/views.py b/tests/market/views.py deleted file mode 100644 index 91ea44a..0000000 --- a/tests/market/views.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/tests/testproject/urls.py b/tests/testproject/urls.py index 7843628..dfc7362 100644 --- a/tests/testproject/urls.py +++ b/tests/testproject/urls.py @@ -1,18 +1,3 @@ -"""testproject URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/3.0/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin from django.urls import path diff --git a/tests/testproject/wsgi.py b/tests/testproject/wsgi.py index da80dde..8ad347a 100644 --- a/tests/testproject/wsgi.py +++ b/tests/testproject/wsgi.py @@ -1,12 +1,3 @@ -""" -WSGI config for testproject project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ -""" - import os from django.core.wsgi import get_wsgi_application