django-deprecate-fields


Namedjango-deprecate-fields JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/3YOURMIND/django-deprecate-fields
SummaryThis package allows deprecating model fields and allows removing them in a backwards compatible manner.
upload_time2024-01-31 08:33:18
maintainer
docs_urlNone
author3YOURMIND GmbH
requires_python
licenseApache License 2.0
keywords django migration deprecation database backward compatibility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django - Deprecate Field

[![PyPi](https://img.shields.io/pypi/v/django-deprecate-fields.svg?branch=master)](https://pypi.python.org/pypi/django-deprecate-fields/)
[![License](https://img.shields.io/github/license/3yourmind/django-deprecate-fields.svg)](./LICENSE)
[![Contributing](https://img.shields.io/badge/PR-welcome-green.svg)](https://github.com/3YOURMIND/django-deprecate-fields/pulls)
[![3yourminD-Careers](https://img.shields.io/badge/3YOURMIND-Hiring-brightgreen.svg)](https://www.3yourmind.com/career)
[![Stars](https://img.shields.io/github/stars/3YOURMIND/django-deprecate-fields.svg?style=social&label=Stars)](https://github.com/3YOURMIND/django-deprecate-fields/stargazers)

## Installation

```
pip install django-deprecate-fields
```

## Usage

Assume the simple following model:
```python
from django.db import models

class MyModel(models.Model):
    field1 = models.CharField()
    field2 = models.CharField()
```

In order to remove `field1`, it should first be marked as deprecated:
```python
from django.db import models
from django_deprecate_fields import deprecate_field

class MyModel(models.Model):
    field1 = deprecate_field(models.CharField())
    field2 = models.CharField()
```

Secondly, `makemigrations` should be called, which will change the field to be nullable. Any lingering references to it
in your code will return `None` (or optionally any value or callable passed to `deprecate_field` as the
`return_instead` argument)

Lastly, after the changes above have been deployed, `field1` can then safely be removed in the model (plus another
`makemigrations` run)

## Contributing

First of all, thank you very much for contributing to this project. Please base
your work on the `master` branch and target `master` in your pull request.

## License

`django-deprecate-fields` is released under the [Apache 2.0 License](./LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/3YOURMIND/django-deprecate-fields",
    "name": "django-deprecate-fields",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django migration deprecation database backward compatibility",
    "author": "3YOURMIND GmbH",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/57/1e/644b1af429d68b7624e7b3b928208d1517ca636f9d09eba010be3be6132b/django-deprecate-fields-0.1.2.tar.gz",
    "platform": null,
    "description": "# Django - Deprecate Field\n\n[![PyPi](https://img.shields.io/pypi/v/django-deprecate-fields.svg?branch=master)](https://pypi.python.org/pypi/django-deprecate-fields/)\n[![License](https://img.shields.io/github/license/3yourmind/django-deprecate-fields.svg)](./LICENSE)\n[![Contributing](https://img.shields.io/badge/PR-welcome-green.svg)](https://github.com/3YOURMIND/django-deprecate-fields/pulls)\n[![3yourminD-Careers](https://img.shields.io/badge/3YOURMIND-Hiring-brightgreen.svg)](https://www.3yourmind.com/career)\n[![Stars](https://img.shields.io/github/stars/3YOURMIND/django-deprecate-fields.svg?style=social&label=Stars)](https://github.com/3YOURMIND/django-deprecate-fields/stargazers)\n\n## Installation\n\n```\npip install django-deprecate-fields\n```\n\n## Usage\n\nAssume the simple following model:\n```python\nfrom django.db import models\n\nclass MyModel(models.Model):\n    field1 = models.CharField()\n    field2 = models.CharField()\n```\n\nIn order to remove `field1`, it should first be marked as deprecated:\n```python\nfrom django.db import models\nfrom django_deprecate_fields import deprecate_field\n\nclass MyModel(models.Model):\n    field1 = deprecate_field(models.CharField())\n    field2 = models.CharField()\n```\n\nSecondly, `makemigrations` should be called, which will change the field to be nullable. Any lingering references to it\nin your code will return `None` (or optionally any value or callable passed to `deprecate_field` as the\n`return_instead` argument)\n\nLastly, after the changes above have been deployed, `field1` can then safely be removed in the model (plus another\n`makemigrations` run)\n\n## Contributing\n\nFirst of all, thank you very much for contributing to this project. Please base\nyour work on the `master` branch and target `master` in your pull request.\n\n## License\n\n`django-deprecate-fields` is released under the [Apache 2.0 License](./LICENSE).\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "This package allows deprecating model fields and allows removing them in a backwards compatible manner.",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/3YOURMIND/django-deprecate-fields"
    },
    "split_keywords": [
        "django",
        "migration",
        "deprecation",
        "database",
        "backward",
        "compatibility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "571e644b1af429d68b7624e7b3b928208d1517ca636f9d09eba010be3be6132b",
                "md5": "25ab386ffc218c3b7853df11cd27a219",
                "sha256": "ab2edaf4a6a09eefdd94740b05630d89fa58ec54461842e3a51fe129077c3942"
            },
            "downloads": -1,
            "filename": "django-deprecate-fields-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "25ab386ffc218c3b7853df11cd27a219",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7221,
            "upload_time": "2024-01-31T08:33:18",
            "upload_time_iso_8601": "2024-01-31T08:33:18.321888Z",
            "url": "https://files.pythonhosted.org/packages/57/1e/644b1af429d68b7624e7b3b928208d1517ca636f9d09eba010be3be6132b/django-deprecate-fields-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-31 08:33:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "3YOURMIND",
    "github_project": "django-deprecate-fields",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-deprecate-fields"
}
        
Elapsed time: 0.18806s