ដើម្បីអាចអោយកម្មវិធី Rental Bicycle App មានលទ្ធផលភាពអាចបញ្ចេញបញ្ចូលទិន្នន័យស្តីពីកង់ត្រូវជួល ពីនិងទៅក្នុងមូលដ្ខានទិន្នន័យ SQLite បាន យើងចាំបាច់ត្រូវបង្កើត form មួយសិន រួមទាំងកំនត់ផ្លូវចូលទៅកាន់ form នោះផងដែរ។ ពិនិត្យកូដខាងក្រោមនេះ៖
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <! - - \views\bikeform.tpl - - > % include( "./partials/header.tpl" ) <style> #bikeform{ margin - top: 30px ; width: 30 % ; display: grid; grid - template - columns: auto calc( 85 % - 5px ); grid - gap: 5px ; } #bikeform a{ text - align: right; } < / style> <div class = "main" id = "main" > <div class = "content" id = "content" > <span>BICYCLE ENTRY FORM< / span> <form id = "bikeform" method = "POST" action = "/bikeform" onsubmit = "return bicycle.bicycleForm('bikeform')" > <a>Brand:< / a>< input name = "fbrand" type = "text" > <a>Country:< / a>< input name = "fcountry" type = "text" > <a>Year:< / a>< input name = "fyear" type = "text" > <a>Amount:< / a>< input name = "famount" type = "text" > <a>Price:< / a>< input name = "fprice" type = "text" > <a>< / a>< input type = "submit" > < / form> < / div><! - - content - - > < / div><! - - main - - > % include( "./partials/footer" ) |
1 2 3 4 5 6 7 | #\controllers\bikeform.py import config from bottle import template, route @route ( "/bikeform" ) def renderForm(): return template( 'bikeform' , data = config.kargs) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #\app.py import os, config from bottle import route, run from controllers import index, bikeform from public import setup @route ( '/' ) def main(): return index.render( * * config.kargs) if 'DYNO' in os.environ: run(host = '0.0.0.0' , port = os.environ.get( 'PORT' , 9000 )) else : run(host = 'localhost' , port = 9000 , debug = True , reloader = True ) |
GitHub: https://github.com/Sokhavuth/Rental-Bicycle-App
Heroku: https://khmerweb-rba.herokuapp.com/