Open ericvsmith opened 9 months ago
I supposed the problem is that dumpscript is just too dumb. It has this code, after it checks for known field types: https://github.com/django-extensions/django-extensions/blob/0e5747586332333f572bcfbf674b712e11aa69dd/django_extensions/management/commands/dumpscript.py#L705C13-L707
# A normal field (e.g. a python built-in)
else:
return repr(value)
So I guess the only solution on the django-phone-field side is to have __repr__
return repr(self.formatted)
, which would make the above:
foo_contact_1.zip_code = ''
foo_contact_1.phone = '(800) 555-1212"
foo_contact_1.email = 'me@hotmail.com'
I'm not sure if that would break anything else. I'll play around with it.
For example, if I have an app
foo
, that has a modelContact
that contains a fieldphone
of typePhoneField
(along with some other fields), then the output of dumpscript might contain:The intention, of course, would be that the
.phone
attribute is set to a value (presumably a string) that can then be saved to the database.