Open blueyed opened 10 years ago
Since https://code.djangoproject.com/ticket/22260 got fixed by reverting the change to db_type
's behavior.
Still, I think we should use a return value with get_internal_type
that makes sense (AFAICS).
I'm not 100% sure why we return a DurationField here (perhaps @poswald might recall). Perhaps South related?
Based upon the get_internal_type documentation, it does seem like we should return an existing Django type as you suggest.
@blueyed do you know if the change to BigIntegerField works when using pre-1.7 and South (I can test, but was wondering if you already had)?
@johnpaulett No, I have not tested it.
Please consider this pull request for discussion only.
btw: the tests passed before and after, although they should have failed before (for Django 1.7). I've thought that just a call to
save()
should have triggered an error. Maybe it's related to sqlite being used, or because of TestModels being involved?! (I could not get my hands on the durationfieldtest.db, even after commenting out "Destroying test database for alias ..." part from Django.From the commit: This is used in Django 1.7 migrations to derive the correct database type from.
I cannot see, why "DurationField" should be returned here (added in 892b6e9).
This leaves
db_type
as-is, since it's used with older Django versions and South probably.Fixes https://github.com/johnpaulett/django-durationfield/issues/15. Related Django ticket: https://code.djangoproject.com/ticket/22260