start project and accessing admin panel
To start the project:
- Here before start the project use python populate.py
- Then start the project using python manage.py runserver
- Follow the link
- Click the links to view the problems solved.
Next, to access the admin:
- Simply add "/admin" to the hosted url by python manage.py runserver
- Admin credentials are: i. username: myintern ii. pw: myintern
- View the records where sales is made primary key and country is self returned on calling the report class with attributes: year, petroleum_product, sale and country.
#ABout the queries used to display the conditions:
-
data=Report.objects.order_by('-year') for all stored data.
-
Report.objects.raw('select avg([sale]) as sale, petroleum_product, country from report_Report where sale!=0 group by [country],[petroleum_product]') FOR OverallAverageSale Grouped by Country
-
Report.objects.raw('select petroleum_product, avg([sale]) as sale, (year/2)*2 || "-" || (year/2)+1 as year from report_Report where sale!=0 group by year/2, petroleum_product') Fpr AverageSale for Each Petroleum Product in interval however in front end i couldnot show the 2007-2008 like this way.
-
Report.objects.raw('select petroleum_product, year, min([sale]) as sale from report_Report where sale!=0 group by year, petroleum_product') For Least sale for Each Petroleum Product