Commit 6dc9565b authored by Давид Ли's avatar Давид Ли

fix id's doubling

parent 5f41bf8b
...@@ -21,13 +21,7 @@ class PostsController(BaseController): ...@@ -21,13 +21,7 @@ class PostsController(BaseController):
self.response.set_body(body) self.response.set_body(body)
def create(self): def create(self):
id_ = next(id_gen) Database.add(self.request.body)
Database.add(
{
'id': id_,
'title': self.request.body['title']
}
)
self.response.add_header('Content-Type', 'text/html') self.response.add_header('Content-Type', 'text/html')
self.response.set_status(301) self.response.set_status(301)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="mb-3 row"> <div class="mb-3 row">
<label for="staticEmail" class="col-sm-2 col-form-label">Id</label> <label for="staticEmail" class="col-sm-2 col-form-label">Id</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="staticEmail" value="{{ id }}"> <input type="text" readonly class="form-control-plaintext" id="staticEmail" name="id" value="{{ id }}">
</div> </div>
</div> </div>
<div class="mb-3 row"> <div class="mb-3 row">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment