Владимир: WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS.
Operations to perform:
Apply all migrations: sessions, blog, admin, auth, contenttypes
Running migrations:
Rendering model states... DONE
Applying blog.0002_article_user...Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\django_manage.py", line 41, in
run_module(manage_file, None, '__main__', True)
File "C:\Python35\lib\runpy.py", line 182, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "C:\Python35\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:/djangoprojects/MyBlog\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "C:\Python35\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Python35\lib\site-packages\django\core\management\__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python35\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python35\lib\site-packages\django\core\management\base.py", line 399, in execute
output = self.handle(*args, **options)
File "C:\Python35\lib\site-packages\django\core\management\commands\migrate.py", line 200, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "C:\Python35\lib\site-packages\django\db\migrations\executor.py", line 92, in migrate
self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
File "C:\Python35\lib\site-packages\django\db\migrations\executor.py", line 121, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "C:\Python35\lib\site-packages\django\db\migrations\executor.py", line 198, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Python35\lib\site-packages\django\db\migrations\migration.py", line 123, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Python35\lib\site-packages\django\db\migrations\operations\fields.py", line 62, in database_forwards
field,
File "C:\Python35\lib\site-packages\django\db\backends\sqlite3\schema.py", line 229, in add_field
self._remake_table(model, create_fields=[field])
File "C:\Python35\lib\site-packages\django\db\backends\sqlite3\schema.py", line 111, in _remake_table
self.effective_default(field)
File "C:\Python35\lib\site-packages\django\db\backends\base\schema.py", line 210, in effective_default
default = field.get_db_prep_save(default, self.connection)
File "C:\Python35\lib\site-packages\django\db\models\fields\related.py", line 915, in get_db_prep_save
return self.target_field.get_db_prep_save(value, connection=connection)
File "C:\Python35\lib\site-packages\django\db\models\fields\__init__.py", line 728, in get_db_prep_save
prepared=False)
File "C:\Python35\lib\site-packages\django\db\models\fields\__init__.py", line 968, in get_db_prep_value
value = self.get_prep_value(value)
File "C:\Python35\lib\site-packages\django\db\models\fields\__init__.py", line 976, in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: 'admin'
from django.contrib.auth.models import User
from django.db import models
# Create your models here.
class Article(models.Model):
title = models.CharField(max_length=200)
text = models.TextField()
user = models.ForeignKey(User)
def _str_(self):
return self.title
Написано
Войдите на сайт
Чтобы задать вопрос и получить на него квалифицированный ответ.
def home(request):
return render(request, 'blog/home.html')