Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

migrations.RunPython

from django.db import migrations

def forwards_func(apps, schema_editor):
    # We get the model from the versioned app registry;
    # if we directly import it, it'll be the wrong version

def reverse_func(apps, schema_editor):
    # reverse_func() reverse the anctions done inside forwards_func.

class Migration(migrations.Migration):
    dependencies = []
    operations = [
        migrations.RunPython(forwards_func, reverse_func),
    ]
Comment

PREVIOUS NEXT
Code Example
Python :: geopandas replace column name 
Python :: python calculator source code 
Python :: python pytest no coverage on failure 
Python :: how to round a number up in python 
Python :: how to parse http request in python 
Python :: try except to specific line 
Python :: how to input a picture into opencv raspberry pi 
Python :: read csv limit rows python 
Python :: ipython play audio 
Python :: python print without optional argument 
Python :: matplotlib tick label position left and right x axis 
Python :: how to extract values from a dictionary 
Python :: python set workspace dir 
Python :: how to insert values to database with using dictionary in python 
Python :: how to get last dimension of an array python 
Python :: python dlib 
Python :: python screeninfo 
Python :: python in kali linux 
Python :: python run things at certain datetimes 
Python :: model coefficients 
Python :: python strftime cheat sheet 
Python :: python invert colormap 
Python :: sqlite python select with parameters 
Python :: print string python 
Python :: combine picture and audio python 
Python :: find and replace subword in word python regex 
Python :: how to use for in python 
Python :: python repr vs str 
Python :: date and time in python 
Python :: iterrows pandas 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =