Django date saved as datetime causes server error in admin interface

Issue #31 resolved
Former user created an issue

Django 1.5.1, SQL Server 11 (aka 2012), django-mssql 1.3.1. If adding a date field in a model a datetime field is created in SQLServer. If trying to set a date in the admin interface (or a similar custom interface), an internal server error occurs because SQLServer cannot convert the string (e.g. "2013-08-16") to a datetime. If using a date field instead (in DataBaseCreation.data_types) this works correctly. Note that the date field is only available since SQL server 2008, so this can be changed only for the latest 2 versions.

Comments (6)

  1. Michael Manfre repo owner

    Supporting the newer/recommended date data types is something that needs to happen independent of SQL Server 2012. This is a complicated problem due to the need to support existing databases and 3rd party apps that provide models. I think I have a solution that may work for all of the various migration scenarios that I can think of.

  2. Michael Manfre repo owner

    Fixed #31, #25 - Added date related custom fields with improved introspection

    Added additional custom fields to allow explicitly controlling the date & time database data type. New option 'use_legacy_date_fields' allows changing the default data types to the newer (SQL Server 2008+) date and time data types.

    → <<cset 5f2a820cff9c>>

  3. Andreas Bohne

    Thanks - nice work! One question though - shouldn't the package version number be increased to be able to update the package?

  4. Michael Manfre repo owner

    I bump versions when I deploy a new package. The current version is still deemed an alpha and I don't plan on deploying a new package until a few more changes get in.

  5. Andreas Bohne

    Ah ok - my fault, I checked the current version and thought to have seen some changes, but I seem to have confused this with my own changes...

  6. Log in to comment