Thanks for looking
This is the whole stack trace :
Le mardi 22 novembre 2016 02:16:51 UTC+1, adonis simo a écrit :
-- This is the whole stack trace :
Operations to perform:
Apply all migrations: admin, auth, blog, contenttypes, polls, sessions
Running migrations:
Applying blog.0007_article_user...Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards
field,
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py", line 231, in add_field
self._remake_table(model, create_fields=[field])
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py", line 113, in _remake_table
self.effective_default(field)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 221, in effective_default
default = field.get_db_prep_save(default, self.connection)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/models/fields/related.py", line 909, in get_db_prep_save
return self.target_field.get_db_prep_save(value, connection=connection)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 755, in get_db_prep_save
prepared=False)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 938, in get_db_prep_value
value = self.get_prep_value(value)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 946, in get_prep_value
return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'
Le mardi 22 novembre 2016 02:16:51 UTC+1, adonis simo a écrit :
Hi django users,
I am new to django and i am using django 1.10, i follow up all the tutorial in the documentation and now i have build an blog application with models like :
Article , Commentaire(comment in english) and Tag. It's working but now i want to add an relation between User (the one who is connected and creating the article)
and the Article but i dont know how to do this . I find on google and try what i see but nothing ran ,
this is my codeAnd when i run
Saisissez le code ici.from django.contrib.auth.models import User..
class Article(models.Model):
titre = models.CharField(max_length=254 )
description = models.TextField()
contenu = models.TextField()
date_publication = models.DateField()
image = models.ImageField(upload_to='blog/static/blog/images/' )
publie = models.BooleanField(default=False ) # par defaut un article n'est pas publier
tag = models.ManyToManyField(Tag)
auteur = models.ForeignKey('auth.User', verbose_name='auteur', default=1)# here is the relationshp creationit give me a long error message with at the end of it :
python manager.py migratePlease help i dont know how to do !!!
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'
Saisissez le code ici...
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a765c9a7-cb08-4f48-98ea-679e179f5f8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment