Question: Please, need a complete report of the below project: I am doing create
ID: 3779152 • Letter: Q
Question
Question: Please, need a complete report of the below project:
I am doing createForm and modelViews for a song Website.
I am using Django, html, python. I am using PyCharm4.5.4. Data base: (db.sqlite3)
I am developing those below:
Database Setup, Creating Models, Activating Models, Database API, Filtering Database Results, Admin Interface, Writing Another View, Connecting to the Database, Templates, Render Template Shortcut, Raising a 404 HTTP Error, Adding Songs to our Database, Related Objects Set, Designing the Details Template, Removing Hardcoded URLs, Namespace and HTTP 404 Shortcut, Simple Form, Adding Forms to the Template, Favorite View Function, Bootstrap and Static Files, Navigation Menu, Finishing the Navigation Menu, Creating a Base Template, Generic Views, Model Forms, ModelForm and CreateView
1-Initial problem statement
2-Summary and purpose of the report/assignment
3-Detailed description of the solution and/or model(s) used in the project
4-Comments and Conclusion.
Explanation / Answer
First step : templates/index.html file
This HTML file, however, is a template, which means that lpthw.web will fill in "spaces" in the text depending on variables you pass in to the template. Every place you see $mygreeting will be a variable you'll pass to the template that alters its contents according to ypour need.
To make your bin/app.py do this, you need to add some code to tell lpthw.web where to load the template and to render it. Take that file and change it like this:
Pay close attention to the new render variable and how I changed the last line of index.GET which will return render.index() passing in your mygreeting variable.
Now reload the web page in your browser and you should see a different message in green. You should also be able to do a View Source on the page in your browser to see that it is valid HTML.
Now CRUD in python using sqlite
Create Table
.....Insert data......
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import web urls = ( '/', 'Index' ) app = web.application(urls, globals()) render = web.template.render('templates/') class Index(object): def GET(self): greeting = "Welcome to song website" return render.index(mygreeting = greeting) if __name__ == "__main__": app.run() Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.