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"]),
)),
]
# 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"]),
)),
]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django_extra_migrations-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c6e6cee3d9d2731885b3d82107c4250f4bbae954681b9d2b4c1ca81b2dfa75d |
|
MD5 | ae3d4aa11834709fbef7e97afb9fa963 |
|
BLAKE2b-256 | 8aa025485c6d084373e1880768445b7b0e8efb69b21a7e2fd3bcf8114df4951b |