django-durationfield icon indicating copy to clipboard operation
django-durationfield copied to clipboard

TBD: Return an existing Django type from get_internal_type

Open blueyed opened this issue 12 years ago • 3 comments

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

blueyed avatar Mar 12 '14 20:03 blueyed

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).

blueyed avatar Mar 15 '14 19:03 blueyed

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 avatar Mar 15 '14 20:03 johnpaulett

@johnpaulett No, I have not tested it.

blueyed avatar Mar 15 '14 23:03 blueyed