forked from pinax/pinax-models
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated setup.py / versioning / and other meta files
- Loading branch information
Showing
10 changed files
with
141 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2010, 2011 Patrick Altman | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of Patrick Altman nor the names of its contributors may | ||
be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include LICENSE | ||
include README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Django Logical Delete | ||
===================== | ||
|
||
This is a small and simple app that I threw together to get some reuse out of | ||
something I do in nearly every project and every model I create. It's too easy | ||
for good data to get deleted and it be unrecoverable. It's also too easy to | ||
fix this by overriding the model's delete() method and just flagging records | ||
as deleted and then leveraging Django's Managers to override default behavior | ||
so that logically deleted items are not returned in querysets. | ||
|
||
There are two exceptions however, that I have found useful to this rule. | ||
|
||
#. In the admin I like to see everything with an indicator of whether or not | ||
it has been deleted, with the ability to filter down to just active records, | ||
(or deleted for that matter). | ||
#. I still think it is a valid request when an item is fetched for by it's | ||
primary key value, that the object should return, even if it is marked as | ||
deleted. | ||
|
||
|
||
Installing django-logicaldelete | ||
------------------------------- | ||
|
||
:: | ||
|
||
pip install django-logicaldelete | ||
|
||
|
||
Using django-logicaldelete | ||
-------------------------- | ||
|
||
Using the app is pretty simple: | ||
|
||
#. add `logicaldelete` to your INSTALLED_APPS | ||
#. Inherit from `logicaldelete.models.Model` for all models that you wish to | ||
share in this functionality. | ||
#. Create and/or Register admins for each of these models using `logicaldelete.admin.ModelAdmin` | ||
|
||
|
||
Additional | ||
---------- | ||
|
||
Logical deletes are handled by date stamping a `date_removed` column. In addition, a `date_created` and `date_modified` columns will be populated as a convenience. | ||
|
||
|
||
Backwards Incompatible Changes | ||
------------------------------ | ||
|
||
1.1 | ||
*** | ||
|
||
* Changed `everything` to `all_with_deleted` on LogicalDeleteManager | ||
* LogicalDeleteManager moved from `logicaldelete.models` to `logicaldelete.managers` | ||
* Removed `deleted` and `everything` querysets from `logicaldelete.models.Model` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
VERSION = (1, 1, 0, "b", 0) # following PEP 386 | ||
DEV_N = 1 | ||
POST_N = 0 | ||
|
||
|
||
def build_version(): | ||
version = "%s.%s" % (VERSION[0], VERSION[1]) | ||
if VERSION[2]: | ||
version = "%s.%s" % (version, VERSION[2]) | ||
if VERSION[3] != "f": | ||
version = "%s%s%s" % (version, VERSION[3], VERSION[4]) | ||
if DEV_N: | ||
version = "%s.dev%s" % (version, DEV_N) | ||
elif POST_N > 0: | ||
version = "%s.post%s" % (version, POST_N) | ||
return version | ||
|
||
|
||
__version__ = build_version() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[build_sphinx] | ||
source-dir = docs/ | ||
build-dir = docs/_build | ||
all_files = 1 | ||
|
||
[upload_sphinx] | ||
upload-dir = docs/_build/html | ||
docs-dir = docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
from setuptools import setup, find_packages | ||
from setuptools import setup | ||
|
||
VERSION = __import__("logicaldelete").__version__ | ||
|
||
|
||
setup( | ||
name='logicaldelete', | ||
version = '1.0', | ||
author='Patrick Altman', | ||
author_email='paltman@gmail.com', | ||
url='http://github.com/paltman/django-logicaldelete', | ||
description="""django-logicaldelete is a base model that provides some extras for your models.""", | ||
packages=find_packages(), | ||
namespace_packages = [], | ||
include_package_data = True, | ||
zip_safe=False, | ||
license='MIT', | ||
install_requires=[ | ||
'django', | ||
] | ||
name = "logicaldelete", | ||
version = VERSION, | ||
author = "Patrick Altman", | ||
author_email = "paltman@gmail.com", | ||
url = "http://github.com/paltman/django-logicaldelete", | ||
description = "a base model that provides built in logical delete functionality", | ||
long_description = open("README.rst").read(), | ||
packages = [ | ||
"logicaldelete" | ||
], | ||
license="BSD", | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: BSD License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Framework :: Django", | ||
] | ||
) |