Faculty Web Page Template Assignment 5 CSCI 245 1. Verify the Model 1. Check out the FacultyTemplateProject from subversion. 2. You will need to fill in settings.py so that the application talks to your faculty database. 3. You will find models.py and an initial_data.json file present. Please compare the information in this model with the information in the model that you submitted with your last assignment. Let me know if you see any mistakes in the information or how it is represented. 2. Synch the Database Since you are likely to have used different table names than I did, you will need to go into your faculty database and delete the tables that you created, and then sync your database with this application. 3. View the HTML files on the Server Once you have the database synched, you should be able to start the server and see the hard- coded html files in the Django templates subdirectory through the URL:http://localhost:8001/Faculty/index.html. 4. Replace the HTML files with Django Templates 1. In the templates subdirectory in the FacultyWebPages application, you will find hard-coded html files that display a faculty web page. Your job will be to rewrite the html files as Django templates that pick up the information from the database. 2. You will need to write one or more view functions in views.py to obtain the information from the database and pass it to the template 3. You may need to edit urls.py to map the appropriate URLs to the view function that will handle the database look up and display the template 5. Things to keep in mind: 1. You will want to remove as much duplication as possible from the hard-coded html files. This will probably mean using a base template and extending it. It may also mean include other templates on a page. 2. When you have finished the assignment the html should contain no hard-coded references to me. 3. You will need to use a for loop to display lists of items such as education and advising areas. 4. There are certain fields that faculty members may choose to not fill in. For example, not all faculty members are likely to keep a Google calendar. In such cases, you should check whether it has been filled in or not. If the value is unavailable you should post an appropriate message indicating that it is missing. 5. For right now, just leave the picture hard-coded. However, you should be able to fill in the 'alt' attribute of the image using information from the database. 6. When you use a foreign key, the corresponding database field will have an extra '_id' as a suffix. Be sure to remember that when you do database lookups in the view function based on the value of a foreign key. Grading Standards 1. urls.py a. Are the mapping functions between URLs and view functions well-defined and concise? 2. views.py a. Has the database been synched so the view function(s) pull the data from the database correctly? b. Are the view functions well-defined, without syntax errors, and do they work correctly? 3. templates a. Have all the hard-coded values been replaced with template code? b. Do all pages display properly without syntax errors? c. Have the HTML files been refactored to remove duplicate code? d. Have checks been put in place for database fields that may not have a value and have appropriate html default code been written for such missing values?
Pages to are hidden for
"Faculty Web Page Template"Please download to view full document