Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Extra migration classes for django

Project Description
pip install django_extra_migrations

# Resave

*Resave all records with calling save and signals events*

Create empty migration - ```./manage.py makemigrations %APP_NAME% --empty```

Open migration file ./%APP_NAME%/migrations/%MIGRATION_NAME%.py

###Import

from django_extra_migrations.migrations import Resave

###Operation

Resave("%APP_NAME%.%MODEL_NAME%"),

###Example:

from __future__ import unicode_literals
from django.db import models, migrations
from django_extra_migrations.migrations import Resave, GrantPermissions


class Migration(migrations.Migration):
dependencies = [
('tree', '0078_auto_20151014_1500'),
]

operations = [
Resave("tree.Resource"),
]

---

#GrantPermissions

*Grant permissions to groups*

Create empty migration - ```./manage.py makemigrations %APP_NAME% --empty```

Open migration file ./%APP_NAME%/migrations/%MIGRATION_NAME%.py

###Import

from django_extra_migrations.migrations import GrantPermissions

###Operation

GrantPermissions(["%GROUP_NAME%"], (
("%APP_NAME%.%MODEL_NAME%", True), # IF true - grant ALL perms for this content type
("%APP_NAME%.%MODEL_NAME%", ["add_%LOWER_MODEL_NAME%"]),
("%APP_NAME%.%MODEL_NAME%", ["change_%LOWER_MODEL_NAME%"]),
("%APP_NAME%.%MODEL_NAME%", ["delete_%LOWER_MODEL_NAME%"]),
)),


###Example:

from __future__ import unicode_literals

from django.db import models, migrations
from django_extra_migrations.migrations import GrantPermissions


class Migration(migrations.Migration):
dependencies = [
('tree', '0078_auto_20151014_1500'),
]

operations = [
GrantPermissions(["Admins"], (
("tree.Resource", True),
("tree.ResourceFile", ["add_resourcefile"]),
)),
]
Release History

Release History

This version
History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_extra_migrations-0.0.7.tar.gz (2.8 kB) Copy SHA256 Checksum SHA256 Source Jan 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting