Hi,
On 23 Nov 2016 9:55 pm, "adonis simo" <simoadonis@gmail.com> wrote:
Thanks for looking--
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/ , line 367, in execute_from_command_linesite-packages/django/core/ management/__init__.py"
utility.execute()
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 359, in executesite-packages/django/core/ management/__init__.py"
self.fetch_command(subcommand). run_from_argv(self.argv)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 294, in run_from_argvsite-packages/django/core/ management/base.py"
self.execute(*args, **cmd_options)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 345, in executesite-packages/django/core/ management/base.py"
output = self.handle(*args, **options)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 204, in handlesite-packages/django/core/ management/commands/migrate. py"
fake_initial=fake_initial,
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 115, in migratesite-packages/django/db/ migrations/executor.py"
state = self._migrate_all_forwards(state , plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 145, in _migrate_all_forwardssite-packages/django/db/ migrations/executor.py"
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 244, in apply_migrationsite-packages/django/db/ migrations/executor.py"
state = migration.apply(state, schema_editor)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 129, in applysite-packages/django/db/ migrations/migration.py"
operation.database_forwards(self .app_label, schema_editor, old_state, project_state)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 84, in database_forwardssite-packages/django/db/ migrations/operations/fields. py"
field,
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 231, in add_fieldsite-packages/django/db/ backends/sqlite3/schema.py"
self._remake_table(model, create_fields=[field])
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 113, in _remake_tablesite-packages/django/db/ backends/sqlite3/schema.py"
self.effective_default(field)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 221, in effective_defaultsite-packages/django/db/ backends/base/schema.py"
default = field.get_db_prep_save(default, self.connection)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 909, in get_db_prep_savesite-packages/django/db/ models/fields/related.py"
return self.target_field.get_db_prep_save (value, connection=connection)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 755, in get_db_prep_savesite-packages/django/db/ models/fields/__init__.py"
prepared=False)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 938, in get_db_prep_valuesite-packages/django/db/ models/fields/__init__.py"
value = self.get_prep_value(value)
File "/home/adonis97/Documents/codages/mysite/lib/python3.5/ , line 946, in get_prep_valuesite-packages/django/db/ models/fields/__init__.py"
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 .
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/CAGGVXBMFRfBRvqqLTAUS4vTOm81OGY%3DdKDkHtOWwOr5qUZ80JA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment