python - Django 1.8 TypeError: int() argument must be a string or a number, not 'datetime.date' -
i learning use django , error when "migrate". using datetimefield error:
operations perform: apply migrations: admin, contenttypes, sessions, auth, principal running migrations: applying principal.0002_auto_20140910_1459.../library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/models/fields/__init__.py:1350: runtimewarning: datetimefield producto.tiempo_registro received naive datetime (2014-09-10 00:00:00) while time zone support active. runtimewarning) traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/__init__.py", line 336, in execute_from_command_line utility.execute() file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/__init__.py", line 328, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/base.py", line 369, in run_from_argv self.execute(*args, **cmd_options) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/base.py", line 419, in execute output = self.handle(*args, **options) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/core/management/commands/migrate.py", line 193, in handle executor.migrate(targets, plan, fake=options.get("fake", false)) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/migrations/executor.py", line 63, in migrate self.apply_migration(migration, fake=fake) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/migrations/executor.py", line 97, in apply_migration migration.apply(project_state, schema_editor) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/migrations/migration.py", line 107, in apply operation.database_forwards(self.app_label, schema_editor, project_state, new_state) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/migrations/operations/fields.py", line 37, in database_forwards field, file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/backends/sqlite3/schema.py", line 160, in add_field self._remake_table(model, create_fields=[field]) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/backends/sqlite3/schema.py", line 74, in _remake_table self.effective_default(field) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/backends/schema.py", line 189, in effective_default default = field.get_db_prep_save(default, self.connection) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/models/fields/related.py", line 1774, in get_db_prep_save return self.related_field.get_db_prep_save(value, connection=connection) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/models/fields/__init__.py", line 632, in get_db_prep_save prepared=false) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/models/fields/__init__.py", line 913, in get_db_prep_value value = self.get_prep_value(value) file "/library/python/2.7/site-packages/django-1.8.dev20140910084412-py2.7.egg/django/db/models/fields/__init__.py", line 921, in get_prep_value return int(value) typeerror: int() argument must string or number, not 'datetime.date'
but if comment line , "migrate" same error.
paste models.py:
#encoding:utf-8 django.db import models django.contrib.auth.models import user class producto(models.model): nombre = models.charfield(max_length=50) #precio = models.decimalfield(max_digits=10, decimal_places=2, help_text='con solo dos decimales') #imagen = models.imagefield(upload_to='productos', verbose_name='imagen producto', null=true) #fecha_registro = models.datetimefield('date published') #usuario = models.foreignkey(user, blank=true) def __str__(self): return self.nombre
thanks
Comments
Post a Comment