summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-03-07 09:56:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-03-07 09:56:48 +0100
commitcadd87c46cf5c14233655cdf910cfe39a7b15815 (patch)
treea21c310cb24d9b6b6eff39363aa75e343f7ce05b /ishtar_common
parentfe755f7158df79e72dc5deab1eb63d251bb64ceb (diff)
downloadIshtar-cadd87c46cf5c14233655cdf910cfe39a7b15815.tar.bz2
Ishtar-cadd87c46cf5c14233655cdf910cfe39a7b15815.zip
Fix migration evaluation with virtualtime
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/management/commands/makemigrations.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/ishtar_common/management/commands/makemigrations.py b/ishtar_common/management/commands/makemigrations.py
new file mode 100644
index 000000000..15309b0d2
--- /dev/null
+++ b/ishtar_common/management/commands/makemigrations.py
@@ -0,0 +1,23 @@
+from datetime import datetime
+
+from django.core.management.commands.makemigrations import Command
+from django.db import models
+
+
+original_deconstruct = models.Field.deconstruct
+
+
+def new_deconstruct(self):
+ """
+ virtualtime can induce bad signature for "now" function replace it
+ explicitly
+ """
+ name, path, args, kwargs = original_deconstruct(self)
+ if 'default' in kwargs and callable(kwargs['default']) and \
+ kwargs['default'].__name__ == 'now':
+ kwargs['default'] = datetime.now
+ return name, path, args, kwargs
+
+
+models.Field.deconstruct = new_deconstruct
+