Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
6c687e9
Added connection argument to get_db_prep_value
schinckel Nov 8, 2010
e43faf4
Added prepared argument to get_db_prep_value
schinckel Nov 8, 2010
c9874f9
Merge branch 'master' of https://github.com/schinckel/django-picklefield
gintas Nov 10, 2010
044a83d
Cosmetic fix: the interface default for `prepared` in get_db_prep_val…
gintas Nov 10, 2010
23fbafc
Updated changelog, bumped version to 0.1.9.
gintas Nov 10, 2010
d64acf3
Make sure objects such as `django.db.Model` subclasses can be pickled…
charettes Feb 2, 2012
1e0a389
Merge pull request #3 from charettes/wrap-conflictual-objects
gintas Feb 17, 2012
6e50176
Use optimize() instead of deepcopy.
gintas Feb 18, 2012
671886f
Updated changelog.
gintas Feb 18, 2012
24ef543
Revert "Use optimize() instead of deepcopy."
gintas Feb 18, 2012
f28a7c4
Bumped version to 0.2.0.
gintas Feb 18, 2012
4cdc56b
Make sure ObjectWrapper is considered internal and is optimized it wi…
charettes Apr 6, 2012
54b11bd
Merge pull request #5 from charettes/wrap-conflictual-objects
gintas Apr 10, 2012
0c50199
Added classifiers and requirements to setup.py
rafales Dec 3, 2012
bf3a432
Added settings and script for running tests
rafales Dec 4, 2012
fe74ffb
Python 3 support
rafales Dec 4, 2012
2de5d7f
Merge pull request #7 from rafales/feature/py3-support
gintas Dec 9, 2012
44e7e4e
Bumped version to 0.3, updated changelog.
gintas Dec 9, 2012
05c6c0f
Favor the built-in json module.
charettes Jan 29, 2013
467844d
Merge pull request #9 from charettes/patch-1
gintas Nov 7, 2013
8714210
Bumped version to 0.3.1
gintas Nov 15, 2013
857ff99
Updated runtests script.
gintas Nov 15, 2013
50b7fac
Used Tox to test against supported Django versions.
charettes Sep 3, 2015
90bf54c
Added a TravisCI configuration file.
charettes Sep 3, 2015
4748493
Fixed a test failure against Django 1.7+.
charettes Sep 3, 2015
ad0d5e6
Dropped Django 1.3 support.
charettes Sep 3, 2015
7ec0333
Fixed #8 -- Removed dependency on six.
charettes Sep 3, 2015
9cabb40
Fixed #15 -- Stopped using models.SubfieldBase on Django 1.8+
charettes Sep 3, 2015
231b65c
Removed a Python 2.5 comptability shim.
charettes Sep 3, 2015
8788164
Added the .rst extension to the README.
charettes Sep 3, 2015
7323e75
Stopped using the deprecated assertEquals method in tests.
charettes Sep 3, 2015
c3f1f44
Silenced a pesky system check on Django 1.7
charettes Sep 3, 2015
ad71fe9
Simplified test settings to avoid unnecessary table creation.
charettes Sep 3, 2015
9f8b2cc
Avoid using the deprecated _get_val_from_obj method.
charettes Sep 3, 2015
e8ce88e
Adjusted the release not and the actual version.
charettes Sep 3, 2015
4345979
Fixed some formating issues in the README.
charettes Sep 3, 2015
f186744
Removed some dead code.
charettes Sep 3, 2015
6ab8859
Tracked coverage with coveralls
charettes Sep 3, 2015
5329100
Added TravisCI and Coveralls badges to the README.
charettes Sep 3, 2015
b435b31
Django 1.4 actually ships with six.
charettes Sep 3, 2015
9261104
The force_text method is also available from Django 1.4+.
charettes Sep 3, 2015
1f01772
Install South when testing against 1.4 to increase coverage.
charettes Sep 3, 2015
7a9d83d
Run flake8 as part of the CI to detect pep8 violations.
charettes Sep 3, 2015
bd8ecc7
Run isort as part of the CI to define an expected import order.
charettes Sep 4, 2015
a300ebc
Made sure to use universal wheels.
charettes Sep 6, 2015
855e1a7
Added Django 1.9, 1.10 to tox. Dropped support for Python 2.6.
felixxm Oct 6, 2016
f17929d
Merge pull request #20 from felixxm/master
charettes Oct 6, 2016
fcc608c
Fixed #21 -- Used get_lookup instead get_db_prep_lookup
felixxm Oct 22, 2016
612e817
Merge pull request #22 from felixxm/issue-21
charettes Oct 22, 2016
bd98749
Increased fields.py test coverage
felixxm Oct 22, 2016
20a7e6b
Merge pull request #23 from felixxm/increase-test-coverage
charettes Oct 24, 2016
252fe4d
Added Django 1.11 to tox an travis configurations.
felixxm Jan 22, 2017
fc890ad
Merge pull request #24 from felixxm/bumped-django-versions
charettes Jan 22, 2017
a0e3aff
Removed Django 1.11 from the allowed failures.
felixxm May 6, 2017
f5bb127
Removed Python 2.6 from setup.py.
felixxm May 6, 2017
32171cc
Merge pull request #26 from felixxm/django-1.11
charettes May 6, 2017
e54d336
Merge pull request #27 from felixxm/python-2.6
charettes May 6, 2017
ed33b3c
Allow users to skip the copy step
jarshwah Jun 25, 2017
297d7cc
Dropped support for old Python and Django versions.
jarshwah Jun 25, 2017
ccf11bc
Merge pull request #30 from jarshwah/master
charettes Jun 29, 2017
87a5508
Remove SubfieldBase shim now that we only support Django 1.8+.
charettes Jun 29, 2017
99c3956
Merge pull request #31 from gintas/drop-subfieldbase-compat
charettes Jun 29, 2017
0dcdb06
Bumped version to 1.0.0.
charettes Jun 29, 2017
26e39b1
Add Django 2 explicitly to the list of tested versions
cdman May 17, 2018
be27286
Merge pull request #35 from gpanther/add-django-2-to-testing
charettes May 18, 2018
c587b65
Adjust Django 2.0 tox target.
charettes May 18, 2018
cb65ac3
Run CI against Django 2.1.
charettes May 18, 2018
220f6b3
Drop support for unsupported versions of Django.
charettes May 18, 2018
fc43e9f
Stop running CI against Django master/Python 3.4.
charettes May 18, 2018
8ff8e98
Bumped version number to 1.1.0.
charettes May 18, 2018
2c188c4
Fix RemovedInDjango30Warning on Django > 2.0
canarduck Nov 8, 2018
ebafbce
Merge pull request #39 from canarduck/master
charettes Nov 8, 2018
d019903
Removed unused models module.
charettes Nov 25, 2018
3669520
Removed stale South reference.
charettes Nov 25, 2018
00fc121
Updated license and ownership details.
charettes Nov 25, 2018
93bc477
Fixed #25 -- Included README.rst and the LICENSE in the distributed p…
charettes Nov 25, 2018
414c50d
Massive restructuration of the project layout for easier maintenance.
charettes Nov 25, 2018
f3a9260
Use snake case for test method names.
charettes Nov 25, 2018
7dcef23
Exposed package version metadata.
charettes Nov 25, 2018
d3e2055
Prepared 2.0 release.
charettes Nov 25, 2018
98be5f7
Removed bare exception catching.
charettes Nov 25, 2018
7dc7695
Adjusted imports and isort configuration.
charettes Nov 25, 2018
4aa0ea6
Removed duplicated LICENSE header in setup.py.
charettes Nov 25, 2018
500ab1f
Added extra badges to the README.
charettes Nov 25, 2018
dfa4f6e
Made some adjustments to the README.
charettes Nov 25, 2018
46e229e
Disallowed empty strings for PickledObjectField.
cdman May 17, 2018
05fcbd1
Adjusted code examples in the README.
charettes Nov 25, 2018
81323f2
Fixed #34 -- Added a check for mutable PickledObjectField default.
charettes Nov 25, 2018
7d1ebfe
Allowed TravisCI to upload Pypi package on tags.
charettes Nov 25, 2018
65afd88
Adjusted README paths of build and coverage statuses.
charettes Nov 25, 2018
3775860
Improve travis script & switch to bionic beaver (python 3.8)
joehybird Jan 23, 2020
728d084
Improve coverage reporting
joehybird Jan 23, 2020
e0da79b
Add support for Django 2.2
joehybird Jan 23, 2020
e21c854
Drop support for Django 2.0 & 2.1
joehybird Jan 23, 2020
3745f2f
Drop support of python 3.4
joehybird Jan 24, 2020
31a4a64
Merge pull request #46 from joehybird/master
charettes Jan 27, 2020
ebdbc7b
Release 2.1.0.
charettes Jan 28, 2020
0532d16
Adjust package building logic to account for recent changes.
charettes Jan 28, 2020
6af2ec7
Remove Python 3.4 classifier from supported Python versions.
charettes Jan 28, 2020
2405a2a
Release 2.1.1 to account for packaging issues.
charettes Jan 28, 2020
1abc2f6
docs: Fix simple typo, idential -> identical
timgates42 Mar 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
source = picklefield
branch = True

[report]
exclude_lines =
pragma: no cover
except ImportError:
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.pyc
*.pyo
/build
/dist
/temp
/src/django_picklefield.egg-info

syntax:glob
*.py[co]
dist/
django_picklefield.egg-info/*
build/
.coverage
.tox
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
dist: bionic
sudo: false
language: python
cache: pip
python:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
stages:
- lint
- test
jobs:
fast_finish: true
include:
- { stage: lint, env: TOXENV=flake8, python: 3.6 }
- { stage: lint, env: TOXENV=isort, python: 3.6 }

install:
- pip install tox coveralls tox-travis
script:
- tox
after_success:
- if [ -f .coverage ]; then coveralls; fi
before_deploy: "pip install django"
deploy:
provider: pypi
user: charettes
password:
secure: Ix/iLGKu+usjaNGPIKRzvgdZz8TVxReiMFLorgMpHb9P29tgIBQSDzVmo8gzUi+LF4SQs2AdnuYJY15ap68JX7iLfCuWWYIvIqgMLb3W64jfUDg9KpLJQYCv6cTKQHoDVtVTg0jXJmauEYMMYuqmdrSgZ6rSfpsbajMrveCzVuStb7kd5H4WPX3/j4JfCmr07CyAi85rLAnaIfmCYADWC4nrYll7+0Ugke64C4KstY0l6HYBNTT5ZwJvXSNd0VQd31b5okv8bwjGXzeVrbgIAe+c1p0lS11hsNqfLL/rrnlvgC7P7568TxGwWVmIDJm131r1K7skLscEfCuPbJJ3oqljxLQMQIJ4JbR12HtRwB93dOnJOgCbqySAJAZHUvkm2r3VAO8BJK3xYnJg/2IGrxolDQxwJi2SMEgwqQZx3thTFKXvviiWn5dnLjiNRpSOHUzayCVYga7WAgVksKVMbmtcNrJWwrAHtWLxo9vnM2W+6JNFeXiGIIwGu7qJ/Sz/qCuv/uKibbFqhUJfATXf5HhSJ3yIM/Ef04/SSpBqkYcFcrGLdzzW2Bpv4jscv4EcNyGDxnzeJtvXWVceoW0g7XweUn4b5P+NvOSV4YCjJ04BU4r/upV7+ulkQxnCWot2MD0zhvlodldn+6tGfdBbYJ/KlBHQjwdjFFKaxqRkuyA=
distributions: sdist bdist_wheel
on:
tags: true
condition: "$TRAVIS_PYTHON_VERSION = 2.7"
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2009-2010 Gintautas Miliauskas
Copyright (c) 2011-2018 Simon Charette

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE
include README.rst
150 changes: 130 additions & 20 deletions README → README.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
django-picklefield
==================

.. image:: https://img.shields.io/pypi/l/django-picklefield.svg?style=flat
:target: https://pypi.python.org/pypi/django-picklefield/
:alt: License

.. image:: https://img.shields.io/pypi/v/django-picklefield.svg?style=flat
:target: https://pypi.python.org/pypi/django-picklefield/
:alt: Latest Version

.. image:: https://travis-ci.org/gintas/django-picklefield.svg?branch=master
:target: https://travis-ci.org/gintas/django-picklefield
:alt: Build Status

.. image:: https://coveralls.io/repos/gintas/django-picklefield/badge.svg?branch=master
:target: https://coveralls.io/r/gintas/django-picklefield?branch=master
:alt: Coverage Status

.. image:: https://img.shields.io/pypi/pyversions/django-picklefield.svg?style=flat
:target: https://pypi.python.org/pypi/django-picklefield/
:alt: Supported Python Versions

.. image:: https://img.shields.io/pypi/wheel/django-picklefield.svg?style=flat
:target: https://pypi.python.org/pypi/django-picklefield/
:alt: Wheel Status

-----
About
-----

**django-picklefield** provides an implementation of a pickled object field.
Such fields can contain any picklable objects.

The implementation is taken and adopted from Django snippet #1694
<http://www.djangosnippets.org/snippets/1694/> by Taavi Taijala, which is in
turn based on Django snippet #513 <http://www.djangosnippets.org/snippets/513/>
by Oliver Beattie.
The implementation is taken and adopted from `Django snippet #1694`_ by Taavi
Taijala, which is in turn based on `Django snippet #513`_ by Oliver Beattie.

django-picklefield is available under the MIT license.

.. _Django snippet #1694: http://www.djangosnippets.org/snippets/1694/
.. _Django snippet #513: http://www.djangosnippets.org/snippets/513/

-----
Usage
Expand All @@ -20,13 +47,17 @@ Usage
First of all, you need to have **django-picklefield** installed; for your
convenience, recent versions should be available from PyPI.

To use, just define a field in your model::
To use, just define a field in your model:

.. code:: python

>>> from picklefield.fields import PickledObjectField
... class SomeObject(models.Model):
... args = PickledObjectField()

and assign whatever you like (as long as it's picklable) to the field::
and assign whatever you like (as long as it's picklable) to the field:

.. code:: python

>>> obj = SomeObject()
>>> obj.args = ['fancy', {'objects': 'inside'}]
Expand All @@ -44,6 +75,23 @@ base64-encoded pickles, which allows reliable deserialization, but such a
format is not convenient for parsing in the browser. By overriding
``value_to_string()`` you can choose a more convenient serialization format.

Fields now accept the boolean key word argument `copy`, which defaults to
`True`. The `copy` is necessary for lookups to work correctly. If you don't
care about performing lookups on the picklefield, you can set `copy=False` to
save on some memory usage. This an be especially beneficial for very large
object trees.

-------------
Running tests
-------------

The full test suite can be run with `Tox`_::

>>> pip install tox
>>> tox

.. _Tox: https://testrun.org/tox/latest/

--------------
Original notes
--------------
Expand Down Expand Up @@ -114,55 +162,117 @@ since it is never a good idea to have a PickledObjectField be user editable.
Changes
-------

Changes in version 2.1.0
========================

* Added official support for Django 2.2 (thanks to joehybird).
* Dropped support for Django 2.0 and 2.1 (thanks to joehybird).
* Dropped support for Python 3.4 (thanks to joehybidd).

Changes in version 2.0.0
========================

* Silenced ``RemovedInDjango30Warning`` warnings on Django 2.0+ (thanks to
canarduck).
* Restructured project directories.
* Disallowed the usage of empty strings for ``PickledObjectField``. That makes
``.save()``, ``.create()``, etc. raise ``IntegrityError`` if `null` is not
``True`` and no default value was specified like built-in fields do
(thanks to Attila-Mihaly Balazs).
* Added a check for mutable default values to ``PickledObjectField``.

Changes in version 1.1.0
========================

* Added support for Django 2.1 and dropped support for Django < 1.11.

Changes in version 1.0.0
========================

* Added a new option to prevent a copy of the object before pickling: `copy=True`
* Dropped support for Django 1.4
* Dropped support for Django 1.7
* Dropped support for Python 3.2
* Added support for Python 3.6

Changes in version 0.3.2
========================

* Dropped support for Django 1.3.
* Dropped support for Python 2.5.
* Silenced deprecation warnings on Django 1.8+.

Changes in version 0.3.1
========================

* Favor the built in json module (thanks to Simon Charette).

Changes in version 0.3.0
========================

* Python 3 support (thanks to Rafal Stozek).

Changes in version 0.2.0
========================

* Allow pickling of subclasses of django.db.models.Model (thanks to Simon
Charette).

Changes in version 0.1.9
========================

* Added `connection` and `prepared` parameters to `get_db_prep_value()` too
(thanks to Matthew Schinckel).

Changes in version 0.1.8
========================

* Updated link to code repository.
* Updated link to code repository.

Changes in version 0.1.7
========================

* Added `connection` and `prepared` parameters to `get_db_prep_lookup()` to
get rid of deprecation warnings in Django 1.2.
* Added `connection` and `prepared` parameters to `get_db_prep_lookup()` to
get rid of deprecation warnings in Django 1.2.

Changes in version 0.1.6
========================

* Fixed South support (thanks aehlke@github).
* Fixed South support (thanks aehlke@github).

Changes in version 0.1.5
========================

* Added support for South.
* Changed default to null=False, as is common throughout Django.
* Added support for South.
* Changed default to null=False, as is common throughout Django.

Changes in version 0.1.4
========================

* Updated copyright statements.
* Updated copyright statements.

Changes in version 0.1.3
========================

* Updated serialization tests (thanks to Michael Fladischer).
* Updated serialization tests (thanks to Michael Fladischer).

Changes in version 0.1.2
========================

* Added Simplified BSD licence.
* Added Simplified BSD licence.

Changes in version 0.1.1
========================

* Added test for serialization.
* Added note about JSON serialization for browser.
* Added support for different pickle protocol versions (thanks to Michael
Fladischer).
* Added test for serialization.
* Added note about JSON serialization for browser.
* Added support for different pickle protocol versions (thanks to Michael
Fladischer).

Changes in version 0.1
======================

* First public release.
* First public release.


--------
Expand Down
12 changes: 12 additions & 0 deletions picklefield/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from __future__ import unicode_literals

import django.utils.version

from .constants import DEFAULT_PROTOCOL
from .fields import PickledObjectField

__all__ = 'VERSION', '__version__', 'DEFAULT_PROTOCOL', 'PickledObjectField'

VERSION = (2, 1, 1, 'final', 0)

__version__ = django.utils.version.get_version(VERSION)
3 changes: 3 additions & 0 deletions picklefield/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from __future__ import unicode_literals

DEFAULT_PROTOCOL = 2
Loading