Django Error - django.db.utils.DatabaseError: Data truncated for column 'applied' at row 1
<p>I am getting a weird issue when executing <code>python manage.py migrate</code>. </p>

<p>Below is the error. </p>

<blockquote>
  <p>django.db.utils.DatabaseError: Data truncated for column 'applied' at row 1</p>
</blockquote>

<p><a href="http://i.stack.imgur.com/fG00J.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/fG00J.jpg" alt="enter image description here"></a></p>

<p>Can anyone help me?</p>

<p>Thanks</p>

<p>Here is my models.py data</p>

<pre><code># This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey has `on_delete` set to the desired behavior.
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from __future__ import unicode_literals

from django.db import models


class Threads(models.Model):
    date = models.DateTimeField(db_column='Date', blank=True, null=True)  # Field name made lowercase.
    supplier = models.CharField(db_column='Supplier', max_length=45, blank=True, null=True)  # Field name made lowercase.
    activethreads = models.CharField(db_column='ActiveThreads', max_length=45, blank=True, null=True)  # Field name made lowercase.
    threadscreated = models.CharField(db_column='ThreadsCreated', max_length=45, blank=True, null=True)  # Field name made lowercase.
    ipaddress = models.CharField(db_column='IPAddress', max_length=45, blank=True, null=True)  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'Threads'


class DjangoContentType(models.Model):
    name = models.CharField(max_length=100)
    app_label = models.CharField(max_length=100)
    model = models.CharField(max_length=100)

    class Meta:
        managed = False
        db_table = 'django_content_type'
        unique_together = (('app_label', 'model'),)


class DjangoMigrations(models.Model):
    app = models.CharField(max_length=255)
    name = models.CharField(max_length=255)
    applied = models.DateTimeField()

    class Meta:
        managed = False
        db_table = 'django_migrations'
</code></pre>

<p>Solution of my problem is mentioned on the below URL, this is a bug with the latest version of Django. You need to change USE_TZ = False in settings.py</p>

<p><a href="http://stackoverflow.com/questions/34716360/incorrect-datetime-value-when-setting-up-django-with-mysql">Incorrect datetime value when setting up Django with MySQL</a></p>

<p>After doing the above change then you will encounter a different issue while running "python manage.py migrate" which will give you the below error</p>

<blockquote>
  <p>TypeError: can't multiply sequence by non-int of type 'tuple'</p>
</blockquote>

<p>For this issue please refer Chris Barrett solution mentioned below</p>

<p><a href="https://bitbucket.org/Manfre/django-mssql/issues/80/error-when-using-django-19" rel="nofollow">https://bitbucket.org/Manfre/django-mssql/issues/80/error-when-using-django-19</a></p>

<p>You need to make the required changes in versions/3.5.2/lib/python3.5/site-packages/mysql/connector/django/operations.py (Check your setup) and make the changes</p>

<pre><code>def bulk_insert_sql(self, fields, placeholder_rows):
        """
        Format the SQL for bulk insert
        """
        placeholder_rows_sql = (", ".join(row) for row in placeholder_rows)
        values_sql = ", ".join("(%s)" % sql for sql in placeholder_rows_sql)
        return "VALUES " + values_sql
</code></pre>

python django python-3.5