Skip to content

Commit

Permalink
updated setup.py / versioning / and other meta files
Browse files Browse the repository at this point in the history
  • Loading branch information
paltman committed Feb 19, 2011
1 parent 78df9d4 commit ffa1b4d
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 88 deletions.
27 changes: 27 additions & 0 deletions LICENSE
@@ -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.
2 changes: 2 additions & 0 deletions MANIFEST.in
@@ -0,0 +1,2 @@
include LICENSE
include README.rst
67 changes: 0 additions & 67 deletions README.md

This file was deleted.

54 changes: 54 additions & 0 deletions README.rst
@@ -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`
6 changes: 3 additions & 3 deletions docs/source/conf.py
Expand Up @@ -38,16 +38,16 @@

# General information about the project.
project = u'django-logicaldelete'
copyright = u'2010, Patrick Altman'
copyright = u'2010-2011, Patrick Altman'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0'
version = '1.1'
# The full version, including alpha/beta/rc tags.
release = '1.0'
release = '1.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 4 additions & 2 deletions docs/source/index.rst
Expand Up @@ -13,13 +13,15 @@ Contents:
The Basics
==========

```django-logicaldelete```'s entire purpose is to make your life easier while
working with models. It provides a number of features:
```django-logicaldelete``` aims to provide a consistent interface for managing
logical deletion of models also reducing the need to implement functionality at
the model level:

#. Logical Deletion instead of Physical Deletion
#. Admin that can reveal which records are "Deleted" and allow you to reverse it.
#. Provides some short cuts in a Manager.


Indices and tables
==================

Expand Down
19 changes: 19 additions & 0 deletions logicaldelete/__init__.py
@@ -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()
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

8 changes: 8 additions & 0 deletions setup.cfg
@@ -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/
39 changes: 24 additions & 15 deletions setup.py
@@ -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",
]
)

0 comments on commit ffa1b4d

Please sign in to comment.