parent
a26c8e604f
commit
60097d36ca
2 changed files with 0 additions and 70 deletions
@ -1,35 +0,0 @@ |
|||||||
# Generated by Django 2.0.2 on 2018-02-05 15:59 |
|
||||||
|
|
||||||
from django.db import migrations |
|
||||||
from django.contrib.contenttypes.models import ContentType |
|
||||||
|
|
||||||
|
|
||||||
def fwrd_func(apps, schema_editor): |
|
||||||
CourseComment = apps.get_model('course', 'CourseComment') |
|
||||||
LessonComment = apps.get_model('course', 'LessonComment') |
|
||||||
db_alias = schema_editor.connection.alias |
|
||||||
if CourseComment.objects.exists(): |
|
||||||
coursecomment_content_type = ContentType.objects.get( |
|
||||||
app_label='course', model='coursecomment', |
|
||||||
) |
|
||||||
CourseComment.objects.using(db_alias).all().update( |
|
||||||
polymorphic_ctype=coursecomment_content_type, |
|
||||||
) |
|
||||||
if LessonComment.objects.exists(): |
|
||||||
lessoncomment_content_type = ContentType.objects.get( |
|
||||||
app_label='course', model='lessoncomment', |
|
||||||
) |
|
||||||
LessonComment.objects.using(db_alias).all().update( |
|
||||||
polymorphic_ctype=lessoncomment_content_type, |
|
||||||
) |
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration): |
|
||||||
|
|
||||||
dependencies = [ |
|
||||||
('course', '0020_auto_20180202_1716'), |
|
||||||
] |
|
||||||
|
|
||||||
operations = [ |
|
||||||
migrations.RunPython(fwrd_func) |
|
||||||
] |
|
||||||
@ -1,35 +0,0 @@ |
|||||||
# Generated by Django 2.0.2 on 2018-02-05 16:15 |
|
||||||
|
|
||||||
from django.db import migrations |
|
||||||
from django.contrib.contenttypes.models import ContentType |
|
||||||
|
|
||||||
|
|
||||||
def fwrd_func(apps, schema_editor): |
|
||||||
CourseComment = apps.get_model('course', 'CourseComment') |
|
||||||
LessonComment = apps.get_model('course', 'LessonComment') |
|
||||||
db_alias = schema_editor.connection.alias |
|
||||||
if CourseComment.objects.using(db_alias).all().exists(): |
|
||||||
coursecomment_content_type = ContentType.objects.get( |
|
||||||
app_label='course', model='coursecomment', |
|
||||||
) |
|
||||||
CourseComment.objects.using(db_alias).all().update( |
|
||||||
polymorphic_ctype=coursecomment_content_type, |
|
||||||
) |
|
||||||
if LessonComment.objects.using(db_alias).all().exists(): |
|
||||||
lessoncomment_content_type = ContentType.objects.get( |
|
||||||
app_label='course', model='lessoncomment', |
|
||||||
) |
|
||||||
LessonComment.objects.using(db_alias).all().update( |
|
||||||
polymorphic_ctype=lessoncomment_content_type, |
|
||||||
) |
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration): |
|
||||||
|
|
||||||
dependencies = [ |
|
||||||
('course', '0021_auto_20180205_1559'), |
|
||||||
] |
|
||||||
|
|
||||||
operations = [ |
|
||||||
migrations.RunPython(fwrd_func) |
|
||||||
] |
|
||||||
Loading…
Reference in new issue