Completed
Push — master ( a65260...307dd7 )
by Paolo
07:35
created

forwards_func()   A

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 13
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.11.24 on 2019-11-07 15:38
3
from __future__ import unicode_literals
4
5
from django.db import migrations
6
7
8
def forwards_func(apps, schema_editor):
9
    # We get the model from the versioned app registry;
10
    # if we directly import it, it'll be the wrong version
11
12
    CookieConsentSettings = apps.get_model(
13
        "django_simple_cookie_consent",
14
        "CookieConsentSettings")
15
16
    db_alias = schema_editor.connection.alias
17
18
    # update the banner privacy link
19
    CookieConsentSettings.objects.using(db_alias).update(
20
        cookie_policy_link="/privacy/")
21
22
23
def reverse_func(apps, schema_editor):
24
25
    CookieConsentSettings = apps.get_model(
26
        "django_simple_cookie_consent",
27
        "CookieConsentSettings")
28
29
    db_alias = schema_editor.connection.alias
30
31
    # restore the old banner privacy link
32
    CookieConsentSettings.objects.using(db_alias).update(
33
        cookie_policy_link="/image/privacy/")
34
35
36
class Migration(migrations.Migration):
37
38
    dependencies = [
39
        ('django_simple_cookie_consent', '0003_auto_20191003_1007'),
40
    ]
41
42
    operations = [
43
        migrations.RunPython(forwards_func, reverse_func),
44
    ]
45