summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tbc/models.py170
-rw-r--r--tbc/templates/tbc/browse-books.html202
-rw-r--r--tbc/urls.py3
-rw-r--r--tbc/views.py95
4 files changed, 458 insertions, 12 deletions
diff --git a/tbc/models.py b/tbc/models.py
index a36d4ce..3a770f0 100644
--- a/tbc/models.py
+++ b/tbc/models.py
@@ -57,6 +57,168 @@ BOOK_PREFERENCE = (("book1","1st Book"),
("book2","2nd Book"),
("book3","3rd Book"))
+YEAR = (("first", "First"),
+ ("second", "Second"),
+ ("third", "Third"),
+ ("fourth", "Fourth"))
+UNIVERSITY = (
+("A.I Kalsekar Technical Campus, Mumbai University","A.I Kalsekar Technical Campus, Mumbai University"),
+("AALIM MOHAMED SALEGH COLLEGE OF ENGINEERING","AALIM MOHAMED SALEGH COLLEGE OF ENGINEERING"),
+("ABAL Technologies","ABAL Technologies"),
+("ABES Engineering College","ABES Engineering College"),
+("Acharya Narendra Dev College","Acharya Narendra Dev College"),
+("Acropolis Institute of Technology & Research, Indore","Acropolis Institute of Technology & Research, Indore"),
+("Adamas University","Adamas University"),
+("Aggarwal public school","Aggarwal public school"),
+("AIKTC, Panvel","AIKTC, Panvel"),
+("AISSMS COE PUNE","AISSMS COE PUNE"),
+("AKU patna","AKU patna"),
+("AL AMEEN ENGINEERING COLLEGE","AL AMEEN ENGINEERING COLLEGE"),
+("Alliance University","Alliance University"),
+("Alpha College of Engineering & Tech., Kalol","Alpha College of Engineering & Tech., Kalol"),
+("Amity University","Amity University"),
+("Amrita School of Engineering, Bangalore","Amrita School of Engineering, Bangalore"),
+("Andalas university","Andalas university"),
+("Andhra Loyola College","Andhra Loyola College"),
+("Andhra university","Andhra university"),
+("Anglo Eastern ship management india Pvt. Ltd","Anglo Eastern ship management india Pvt. Ltd"),
+("Anjuman -I-Islam Kalsekar Technical Campus and School of Enginering","Anjuman -I-Islam Kalsekar Technical Campus and School of Enginering"),
+("Anna university","Anna university"),
+("Apex institute of technology and managment","Apex institute of technology and managment"),
+("APG UNIVERSITY SHIMLA","APG UNIVERSITY SHIMLA"),
+("Atharva College Of Engineering","Atharva College Of Engineering"),
+("Autonomous/kumaraguru college of technology coimbatore","Autonomous/kumaraguru college of technology coimbatore"),
+("Ayya Nadar Janaki Ammal College,Sivakasi","Ayya Nadar Janaki Ammal College,Sivakasi"),
+("B M S College of Engineering ,Bangalore","B M S College of Engineering ,Bangalore"),
+("Bannari Amman Institute of Technology","Bannari Amman Institute of Technology"),
+("Bapurao deshmukh college of engg.,nagpur university","Bapurao deshmukh college of engg.,nagpur university"),
+("Barkatullah university","Barkatullah university"),
+("BCRCE,DURGAPUR","BCRCE,DURGAPUR"),
+("Bhai Gurdas Polytechnic College","Bhai Gurdas Polytechnic College"),
+("Bharath university","Bharath university"),
+("Bharati Vidyapeeth College of Engineering","Bharati Vidyapeeth College of Engineering"),
+("Biju Patnaik University of Technology","Biju Patnaik University of Technology"),
+("BIRLA INSTITUTE OF TECHNOLOGY MESRA","BIRLA INSTITUTE OF TECHNOLOGY MESRA"),
+("Brahmanand institute of management & science","Brahmanand institute of management & science"),
+("BVRIT Hyderabad College of Engineering For Women","BVRIT Hyderabad College of Engineering For Women"),
+("Central University of Rajasthan","Central University of Rajasthan"),
+("Charusat University Changa","Charusat University Changa"),
+("CMR Institute of technology","CMR Institute of technology"),
+("College of engineering and technology,Bhubaneswar","College of engineering and technology,Bhubaneswar"),
+("COLLEGE OF ENGINEERING MUNNAR","COLLEGE OF ENGINEERING MUNNAR"),
+("College of Engineering Pune","College Of Engineering Roorkee"),
+("College Of Engineering Roorkee","Charusat University Changa"),
+("Concordia University","Concordia University"),
+("Cummins College Of Engineering for Women, Pune","Cummins College Of Engineering for Women, Pune"),
+("D. D. University","D. D. University"),
+("D. Y. P. I. E. T, Pimpri, Pune","D. Y. P. I. E. T, Pimpri, Pune"),
+("D.J. Sanghavi College of Engineering","D.J. Sanghavi College of Engineering"),
+("Deenbandhu Chhotu Ram University of Science & Technology","Deenbandhu Chhotu Ram University of Science & Technology"),
+("Defence Institute of Advanced Technology,Pune","Defence Institute of Advanced Technology,Pune"),
+("DELHI TECHNOLOGICAL UNIVERSITY","DELHI TECHNOLOGICAL UNIVERSITY"),
+("Dev Bhoomi Group Of Institution","Dev Bhoomi Group Of Institution"),
+("Dharamshinh desai university ,nadiad","Dharamshinh desai university ,nadiad"),
+("Don Bosco Institute of Technology, Kurla","Don Bosco Institute of Technology, Kurla"),
+("Dr. Babasaheb Ambedkar Marathwada University, Aurangabad","Dr. Babasaheb Ambedkar Marathwada University, Aurangabad"),
+("Dr.Mgr Educational and research institute university","Dr.Mgr Educational and research institute university"),
+("Excel Engineering College","Excel Engineering College"),
+("Fr. Conceicao Rodrigues College of Engineering","Fr. Conceicao Rodrigues College of Engineering"),
+("G.H.PATEL COLLEGE OF ENGINEERING AND TECHNOLOGY","G.H.PATEL COLLEGE OF ENGINEERING AND TECHNOLOGY"),
+("G.L. Bajaj Group of Institutions, Mathura","G.L. Bajaj Group of Institutions, Mathura"),
+("Gautam Buddha University , Greater Noida","Gautam Buddha University , Greater Noida"),
+("GD Goenka University","GD Goenka University"),
+("Genba Sopanrao Moze College Of Engineering","Genba Sopanrao Moze College Of Engineering"),
+("GITAM University, Visakhapatnam","GITAM University, Visakhapatnam"),
+("Gokaraju Rangaraju Institute of Engineering and Technology","Gokaraju Rangaraju Institute of Engineering and Technology"),
+("Government College of Engineering,Salem","Government College of Engineering,Salem"),
+("Government polytechnic awasari,Pune","Government polytechnic awasari,Pune"),
+("Govind Ballabh Pant Engineering College, Pauri Garhwal","Govind Ballabh Pant Engineering College, Pauri Garhwal"),
+("Gujarat Technical University","Gujarat Technical University"),
+("Gurgaon College of Engineering","Gurgaon College of Engineering"),
+("Gurunanak College","Gurunanak College"),
+("Harish-Chandra Research Institute, Allahabad","Harish-Chandra Research Institute, Allahabad"),
+("Heritage Institute of Technology","Heritage Institute of Technology"),
+("Ideal Institute of Technology,Ghaziabad","Ideal Institute of Technology,Ghaziabad"),
+("IIMT College of engineering,Gr.Noida","IIMT College of engineering,Gr.Noida"),
+("Indian Institute of chemical technology","Indian Institute of chemical technology"),
+("Indian Institute of Engineering Bombay","Indian Institute of Engineering Bombay"),
+("Indian Institute Of Information Technology Allahabad","Indian Institute Of Information Technology Allahabad"),
+("INDIAN INSTITUTE OF SCIENCE EDUCATION AND RESEARCH KOLKATA","INDIAN INSTITUTE OF SCIENCE EDUCATION AND RESEARCH KOLKATA"),
+("Indian Institute of Space Science and Technology","Indian Institute of Space Science and Technology"),
+("Indian Institute of Technology Madras","Indian Institute of Technology Madras"),
+("Indian Institute Of Technology, Hyderabad","Indian Institute Of Technology, Hyderabad"),
+("Indian School of Mines, Dhanbad","Indian School of Mines, Dhanbad"),
+("Indira Gandhi Delhi Technical University for Women, Delhi","Indira Gandhi Delhi Technical University for Women, Delhi"),
+("Institute of Technology & Management, Gwalior","Institute of Technology & Management, Gwalior"),
+("Institute of Chemical Technology,Mumbai","Institute of Chemical Technology,Mumbai"),
+("Institute of Road and transport Technology","Institute of Road and transport Technology"),
+("J.B. Institute of Engineering and Technology","J.B. Institute of Engineering and Technology"),
+("Jaggaiya peta engineering college","Jaggaiya peta engineering college"),
+("Jain college of Engineering (affiliated to VTU)","Jain college of Engineering (affiliated to VTU)"),
+("Jamia Milia Islamia, Delhi","Jamia Milia Islamia, Delhi"),
+("Jayamukhi Institute Of Technological Sciences","Jayamukhi Institute Of Technological Sciences"),
+("Jaypee Insitute of Information Technology,Noida","Jaypee Insitute of Information Technology,Noida"),
+("Kakatiya University","Kakatiya University"),
+("Krishna Institute of Engineering and Technology","Krishna Institute of Engineering and Technology"),
+("Koneru Lakshmaiah University","Koneru Lakshmaiah University"),
+("Lourdes Matha College of Science and Technology","Lourdes Matha College of Science and Technology"),
+("Madhav Institute of Technology and Science, Gwalior","Madhav Institute of Technology and Science, Gwalior"),
+("Maharaja Surajmal Institute of Technology, New Delhi","Maharaja Surajmal Institute of Technology, New Delhi"),
+("Manipal Institute of Technology, Manipal","Manipal Institute of Technology, Manipal"),
+("Manipal Institute of Technology,Jaipur","Manipal Institute of Technology,Jaipur"),
+("Motilal Nehru National Institute of Technology","Motilal Nehru National Institute of Technology"),
+("National institute of foundary and forge technology,Ranchi","National institute of foundary and forge technology,Ranchi"),
+("National Institute of Technology Agartala","National Institute of Technology Agartala"),
+("NATIONAL INSTITUTE OF TECHNOLOGY DURGAPUR","NATIONAL INSTITUTE OF TECHNOLOGY DURGAPUR"),
+("National Institute of Technology Karnataka","National Institute of Technology Karnataka"),
+("National Institute of Technology Kurukshetra","National Institute of Technology Kurukshetra"),
+("National Institute Of technology Meghalaya","National Institute Of technology Meghalaya"),
+("National Institute Of Technology Warangal","National Institute Of Technology Warangal"),
+("National Institute of Technology, Suratkal","National Institute of Technology, Suratkal"),
+("NATIONAL INSTITUTE OF TECHONOLOGY CALICUT","NATIONAL INSTITUTE OF TECHONOLOGY CALICUT"),
+("NIT,Jamshedpur","NIT,Jamshedpur"),
+("NIT TRICHY","NIT TRICHY"),
+("NIT Raipur","NIT Raipur"),
+("NIT jalandhar","NIT jalandhar"),
+("NBN Sinhgad School of engineering, Ambegaon(Bk), Pune","NBN Sinhgad School of engineering, Ambegaon(Bk), Pune"),
+("Osmania university","Osmania university"),
+("PES Insitute of Technology,Bangalore","PES Insitute of Technology,Bangalore"),
+("Padmabhushan Vasantdada Patil Pratishthan's College of Engineering","Padmabhushan Vasantdada Patil Pratishthan's College of Engineering"),
+("Roorkee Institute Of Technology","Roorkee Institute Of Technology"),
+("Sanjay Ghodawat Polytechnic Kolhapur","Sanjay Ghodawat Polytechnic Kolhapur"),
+("Sardar Vallabhbhai National Institute of Technology","Sardar Vallabhbhai National Institute of Technology"),
+("Saurashtra University","Saurashtra University"),
+("Savitribai phule pune university","Savitribai phule pune university"),
+("Sharda University,Greater Noida","Sharda University,Greater Noida"),
+("Shivaji University,Kolhapur","Shivaji University,Kolhapur"),
+("Shri Brahmanand Institute of Management and Computer Science","Shri Brahmanand Institute of Management and Computer Science"),
+("Shri Govindram Seksaria Institute of Technology and Science","Shri Govindram Seksaria Institute of Technology and Science"),
+("Shri Ramdeobaba College of Engineering and Management, Nagpur","Shri Ramdeobaba College of Engineering and Management, Nagpur"),
+("SIES GST- Mumbai University","SIES GST- Mumbai University"),
+("Sinhgad Institute Of Science and Technology,Narhe","Sinhgad Institute Of Science and Technology,Narhe"),
+("Sri Mittapalli College of Engineering","Sri Mittapalli College of Engineering"),
+("Sri Ramakrishna Engineering College, Coimbatore","Sri Ramakrishna Engineering College, Coimbatore"),
+("Sri Venkateswara university college of engineering","Sri Venkateswara university college of engineering"),
+("Stanley college of engineering and technology for women","Stanley college of engineering and technology for women"),
+("Swami Keshvanand Institute of Technology Management & Gramothan","Swami Keshvanand Institute of Technology Management & Gramothan"),
+("Symbiosis Institute of Computer Studies and Research","Symbiosis Institute of Computer Studies and Research"),
+("The LNM Institute of Information Technology","The LNM Institute of Information Technology"),
+("TKR College of Engineering Technology","TKR College of Engineering Technology"),
+("University of Alabama Huntsville","University of Alabama Huntsville"),
+("University Of Calicut","University Of Calicut"),
+("University of Delhi","University of Delhi"),
+("University of Mumbai","University of Mumbai"),
+("University of Pune","University of Pune"),
+("University of South Australia","University of South Australia"),
+("University of Vigo (Spain)","University of Vigo (Spain)"),
+("Uttarakhand Technical University","Uttarakhand Technical University"),
+("V R Siddhartha Engineering College","V R Siddhartha Engineering College"),
+("V. E. S. Institute of technology","V. E. S. Institute of technology"),
+("Vellore instiute of technology","Vellore instiute of technology"),
+("Vidya Pratishthan's College of Engineering","Vidya Pratishthan's College of Engineering"),
+("Vivekanand Education Society Institute Of Technology","Vivekanand Education Society Institute Of Technology"),
+("Walchand College of Engineering","Walchand College of Engineering"))
+
def get_notebook_dir(instance, filename):
book_dir = instance.book.title.replace(' ', '_')+'_by_'+instance.book.author.replace(' ','_')
@@ -101,6 +263,9 @@ class Book(models.Model):
title = models.CharField(max_length=500)
author = models.CharField(max_length=300)
category = models.CharField(max_length=32, choices=CATEGORY)
+ courses = models.CharField(max_length=32, choices=COURSES)
+ year = models.CharField(max_length=32, choices=YEAR)
+ university = models.CharField(max_length=100, choices=UNIVERSITY)
publisher_place = models.CharField(max_length=150)
isbn = models.CharField(max_length=50)
edition = models.CharField(max_length=15)
@@ -109,13 +274,14 @@ class Book(models.Model):
contributor = models.ForeignKey(Profile)
reviewer = models.ForeignKey(Reviewer)
approved = models.BooleanField(default=False)
- start_time = models.DateField(null=True, default=None)
- end_time = models.DateField(null=True, default=None)
+ start_date = models.DateField()
+ end_date = models.DateField()
tags = TaggableManager()
def __unicode__(self):
name = self.title or 'Book'
return '%s'%(name)
+
class OverwriteStorage(FileSystemStorage):
def get_available_name(self, name):
diff --git a/tbc/templates/tbc/browse-books.html b/tbc/templates/tbc/browse-books.html
index 31929b1..feb2185 100644
--- a/tbc/templates/tbc/browse-books.html
+++ b/tbc/templates/tbc/browse-books.html
@@ -31,6 +31,198 @@ function submitCategory()
<option value="computer programming">Computer Programming</option>
<option value="others">Others</option>
</select>
+<center><h4>Select a Course</h4></center>
+<form name="browseBooks" action="/browse-books/" method=GET enctype="multipart/form-data">
+{% csrf_token %}
+<center><select name="courses" id="courses" onchange="submitCategory();">
+ <option value="all">All</option>
+ <option value="M.Tech">M.Tech</option>
+ <option value="ME">ME</option>
+ <option value="MSc">MSc</option>
+ <option value="MScIT">MScIT</option>
+ <option value="MCA">MCA</option>
+ <option value="B.Tech">B.Tech</option>
+ <option value="BE">BE</option>
+ <option value="BCA">BCA</option>
+ <option value="BScIt">BScIt</option>
+ <option value="others">Others</option>
+</select>
+<center><h4>Select year of course</h4></center>
+<form name="browseBooks" action="/browse-books/" method=GET enctype="multipart/form-data">
+{% csrf_token %}
+<center><select name="year" id="year" onchange="submitCategory();">
+ <option value="all">All</option>
+ <option value="first">First year</option>
+ <option value="second">Second year</option>
+ <option value="third">Third year</option>
+ <option value="fourth">Fourth year</option>
+
+
+</select>
+<center><h4>Select University</h4></center>
+<form name="browseBooks" action="/browse-books/" method=GET enctype="multipart/form-data">
+{% csrf_token %}
+<center><select name="university" id="university" onchange="submitCategory();">
+<option value="all">All</option>
+<option value="A.I Kalsekar Technical Campus, Mumbai University">A.I Kalsekar Technical Campus, Mumbai University</option>
+<option value="AALIM MOHAMED SALEGH COLLEGE OF ENGINEERING">AALIM MOHAMED SALEGH COLLEGE OF ENGINEERING</option>
+<option value="ABAL Technologies">ABAL Technologies</option>
+<option value="ABES Engineering College">ABES Engineering College</option>
+<option value="Acharya Narendra Dev College">Acharya Narendra Dev College</option>
+<option value="Acropolis Institute of Technology & Research, Indore">Acropolis Institute of Technology & Research, Indore</option>
+<option value="Adamas University">Adamas University</option>
+<option value="Aggarwal public school">Aggarwal public school</option>
+<option value="AIKTC, Panvel">AIKTC, Panvel</option>
+<option value="AISSMS COE PUNE">AISSMS COE PUNE</option>
+<option value="AKU patna">AKU patna</option>
+<option value="AL AMEEN ENGINEERING COLLEGE">AL AMEEN ENGINEERING COLLEGE</option>
+<option value="Alliance University">Alliance University</option>
+<option value="Alpha College of Engineering & Tech., Kalol">Alpha College of Engineering & Tech., Kalol</option>
+<option value="Amity University">Amity University</option>
+<option value="Amrita School of Engineering, Bangalore">Amrita School of Engineering, Bangalore</option>
+<option value="Andalas university">Andalas university</option>
+<option value="Andhra Loyola College">Andhra Loyola College</option>
+<option value="Andhra university">Andhra university</option>
+<option value="Anglo Eastern ship management india Pvt. Ltd">Anglo Eastern ship management india Pvt. Ltd</option>
+<option value="Anjuman -I-Islam Kalsekar Technical Campus and School of Enginering">Anjuman -I-Islam Kalsekar Technical Campus and School of Enginering</option>
+<option value="Anna university">Anna university</option>
+<option value="Apex institute of technology and managment">Apex institute of technology and managment</option>
+<option value="APG UNIVERSITY SHIMLA">APG UNIVERSITY SHIMLA</option>
+<option value="Atharva College Of Engineering">Atharva College Of Engineering</option>
+<option value="Autonomous/kumaraguru college of technology coimbatore">Autonomous/kumaraguru college of technology coimbatore</option>
+<option value="Ayya Nadar Janaki Ammal College,Sivakasi">Ayya Nadar Janaki Ammal College,Sivakasi</option>
+<option value="B M S College of Engineering ,Bangalore">B M S College of Engineering ,Bangalore</option>
+<option value="Bannari Amman Institute of Technology">Bannari Amman Institute of Technology</option>
+<option value="Bapurao deshmukh college of engg.,nagpur university">Bapurao deshmukh college of engg.,nagpur university</option>
+<option value="Barkatullah university">Barkatullah university</option>
+<option value="BCRCE,DURGAPUR">BCRCE,DURGAPUR</option>
+<option value="Bhai Gurdas Polytechnic College">Bhai Gurdas Polytechnic College</option>
+<option value="Bharath university">Bharath university</option>
+<option value="Bharati Vidyapeeth College of Engineering">Bharati Vidyapeeth College of Engineering</option>
+<option value="Biju Patnaik University of Technology">Biju Patnaik University of Technology</option>
+<option value="BIRLA INSTITUTE OF TECHNOLOGY MESRA">BIRLA INSTITUTE OF TECHNOLOGY MESRA</option>
+<option value="Brahmanand institute of management & science">Brahmanand institute of management & science</option>
+<option value="BVRIT Hyderabad College of Engineering For Women">BVRIT Hyderabad College of Engineering For Women</option>
+<option value="Central University of Rajasthan">Central University of Rajasthan</option>
+<option value="Charusat University Changa">Charusat University Changa</option>
+<option value="CMR Institute of technology">CMR Institute of technology</option>
+<option value="College of engineering and technology,Bhubaneswar">College of engineering and technology,Bhubaneswar</option>
+<option value="COLLEGE OF ENGINEERING MUNNAR">COLLEGE OF ENGINEERING MUNNAR</option>
+<option value="College of Engineering Pune">College Of Engineering Roorkee</option>
+<option value="College Of Engineering Roorkee">Charusat University Changa</option>
+<option value="Concordia University">Concordia University</option>
+<option value="Cummins College Of Engineering for Women, Pune">Cummins College Of Engineering for Women, Pune</option>
+<option value="D. D. University">D. D. University</option>
+<option value="D. Y. P. I. E. T, Pimpri, Pune">D. Y. P. I. E. T, Pimpri, Pune</option>
+<option value="D.J. Sanghavi College of Engineering">D.J. Sanghavi College of Engineering</option>
+<option value="Deenbandhu Chhotu Ram University of Science & Technology">Deenbandhu Chhotu Ram University of Science & Technology</option>
+<option value="Defence Institute of Advanced Technology,Pune">Defence Institute of Advanced Technology,Pune</option>
+<option value="DELHI TECHNOLOGICAL UNIVERSITY">DELHI TECHNOLOGICAL UNIVERSITY</option>
+<option value="Dev Bhoomi Group Of Institution">Dev Bhoomi Group Of Institution</option>
+<option value="Dharamshinh desai university ,nadiad">Dharamshinh desai university ,nadiad</option>
+<option value="Don Bosco Institute of Technology, Kurla">Don Bosco Institute of Technology, Kurla</option>
+<option value="Dr. Babasaheb Ambedkar Marathwada University, Aurangabad">Dr. Babasaheb Ambedkar Marathwada University, Aurangabad</option>
+<option value="Dr.Mgr Educational and research institute university">Dr.Mgr Educational and research institute university</option>
+<option value="Excel Engineering College">Excel Engineering College</option>
+<option value="Fr. Conceicao Rodrigues College of Engineering">Fr. Conceicao Rodrigues College of Engineering</option>
+<option value="G.H.PATEL COLLEGE OF ENGINEERING AND TECHNOLOGY">G.H.PATEL COLLEGE OF ENGINEERING AND TECHNOLOGY</option>
+<option value="G.L. Bajaj Group of Institutions, Mathura">G.L. Bajaj Group of Institutions, Mathura</option>
+<option value="Gautam Buddha University , Greater Noida">Gautam Buddha University , Greater Noida</option>
+<option value="GD Goenka University">GD Goenka University</option>
+<option value="Genba Sopanrao Moze College Of Engineering">Genba Sopanrao Moze College Of Engineering</option>
+<option value="GITAM University, Visakhapatnam">GITAM University, Visakhapatnam</option>
+<option value="Gokaraju Rangaraju Institute of Engineering and Technology">Gokaraju Rangaraju Institute of Engineering and Technology</option>
+<option value="Government College of Engineering,Salem">Government College of Engineering,Salem</option>
+<option value="Government polytechnic awasari,Pune">Government polytechnic awasari,Pune</option>
+<option value="Govind Ballabh Pant Engineering College, Pauri Garhwal">Govind Ballabh Pant Engineering College, Pauri Garhwal</option>
+<option value="Gujarat Technical University">Gujarat Technical University</option>
+<option value="Gurgaon College of Engineering">Gurgaon College of Engineering</option>
+<option value="Gurunanak College">Gurunanak College</option>
+<option value="Harish-Chandra Research Institute, Allahabad">Harish-Chandra Research Institute, Allahabad</option>
+<option value="Heritage Institute of Technology">Heritage Institute of Technology</option>
+<option value="Ideal Institute of Technology,Ghaziabad">Ideal Institute of Technology,Ghaziabad</option>
+<option value="IIMT College of engineering,Gr.Noida">IIMT College of engineering,Gr.Noida</option>
+<option value="Indian Institute of chemical technology">Indian Institute of chemical technology</option>
+<option value="Indian Institute of Engineering Bombay">Indian Institute of Engineering Bombay</option>
+<option value="Indian Institute Of Information Technology Allahabad">Indian Institute Of Information Technology Allahabad</option>
+<option value="INDIAN INSTITUTE OF SCIENCE EDUCATION AND RESEARCH KOLKATA">INDIAN INSTITUTE OF SCIENCE EDUCATION AND RESEARCH KOLKATA</option>
+<option value="Indian Institute of Space Science and Technology">Indian Institute of Space Science and Technology</option>
+<option value="Indian Institute of Technology Madras">Indian Institute of Technology Madras</option>
+<option value="Indian Institute Of Technology, Hyderabad">Indian Institute Of Technology, Hyderabad</option>
+<option value="Indian School of Mines, Dhanbad">Indian School of Mines, Dhanbad</option>
+<option value="Indira Gandhi Delhi Technical University for Women, Delhi">Indira Gandhi Delhi Technical University for Women, Delhi</option>
+<option value="Institute of Technology & Management, Gwalior">Institute of Technology & Management, Gwalior</option>
+<option value="Institute of Chemical Technology,Mumbai">Institute of Chemical Technology,Mumbai</option>
+<option value="Institute of Road and transport Technology">Institute of Road and transport Technology</option>
+<option value="J.B. Institute of Engineering and Technology">J.B. Institute of Engineering and Technology</option>
+<option value="Jaggaiya peta engineering college">Jaggaiya peta engineering college</option>
+<option value="Jain college of Engineering (affiliated to VTU)">Jain college of Engineering (affiliated to VTU)</option>
+<option value="Jamia Milia Islamia, Delhi">Jamia Milia Islamia, Delhi</option>
+<option value="Jayamukhi Institute Of Technological Sciences">Jayamukhi Institute Of Technological Sciences</option>
+<option value="Jaypee Insitute of Information Technology,Noida">Jaypee Insitute of Information Technology,Noida</option>
+<option value="Kakatiya University">Kakatiya University</option>
+<option value="Krishna Institute of Engineering and Technology">Krishna Institute of Engineering and Technology</option>
+<option value="Koneru Lakshmaiah University">Koneru Lakshmaiah University</option>
+<option value="Lourdes Matha College of Science and Technology">Lourdes Matha College of Science and Technology</option>
+<option value="Madhav Institute of Technology and Science, Gwalior">Madhav Institute of Technology and Science, Gwalior</option>
+<option value="Maharaja Surajmal Institute of Technology, New Delhi">Maharaja Surajmal Institute of Technology, New Delhi</option>
+<option value="Manipal Institute of Technology, Manipal">Manipal Institute of Technology, Manipal</option>
+<option value="Manipal Institute of Technology,Jaipur">Manipal Institute of Technology,Jaipur</option>
+<option value="Motilal Nehru National Institute of Technology">Motilal Nehru National Institute of Technology</option>
+<option value="National institute of foundary and forge technology,Ranchi">National institute of foundary and forge technology,Ranchi</option>
+<option value="National Institute of Technology Agartala">National Institute of Technology Agartala</option>
+<option value="NATIONAL INSTITUTE OF TECHNOLOGY DURGAPUR">NATIONAL INSTITUTE OF TECHNOLOGY DURGAPUR</option>
+<option value="National Institute of Technology Karnataka">National Institute of Technology Karnataka</option>
+<option value="National Institute of Technology Kurukshetra">National Institute of Technology Kurukshetra</option>
+<option value="National Institute Of technology Meghalaya">National Institute Of technology Meghalaya</option>
+<option value="National Institute Of Technology Warangal">National Institute Of Technology Warangal</option>
+<option value="National Institute of Technology, Suratkal">National Institute of Technology, Suratkal</option>
+<option value="NATIONAL INSTITUTE OF TECHONOLOGY CALICUT">NATIONAL INSTITUTE OF TECHONOLOGY CALICUT</option>
+<option value="NIT,Jamshedpur">NIT,Jamshedpur</option>
+<option value="NIT TRICHY">NIT TRICHY</option>
+<option value="NIT Raipur">NIT Raipur</option>
+<option value="NIT jalandhar">NIT jalandhar</option>
+<option value="NBN Sinhgad School of engineering, Ambegaon(Bk), Pune">NBN Sinhgad School of engineering, Ambegaon(Bk), Pune</option>
+<option value="Osmania university">Osmania university</option>
+<option value="PES Insitute of Technology,Bangalore">PES Insitute of Technology,Bangalore</option>
+<option value="Padmabhushan Vasantdada Patil Pratishthan's College of Engineering">Padmabhushan Vasantdada Patil Pratishthan's College of Engineering</option>
+<option value="Roorkee Institute Of Technology">Roorkee Institute Of Technology</option>
+<option value="Sanjay Ghodawat Polytechnic Kolhapur">Sanjay Ghodawat Polytechnic Kolhapur</option>
+<option value="Sardar Vallabhbhai National Institute of Technology">Sardar Vallabhbhai National Institute of Technology</option>
+<option value="Saurashtra University">Saurashtra University</option>
+<option value="Savitribai phule pune university">Savitribai phule pune university</option>
+<option value="Sharda University,Greater Noida">Sharda University,Greater Noida</option>
+<option value="Shivaji University,Kolhapur">Shivaji University,Kolhapur</option>
+<option value="Shri Brahmanand Institute of Management and Computer Science">Shri Brahmanand Institute of Management and Computer Science</option>
+<option value="Shri Govindram Seksaria Institute of Technology and Science">Shri Govindram Seksaria Institute of Technology and Science</option>
+<option value="Shri Ramdeobaba College of Engineering and Management, Nagpur">Shri Ramdeobaba College of Engineering and Management, Nagpur</option>
+<option value="SIES GST- Mumbai University">SIES GST- Mumbai University</option>
+<option value="Sinhgad Institute Of Science and Technology,Narhe">Sinhgad Institute Of Science and Technology,Narhe</option>
+<option value="Sri Mittapalli College of Engineering">Sri Mittapalli College of Engineering</option>
+<option value="Sri Ramakrishna Engineering College, Coimbatore">Sri Ramakrishna Engineering College, Coimbatore</option>
+<option value="Sri Venkateswara university college of engineering">Sri Venkateswara university college of engineering</option>
+<option value="Stanley college of engineering and technology for women">Stanley college of engineering and technology for women</option>
+<option value="Swami Keshvanand Institute of Technology Management & Gramothan">Swami Keshvanand Institute of Technology Management & Gramothan</option>
+<option value="Symbiosis Institute of Computer Studies and Research">Symbiosis Institute of Computer Studies and Research</option>
+<option value="The LNM Institute of Information Technology">The LNM Institute of Information Technology</option>
+<option value="TKR College of Engineering Technology">TKR College of Engineering Technology</option>
+<option value="University of Alabama Huntsville">University of Alabama Huntsville</option>
+<option value="University Of Calicut">University Of Calicut</option>
+<option value="University of Delhi">University of Delhi</option>
+<option value="University of Mumbai">University of Mumbai</option>
+<option value="University of Pune">University of Pune</option>
+<option value="University of South Australia">University of South Australia</option>
+<option value="University of Vigo (Spain)">University of Vigo (Spain)</option>
+<option value="Uttarakhand Technical University">Uttarakhand Technical University</option>
+<option value="V R Siddhartha Engineering College">V R Siddhartha Engineering College</option>
+<option value="V. E. S. Institute of technology">V. E. S. Institute of technology</option>
+<option value="Vellore instiute of technology">Vellore instiute of technology</option>
+<option value="Vidya Pratishthan's College of Engineering">Vidya Pratishthan's College of Engineering</option>
+<option value="Vivekanand Education Society Institute Of Technology">Vivekanand Education Society Institute Of Technology</option>
+<option value="Walchand College of Engineering">Walchand College of Engineering</option>
+
+</select>
+
<div class="row-fluid">
{% for item in items %}
<div class ="module-list">
@@ -42,4 +234,14 @@ function submitCategory()
<script>
document.getElementById('category').value = "{{ category }}";
</script>
+<script>
+document.getElementById('courses').value = "{{ courses }}";
+</script>
+<script>
+document.getElementById('year').value = "{{ year }}";
+</script>
+<script>
+document.getElementById('university').value = "{{ university }}";
+</script>
{% endblock %}
+
diff --git a/tbc/urls.py b/tbc/urls.py
index 4177f2f..dfbee19 100644
--- a/tbc/urls.py
+++ b/tbc/urls.py
@@ -57,7 +57,8 @@ urlpatterns = [
url(r'^link-image/$', tbc.views.link_image, name='link_image'),
url(r'^books/$', tbc.views.books, name='books'),
url(r'^edit-book/(?P<book_id>\d+)/$', tbc.views.edit_book, name='edit_book'),
-
+ url(r'^books-fill-details/$', tbc.views.books_fill_details, name='books_fill_details'),
+ url(r'^edit-books-fill-details/(?P<book_id>\d+)/$', tbc.views.edit_books_fill_details, name='edit_books_fill_details'),
# ajax urls
url(r'^ajax/matching-books/$', tbc.views.ajax_matching_books, name='AjaxMatchingBooks'),
diff --git a/tbc/views.py b/tbc/views.py
index 52a9478..392e5c8 100644
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -401,7 +401,63 @@ def edit_book(request, book_id):
else:
return HttpResponseRedirect("/login/?require_login=true")
+def books_fill_details(request):
+ user = request.user
+ if user.is_superuser:
+ books = Book.objects.all()
+ books_incomplete = []
+ books_complete = []
+ auto = []
+ manual = []
+ for book in books:
+ if book.courses is None or book.year is None or book.university is None:
+ books_incomplete.append(book)
+ auto.append(book)
+ else:
+ books_complete.append(book)
+ manual.append(book)
+ context = {'auto': auto, 'manual': manual, 'books_complete': books_complete}
+ return render_to_response('tbc/books-fill-details.html', context)
+ else:
+ return HttpResponseRedirect("/login/?require_login=true")
+
+def edit_books_fill_details(request, book_id):
+ user = request.user
+ if user.is_superuser:
+ book = Book.objects.get(id=book_id)
+ context = {}
+ context.update(csrf(request))
+ if request.method == 'POST':
+ form = BookForm(request.POST, instance=book)
+ if form.is_valid():
+ form.save()
+ return books_fill_details(request)
+ else:
+ form.fields['title'].widget.attrs['readonly'] = True
+ form.fields['author'].widget.attrs['readonly'] = True
+ form.fields['publisher_place'].widget.attrs['readonly'] = True
+ form.fields['isbn'].widget.attrs['readonly'] = True
+ form.fields['edition'].widget.attrs['readonly'] = True
+ form.fields['year_of_pub'].widget.attrs['readonly'] = True
+ form.fields['no_chapters'].widget.attrs['readonly'] = True
+ context['form'] = form
+ context['book'] = book
+ return render_to_response('tbc/edit-books-fill-details.html', context)
+ form = BookForm(instance=book)
+ form.fields['title'].widget.attrs['readonly'] = True
+ form.fields['author'].widget.attrs['readonly'] = True
+ form.fields['publisher_place'].widget.attrs['readonly'] = True
+ form.fields['isbn'].widget.attrs['readonly'] = True
+ form.fields['edition'].widget.attrs['readonly'] = True
+ form.fields['year_of_pub'].widget.attrs['readonly'] = True
+ form.fields['no_chapters'].widget.attrs['readonly'] = True
+ context['form'] = form
+ context['book'] = book
+ return render_to_response('tbc/edit-books-fill-details.html', context)
+ else:
+ return HttpResponseRedirect("/login/?require_login=true")
+
def submit_book(request):
context = {}
if request.user.is_anonymous():
@@ -1202,9 +1258,15 @@ def notify_changes(request, book_id=None):
def browse_books(request):
context = {}
category = None
+ courses = None
+ year = None
+ university = None
images = []
book_images = []
books = None
+ #course_books = None
+ #year_of_course_list = None
+ #university_list = None
if request.user.is_anonymous():
context['anonymous'] = True
else:
@@ -1214,22 +1276,37 @@ def browse_books(request):
context['user'] = request.user
context.update(csrf(request))
books = Book.objects.filter(approved=True)
- if request.method == "POST":
- category = request.POST['category']
- if category == "all":
+ # course_books = Book.objects.filter(approved=True)
+ # year_of_course = Book.objects.filter(approved=True)
+ # university_list = Book.objects.filter(approved=True)
+ if request.method == "GET":
+ category = request.GET.get('category')
+ courses = request.GET.get('courses')
+ year = request.GET.get('year')
+ university = request.GET.get('university')
+ if category == "all" and courses == "all" and year == "all" and university == "all":
books = Book.objects.filter(approved=True)
+ elif category !="all" and courses == "all" and year == "all" and university == "all":
+ books = Book.objects.filter(category=category)
+ elif category =="all" and courses != "all" and year == "all" and university == "all":
+ books = Book.objects.filter(courses=courses)
+ elif category !="all" and courses == "all" and year != "all" and university == "all":
+ books = Book.objects.filter(year=year)
+ elif category !="all" and courses == "all" and year == "all" and university != "all":
+ books = Book.objects.filter(university=university)
else:
- books = Book.objects.filter(category=category, approved=True)
- else:
- books = Book.objects.filter(approved=True)
+ books = Book.objects.filter(category=category,courses=courses,year=year,university=university)
for book in books:
- images.append(ScreenShots.objects.filter(book=book)[0])
+ images.append(ScreenShots.objects.filter(book=book)[0])
for i in range(len(books)):
obj = {'book':books[i], 'image':images[i]}
book_images.append(obj)
- context['items'] = book_images
+ context[' items'] = book_images
context['category'] = category
- return render_to_response('tbc/browse-books.html', context)
+ context['courses'] = courses
+ context['year'] = year
+ context['university'] = university
+ return render_to_response('tbc/browse-books.html', context, context_instance=RequestContext(request))