summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyfoss/settings.py15
-rw-r--r--static/website/templates/page.html62
-rw-r--r--website/models.py31
-rw-r--r--website/views.py53
4 files changed, 123 insertions, 38 deletions
diff --git a/pyfoss/settings.py b/pyfoss/settings.py
index 8e0c8db..d6ede29 100644
--- a/pyfoss/settings.py
+++ b/pyfoss/settings.py
@@ -4,6 +4,7 @@ from config import ( DB_NAME_DEFAULT, DB_USER_DEFAULT, DB_PASS_DEFAULT,
DB_HOST_DEFAULT, DB_PORT_DEFAULT, DB_NAME_FOSSEEIN, DB_USER_FOSSEEIN,
DB_PASS_FOSSEEIN, DB_HOST_FOSSEEIN, DB_PORT_FOSSEEIN )
+
PROJECT_DIR = abspath(dirname(__file__) + '/../')
PYFOSS_DIR = PROJECT_DIR + '/pyfoss/'
WEBSITE_DIR = PROJECT_DIR + '/website/'
@@ -47,9 +48,17 @@ DATABASES = {
'NAME': DB_NAME_FOSSEEIN,
'USER': DB_USER_FOSSEEIN,
'PASSWORD': DB_PASS_FOSSEEIN,
- 'HOST': DB_HOST_FOSSEEIN,
- 'PORT': DB_PORT_FOSSEEIN,# Or path to database file if using sqlite3
- # Set to empty string for default.
+ 'HOST': DB_HOST_FOSSEEIN, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
+ 'PORT': DB_PORT_FOSSEEIN, # Set to empty string for default.
+ },
+ 'tbcpython': {
+ 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': DB_NAME_TBC_PYTHON, # Or path to database file if using sqlite3.
+ 'USER': DB_USER_TBC_PYTHON,
+ 'PASSWORD': DB_PASS_TBC_PYTHON,
+ 'HOST': DB_HOST_TBC_PYTHON, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
+ 'PORT': DB_PORT_TBC_PYTHON, # Set to empty string for default.
+
}
}
diff --git a/static/website/templates/page.html b/static/website/templates/page.html
index 7e44ee5..4b54940 100644
--- a/static/website/templates/page.html
+++ b/static/website/templates/page.html
@@ -4,7 +4,7 @@
<html>
<head>
<title>{{ page.heading }} | python.fossee.in</title>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="{% static 'website/css/bootstrap.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'website/css/bootstrap-theme.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'website/css/lightbox.css'%}">
@@ -13,8 +13,8 @@
<script type="text/javascript" src="{% static 'website/js/jquery.tablesorter.js' %}"></
</head>
<body>
- <link rel="stylesheet" type="text/css" href="http://fossee.in/data/banner/css/nice-bar.css" />
- <script type="text/javascript" src="http://fossee.in/data/banner/js/nice-bar.js"></script>
+ <link rel="stylesheet" type="text/css" href="https://fossee.in/data/banner/css/nice-bar.css" />
+ <script type="text/javascript" src="https://fossee.in/data/banner/js/nice-bar.js"></script>
{% if permalink == 'home'%}
@@ -34,7 +34,7 @@
<div id="header-inner">
<div id="branding" class="pull-left">
<img id="brand-logo" src="{% static 'website/images/pylogo.png' %}">
- <a href="http://python.fossee.in" style="text-decoration: none; color: #424242">
+ <a href="https://python.fossee.in" style="text-decoration: none; color: #424242">
<span id="brand-text">Python</span>
</a>
</div>
@@ -155,7 +155,51 @@
</div>
</div>
</div>
- </div> <!-- /content -->
+ </div>
+ {% elif permalink == 'textbook-companions-for-academics' %}
+ <div id="content" class="col-lg-10 col-md-10 col-sm-10">
+
+ <h3>Textbook Companions (TBC) for Academics </h3>
+ <br>
+ <p>
+ {% if page.content %}
+ {{ page.content|safe }}
+ {% endif %}
+ </p>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapsestats">
+ List of completed books
+ </a>
+ </h4>
+ </div>
+ <div id="collapsestats" class="panel-collapse collapse">
+ <div class="panel-body">
+ <p>
+ <table id= "tbctable" class="tablesorter table table table-striped table-hover">
+ <thead>
+ <tr>
+ <th>Sr No.</th>
+ <th>Book</th>
+
+ </tr>
+ </thead>
+ <tbody>
+ {% for b in obj %}
+ <tr>
+ <td>{{ forloop.counter }}</td>
+ <td><a href="http://tbc-python.fossee.in/book-details/{{ b.id }}" target="_blank">{{ b.title }} by {{ b.author }}</a></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- /content -->
{% else %}
<div id="content" class="col-lg-10 col-md-10 col-sm-10">
<h3>{{ page.heading }} </h3>
@@ -221,8 +265,8 @@
</div> <!-- /page-wrapper -->
<div id="credits">
<center>
- This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />
- <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
+ This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br />
+ <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a>
</center>
</div>
@@ -253,13 +297,13 @@
ga('send', 'pageview');
</script>
-<noscript><p><img src="http://analytics.spoken-tutorial.org/piwik.php?idsite=14" style="border:0;" alt="" /></p></noscript>
+<noscript><p><img src="https://analytics.spoken-tutorial.org/piwik.php?idsite=14" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
<script type="text/javascript" src="{% static 'website/js/jquery.tablesorter.min.js' %}"></script>
<script type="text/javascript">
$(document).ready(function()
{
- $("#statstable").tablesorter();
+ $("#tbctable").tablesorter();
}
);
</script>
diff --git a/website/models.py b/website/models.py
index 7b7b228..f91dbeb 100644
--- a/website/models.py
+++ b/website/models.py
@@ -72,6 +72,20 @@ Models from fossee_new Database created using inspectdb
Use it with the "fossee_in" database eg:using("fossee_in")
These models are used only for django orm reference.
"""
+CATEGORY = (("fluid mechanics", "Fluid Mechanics"),
+ ("control systems", "Control Theory & Control Systems"),
+ ("chemical engineering", "Chemical Engineering"),
+ ("thermodynamics", "Thermodynamics"),
+ ("mechanical engineering", "Mechanical Engineering"),
+ ("signal processing", "Signal Processing"),
+ ("digital communications", "Digital Communications"),
+ ("electrical technology", "Electrical Technology"),
+ ("maths & science", "Mathematics & Pure Science"),
+ ("analog electronics", "Analog Electronics"),
+ ("digital electronics", "Digital Electronics"),
+ ("computer programming", "Computer Programming"),
+ ("others", "Others"))
+
class FOSSEEStats(models.Model):
w_id = models.IntegerField(unique=True, primary_key=True)
foss_name = models.CharField(max_length=500)
@@ -93,3 +107,20 @@ class FOSSEEStats(models.Model):
class Meta:
db_table = 'workshop'
+class TBCPYTHONBook(models.Model):
+ title = models.CharField(max_length=500)
+ author = models.CharField(max_length=300)
+ category = models.CharField(max_length=32, choices=CATEGORY)
+ publisher_place = models.CharField(max_length=150)
+ isbn = models.CharField(max_length=50)
+ edition = models.CharField(max_length=15)
+ year_of_pub = models.CharField(max_length=4)
+ no_chapters = models.IntegerField(default=0, blank=True)
+ contributor = models.IntegerField(default=0, blank=True)
+ reviewer = models.IntegerField(default=0, blank=True)
+ approved = models.BooleanField(default=False)
+ start_time = models.DateField(null=True, default=None)
+ end_time = models.DateField(null=True, default=None)
+ class Meta:
+ db_table = 'tbc_book'
+
diff --git a/website/views.py b/website/views.py
index 36693bd..7201427 100644
--- a/website/views.py
+++ b/website/views.py
@@ -1,6 +1,6 @@
from django.http import HttpResponse
from django.shortcuts import render, render_to_response, get_object_or_404
-from website.models import FOSSEEStats
+from website.models import FOSSEEStats, TBCPYTHONBook
from website.models import Nav, Page, Block
@@ -20,43 +20,44 @@ def block_sort(obj):
return items
def get_blocks():
- sidebar = Block.objects.get(block_name = "sidebar")
- footer = Block.objects.get(block_name = "footer")
- blocks = {
- 'navs': Nav.objects.order_by('position'),
- 'sidebar': block_sort(sidebar),
- 'footer': block_sort(footer)
- }
- return blocks
+ sidebar = Block.objects.get(block_name = "sidebar")
+ footer = Block.objects.get(block_name = "footer")
+ blocks = {
+ 'navs': Nav.objects.order_by('position'),
+ 'sidebar': block_sort(sidebar),
+ 'footer': block_sort(footer)
+ }
+ return blocks
def dispatcher(request, permalink=''):
+ context = {}
+
if permalink == 'python-workshops':
blocks = get_blocks()
rows = FOSSEEStats.objects.using('fossee_new').filter(foss_name='Python', type ='Workshop').order_by('-w_id')
python_wokshop_page_content = Page.objects.get(permalink='python-workshops-page')
- context = {
- 'page' : python_wokshop_page_content,
- 'navs': blocks['navs'],
- 'sidebar': blocks['sidebar'],
- 'footer': blocks['footer'],
- 'permalink': permalink,
- 'obj' : rows,
- }
+ context['page'] = python_wokshop_page_content
+ context['permalink'] = permalink
+ context['obj'] = rows
+
+ if permalink == 'textbook-companions-for-academics':
+ blocks = get_blocks()
+ textbook_companions_for_academics = Page.objects.get(permalink='textbook-companions-for-academics-page')
+ completed_books = TBCPYTHONBook.objects.using('tbcpython').values('id', 'title', 'author').filter(approved=True).order_by('id')
+
+ context['page'] = textbook_companions_for_academics
+ context['permalink'] = permalink
+ context['obj'] = completed_books
if permalink == '' or permalink == 'home' :
permalink = 'home'
page = get_object_or_404(Page, permalink=permalink)
blocks = get_blocks()
- context = {
- 'page': page,
- 'navs': blocks['navs'],
- 'sidebar': blocks['sidebar'],
- 'footer': blocks['footer'],
- 'permalink': permalink
- }
+ context['page'] = page
+ context['permalink'] = permalink
- if permalink != 'home' and permalink != 'python-workshops':
+ if permalink != 'home' and permalink != 'python-workshops' and permalink != 'textbook-companions-for-academics':
page = get_object_or_404(Page, permalink=permalink)
blocks = get_blocks()
context = {
@@ -66,5 +67,5 @@ def dispatcher(request, permalink=''):
'footer': blocks['footer'],
'permalink': permalink
}
-
return render(request, "website/page.html", context)
+