必需属性无效。即使我提交空输入,也没有显示错误。
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/project/PycharmProjects/project/project/management/commands/back_populate_data.py", line 53, in handle
loaded_syn = data_loaded_syn4_pubchem(synonym_decoded, filter_dict)
File "/home/project/PycharmProjects/project/project/lookup_data.py", line 203, in data_loaded_syn4_pubchem
mol_syn_ob.save()
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/base.py", line 589, in save
force_update=force_update, update_fields=update_fields)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/base.py", line 617, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/base.py", line 698, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/base.py", line 731, in _do_insert
using=using, raw=raw)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/query.py", line 921, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 921, in execute_sql
cursor.execute(sql, params)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/project/.virtualenvs/project/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: UNIQUE constraint failed: project_synonym.molecule_id, project_synonym.synonym_name, project_synonym.synonym_type_id
答案 0 :(得分:0)
稍微编辑你的代码。您必须将input type="button"
更改为input type="submit"
就是这样。
<html>
<head>
<title>
EminemCircle
</title>
</head>
<body style="background-image:url(e3.jpg)">
<h1 style="color:red">Hey Come On!</h1>
</br> </br>
<h2 style="color:#00ff00">Dr.Dre Fires 10 million missiles!</h2>
</br> </br>
<form align="center" >
<label style="color:red;font-size:35px">Email id:</label> </br>
<input type="text" size="40px" required /> </br>
<input type="submit" value="Submit"/>
</form>
</body>
<html>