Total Complexity | 2 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |