-
Notifications
You must be signed in to change notification settings - Fork 4
Shopping Cart with Js & Python #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| import json | ||
| import os | ||
| from urllib.parse import urlparse | ||
| import redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import modules should be in alphabetic order.
and import multiple modules in one line from the parent module.
like, from werkzeug.routing import Map, Rule
| error = None | ||
| with open('/home/vivek/Desktop/Shopping Site/item_list.json') as f: | ||
| data=json.load(f) | ||
| return self.render_template("homepage.html", error=error, items=data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a relative path instead of an absolute path.
also, it will raise an error when you don't have data.
try to declare an empty list of data.
| filter = input.value.toUpperCase(); | ||
| ul = document.getElementById("myProducts"); | ||
| li = ul.getElementsByTagName("li"); | ||
| for (i = 0; i < li.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use native method instead of for loop.
| @@ -0,0 +1,63 @@ | |||
| var cart = []; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ES6 standards to declare the variables.
| </head> | ||
| <div> | ||
| {% block body %}{% endblock %} | ||
| </div> No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a blank newline at the end of each file.
| app = ShoppingSite({ | ||
| 'redis_host': redis_host, | ||
| 'redis_port': redis_port | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app = ShoppingSite({
'redis_host': redis_host,
'redis_port': redis_port
})
| return app | ||
|
|
||
| if __name__ == "__main__": | ||
| from werkzeug.serving import run_simple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import should be placed at the top
| @@ -0,0 +1,63 @@ | |||
| var cart = []; | |||
| $(function () { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use document.ready here
|
don't leave extra spaces and do proper indentations. |
9eb0fd4 to
0562c7b
Compare
No description provided.