My favorites | Sign in
Project Home Wiki Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 80 attachment: field_type.diff (1.4 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- a/apps/django_evolution/mutations.py Fri Apr 23 23:17:40 2010 -0500
+++ b/apps/django_evolution/mutations.py Sat Apr 24 12:44:31 2010 -0500
@@ -239,8 +239,12 @@
self.initial = initial

def __str__(self):
- params = (self.model_name, self.field_name, self.field_type.__name__)
- str_output = ["'%s', '%s', models.%s" % params]
+ if self.field_type.__name__ in dir(models):
+ field_type = 'models.%s' % self.field_type.__name__
+ else:
+ field_type = '%s.%s' % (self.field_type.__module__, self.field_type.__name__)
+ params = (self.model_name, self.field_name, field_type)
+ str_output = ["'%s', '%s', %s" % params]

if self.initial is not None:
str_output.append('initial=%s' % repr(self.initial))
@@ -414,7 +418,12 @@
str_output.append('initial=%s' % repr(self.initial))

for attr_name, attr_value in self.field_attrs.items():
- if str == type(attr_value):
+ if attr_name == 'field_type':
+ if attr_value.__name__ in dir(models):
+ str_attr_value = 'models.%s' % attr_value.__name__
+ else:
+ str_attr_value = '%s.%s' % (attr_value.__module__, attr_value.__name__)
+ elif str == type(attr_value):
str_attr_value = "'%s'" % attr_value
else:
str_attr_value = str(attr_value)
Powered by Google Project Hosting