• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This package allows deprecating model fields and allows removing them in a backwards compatible manner.

Django - Deprecate Field

PyPi License Contributing 3yourminD-Careers Stars

Installation

pip install django-deprecate-fields

Usage

Assume the simple following model:

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:

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.

More Repositories

1

django-migration-linter

๐Ÿš€ Detect backward incompatible migrations for your django project
Python
507
star
2

django-add-default-value

This django Migration Operation can be used to transfer a Fields default value to the database scheme.
Python
129
star
3

kotti

๐Ÿ’… 3YOURMINDโ€™s Vue UI Framework & Design System
TypeScript
77
star
4

django-replace-migrations

Python
12
star
5

fire-pr

๐Ÿ”ฅ Create Pull Requests in an approachable way, this extension will streamline your pull request proces
Vue
9
star
6

js-polyfill-docker

๐ŸณDocker container for the polyfill.io service to serve JavaScript bundles per browser efficiently.
Dockerfile
7
star
7

vue-comments

๐Ÿ“ A Vue.js plugin to show comments related to an identifier. This identifier is called projectId internally but since this component is written with a dynamic mindset you can provide your own actions to deal with CRUD operations on comments.
JavaScript
6
star
8

drf-payload-customizer

This package allows you to customize your django-rest-framework serializer i/o in specific ways.
Python
5
star
9

3YDMoeller

A C++ single header implementation of Moeller's Triangle-Triangle & Triangle-Box intersection algorithms for BVH trasversal
C++
5
star
10

yoco

๐Ÿ’Ž Icons used in the applications of 3YOURMIND. MOVED TO THE KOTTI REPOSITORY.
3
star
11

vue-yodify

๐Ÿ’ฌ A Vue.js notification plugin with easy installation and usage
Vue
3
star
12

django-model-sync

Python
2
star
13

xfvb-run

fork of a gist
Shell
1
star
14

vscode-frontend-extension-pack

The repository for the 3yourmind Frontend Extension Pack
JavaScript
1
star