diff options
author | Prashant S | 2019-02-18 16:53:11 +0530 |
---|---|---|
committer | GitHub | 2019-02-18 16:53:11 +0530 |
commit | 33b7be32d0aced65a9f4ebf9801de41e48b9abfc (patch) | |
tree | 84689cd90b66b272ef350705d58fe2ea7371a819 | |
parent | b63385c838b958a5d58bccd013c4e635669ceb8a (diff) | |
parent | 7b2421c19ae723fbfff2753522b2bdd1a90316e2 (diff) | |
download | pyfoss-33b7be32d0aced65a9f4ebf9801de41e48b9abfc.tar.gz pyfoss-33b7be32d0aced65a9f4ebf9801de41e48b9abfc.tar.bz2 pyfoss-33b7be32d0aced65a9f4ebf9801de41e48b9abfc.zip |
Merge pull request #3 from Akshen/develop
Migrates from 1.5 to 1.10
-rw-r--r-- | .gitignore | 35 | ||||
-rw-r--r-- | manage.py | 18 | ||||
-rw-r--r-- | pyfoss/settings.py | 56 | ||||
-rw-r--r-- | pyfoss/urls.py | 6 | ||||
-rw-r--r-- | requirements.txt | 7 | ||||
-rw-r--r-- | static/website/templates/page.html | 7 | ||||
-rw-r--r-- | website/admin.py | 3 | ||||
-rw-r--r-- | website/models.py | 2 | ||||
-rw-r--r-- | website/templates/page.html | 154 | ||||
-rw-r--r-- | website/templates/website/content.html (renamed from website/templates/content.html) | 0 | ||||
-rw-r--r-- | website/templates/website/footer.html (renamed from website/templates/footer.html) | 0 | ||||
-rw-r--r-- | website/templates/website/header.html (renamed from website/templates/header.html) | 0 | ||||
-rw-r--r-- | website/templates/website/home.html (renamed from website/templates/home.html) | 0 | ||||
-rw-r--r-- | website/templates/website/page.html | 268 | ||||
-rw-r--r-- | website/urls.py | 12 | ||||
-rw-r--r-- | website/views.py | 16 |
16 files changed, 382 insertions, 202 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..545cd16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Distribution / packaging +.Python +*.log +develop-eggs/ +eggs/ +.eggs/ +lib/ +*.egg-info/ +.installed.cfg +*.egg +pip-log.txt +pip-delete-this-directory.txt + +# Django stuff: +*.log +local_settings.py + +# PyBuilder +target/ + +#Database +db1.sqlite3 +db2.sqlite3 + +# Django Migration files +migrations/ + +#MAC OS specific +.DS_Store + @@ -5,6 +5,20 @@ import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pyfoss.settings") - from django.core.management import execute_from_command_line - + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise execute_from_command_line(sys.argv) + diff --git a/pyfoss/settings.py b/pyfoss/settings.py index de362a9..d6ede29 100644 --- a/pyfoss/settings.py +++ b/pyfoss/settings.py @@ -1,15 +1,19 @@ #Custom settings for pyfoss project. from os.path import * -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, DB_NAME_TBC_PYTHON, DB_USER_TBC_PYTHON, DB_PASS_TBC_PYTHON, DB_HOST_TBC_PYTHON, DB_PORT_TBC_PYTHON +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/' +BASE_DIR = dirname(dirname(abspath(__file__))) # Django settings for pyfoss project. DEBUG = True -TEMPLATE_DEBUG = DEBUG + ADMINS = ( # ('Your Name', 'your_email@example.com'), @@ -32,15 +36,16 @@ MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': DB_NAME_DEFAULT, # Or path to database file if using sqlite3. + 'NAME': DB_NAME_DEFAULT, 'USER': DB_USER_DEFAULT, 'PASSWORD': DB_PASS_DEFAULT, - 'HOST': DB_HOST_DEFAULT, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. - 'PORT': DB_PORT_DEFAULT, # Set to empty string for default. + 'HOST': DB_HOST_DEFAULT, + 'PORT': DB_PORT_DEFAULT, # Or path to database file if using sqlite3. + # Set to empty string for default. }, - 'fossee_in': { + 'fossee_new': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': DB_NAME_FOSSEEIN, # Or path to database file if using sqlite3. + 'NAME': DB_NAME_FOSSEEIN, 'USER': DB_USER_FOSSEEIN, 'PASSWORD': DB_PASS_FOSSEEIN, 'HOST': DB_HOST_FOSSEEIN, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. @@ -53,6 +58,7 @@ DATABASES = { '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. + } } @@ -116,18 +122,32 @@ STATICFILES_DIRS = ( STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', + 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) # Make this unique, and don't share it with anybody. SECRET_KEY = '8c8tb3=y%+0_ax+uyu%v*t#ly8&5=h78qwx1&15a0c59!x5a4f' # List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) + + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', @@ -136,7 +156,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'pyfoss.urls' @@ -144,12 +164,6 @@ ROOT_URLCONF = 'pyfoss.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'pyfoss.wsgi.application' -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - PROJECT_DIR + '/static/', -) INSTALLED_APPS = ( 'django.contrib.auth', @@ -158,7 +172,7 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', - 'nested_inlines', + 'nested_inline', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: diff --git a/pyfoss/urls.py b/pyfoss/urls.py index ad08d4a..9779a3c 100644 --- a/pyfoss/urls.py +++ b/pyfoss/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import patterns, include, url +from django.conf.urls import include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() -urlpatterns = patterns('', +urlpatterns = [ # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), # Uncomment the admin/doc line below to enable admin documentation: @@ -14,4 +14,4 @@ urlpatterns = patterns('', # url(r'^$', 'pyfoss.views.home', name='home'), # url(r'^pyfoss/', include('pyfoss.foo.urls')), url(r'^', include('website.urls', namespace='website')), -) +] diff --git a/requirements.txt b/requirements.txt index a45fea0..8fe6457 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -Django==1.5 -MySQL-python==1.2.5 -django-nested-inlines==0.1 +configparser==3.5.0 +Django==1.10 +django-nested-inline==0.3.7 +mysqlclient==1.3.10 diff --git a/static/website/templates/page.html b/static/website/templates/page.html index a13d4b1..4b54940 100644 --- a/static/website/templates/page.html +++ b/static/website/templates/page.html @@ -122,11 +122,11 @@ <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapsestats"> - Python Workshop Statistics + Workshops Completed </a> </h4> </div> - <div id="collapsestats" class="panel-collapse collapse in"> + <div id="collapsestats" class="panel-collapse collapse"> <div class="panel-body"> <p> <table id= "statstable" class="tablesorter table table table-striped table-hover"> @@ -274,8 +274,7 @@ <script src="{% static 'website/js/jquery.min.js' %}"></script> <script src="{% static 'website/js/bootstrap.min.js' %}"></script> <script src="{% static 'website/js/lightbox.min.js' %}"></script> - <!--<script src="{% static 'website/js/nice-bar.js' %}"></script>--> -<!-- Piwik --> +< !--Piwik-- > <script type="text/javascript"> var _paq = _paq || []; _paq.push(['trackPageView']); diff --git a/website/admin.py b/website/admin.py index 80ea439..c5af339 100644 --- a/website/admin.py +++ b/website/admin.py @@ -1,5 +1,6 @@ + from django.contrib import admin -from nested_inlines.admin import NestedModelAdmin, NestedStackedInline, NestedTabularInline +from nested_inline.admin import NestedModelAdmin, NestedStackedInline, NestedTabularInline from website.models import Nav, SubNav, Page, Link, LinkBox, TextBox, Block diff --git a/website/models.py b/website/models.py index 8237839..f91dbeb 100644 --- a/website/models.py +++ b/website/models.py @@ -92,7 +92,7 @@ class FOSSEEStats(models.Model): type = models.CharField(max_length=50) w_name = models.CharField(max_length=500) body = models.TextField() - no_of_participant = models.IntegerField(max_length=5) + no_of_participant = models.IntegerField() event_link = models.TextField() startdate = models.DateTimeField() starttime = models.TimeField() diff --git a/website/templates/page.html b/website/templates/page.html deleted file mode 100644 index cebac2c..0000000 --- a/website/templates/page.html +++ /dev/null @@ -1,154 +0,0 @@ -{% load static %} -<!doctype html> -<html> - <head> - <title>{{ page.heading }} | python.fossee.in</title> - <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}"> - <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-theme.min.css' %}"> - <link rel="stylesheet" type="text/css" href="{% static 'css/main.css'%}"> - </head> - <body> - <div id="page-wrapper"> - {% block page %} - - {% block header %} - <div id="header-wrapper"> - <div id="header-inner"> - <div id="branding" class="pull-left"> - <a href="http://python.fossee.in" style="text-decoration: none; color: #424242"> - <img id="brand-logo" src="{% static 'images/pylogo.png' %}"> - <span id="brand-text">Python</span> - </a> - </div> - <ul id="main-nav" class="nav nav-pills pull-right"> - {% for nav in navs %} - {% with subnavs=nav.subnav_set.all %} - {% if nav.link|slice:":4" == "http" or nav.link == "#" %} - <li> - <a href="{{ nav.link }}"> - {% else %} - <li class="dropdown"> - {% if subnavs|length > 0 %} - <a class="dropdown-toggle" data-toggle="dropdown" href="#"> - {% else %} - <a href="{% url 'website:dispatcher' nav.link %}"> - {% endif %} - {% endif %} - {{ nav.nav_name }} {% if subnavs|length > 0 %} <span class="caret"></span> {% endif %} - </a> - {% if subnavs|length > 0 %} - <ul class="dropdown-menu pull-right"> - {% for subnav in subnavs %} - <li><a href="{% url 'website:dispatcher' subnav.link %}">{{ subnav.subnav_name }}</a></li> - {% endfor %} - </ul> - {% endif %} - </li> - {% endwith %} - {% endfor %} - </ul> - <div class="clearfix"></div> - </div> <!-- /header-inner --> - </div> <!-- /header-wrapper --> - {% endblock %} - - {% block content %} - <div id="content-wrapper"> - <div id="content-inner" class="row"> - <div id="content" class="col-lg-10"> - <h3>{{ page.heading }} </h3> - <p> - {{ page.content|safe }} - </p> - </div> <!-- /content --> - - <div id="sidebar" class="col-lg-2"> - {% for block in sidebar %} - {% if block.linkbox_name %} - <div class="block"> - <h5 class="block-heading">{{ block.linkbox_name }}</h4> - <ul> - {% for link in block.link_set.all|dictsort:"position" %} - {% if link.link|slice:":4" == "http" or nav.link == "#" %} - <li><a href="{{link.link}}">{{ link.link_name }}</a></li> - {% else %} - <li><a href="{% url 'website:dispatcher' link.link %}">{{ link.link_name }}</a></li> - {% endif %} - {% endfor %} - </ul> - </div> <!-- /block --> - {% endif %} - - {% if block.textbox_name %} - <div class="block"> - <h5 class="block-heading">{{ block.textbox_name }}</h4> - <p> - {{ block.content|safe }} - </p> - </div> <!-- /block --> - {% endif %} - - {% endfor %} - </div> <!-- /sidebar --> - <div class="clearfix"></div> - </div> <!-- /content-inner --> - </div> <!-- /content-wrapper --> - {% endblock %} - - <div id="extra-wrapper"> - <div id="extra-inner" class="row"> - <!-- /future use --> - </div> <!-- /extra-inner --> - </div> <!-- /extra-wrapper --> - - {% block footer %} - <div id="footer-wrapper"> - <div id="footer-inner"> - {% for block in footer %} - {% if block.linkbox_name %} - <div class="foot col-lg-4"> - <h5 class="foot-heading">{{ block.linkbox_name }}</h4> - <ul> - {% for link in block.link_set.all|dictsort:"position" %} - {% if link.link|slice:":4" == "http" or link.link == "#" %} - <li><a href="{{ link.link }}">{{ link.link_name }}</a></li> - {% else %} - <li><a href="{% url 'website:dispatcher' link.link %}">{{ link.link_name }}</a></li> - {% endif %} - {% endfor %} - </ul> - </div> <!-- /foot --> - {% endif %} - - {% if block.textbox_name %} - <div class="foot col-lg-4"> - <h5 class="foot-heading">{{ block.textbox_name }}</h4> - <p> - {{ block.content|safe }} - </p> - </div> <!-- /foot --> - {% endif %} - - {% endfor %} - <div class="clearfix"></div> - <img id="django-logo" src="{% static 'images/django-logo.png' %}"> - </div> <!-- /footer-inner --> - </div> <!-- /footer-wrapper --> - <center> - Sponsored by:<br> - National Mission on Education through ICT<br> - MHRD<br> - <a href="http://www.sakshat.ac.in" target="_blank">http://www.sakshat.ac.in</a> - </center> - {% endblock %} - - {% endblock %} - </div> <!-- /page-wrapper --> - - <script src="{% static 'js/jquery.min.js' %}"></script> - <script src="{% static 'js/bootstrap.min.js' %}"></script> - <script type="text/javascript"> - - </script> - </body> -</html> diff --git a/website/templates/content.html b/website/templates/website/content.html index 88e9736..88e9736 100644 --- a/website/templates/content.html +++ b/website/templates/website/content.html diff --git a/website/templates/footer.html b/website/templates/website/footer.html index e69de29..e69de29 100644 --- a/website/templates/footer.html +++ b/website/templates/website/footer.html diff --git a/website/templates/header.html b/website/templates/website/header.html index e69de29..e69de29 100644 --- a/website/templates/header.html +++ b/website/templates/website/header.html diff --git a/website/templates/home.html b/website/templates/website/home.html index e69de29..e69de29 100644 --- a/website/templates/home.html +++ b/website/templates/website/home.html diff --git a/website/templates/website/page.html b/website/templates/website/page.html new file mode 100644 index 0000000..7e44ee5 --- /dev/null +++ b/website/templates/website/page.html @@ -0,0 +1,268 @@ + +{% load static %} +<!doctype html> +<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> + <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'%}"> + <link rel="stylesheet" type="text/css" href="{% static 'website/css/main.css'%}"> + <link rel="shortcut icon" type="image/png" href="{% static 'website/images/pylogo.png'%}"/> + <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> + {% if permalink == 'home'%} + + +<!--<div class="nice-bar"> +<center> +<a class="nice-text" href="https://docs.google.com/forms/d/e/1FAIpQLSfMg5E9EauODDxgsP1j67FK6MsESNp7qi4kN2VnrEAm57IznA/viewform" target="_blank"> <img src="http://fossee.in/data/banner/images/OM_webbnr3.png" > </a> + </center> + +</div>--> + + {% endif %} + <div id="page-wrapper"> + {% block page %} + + {% block header %} + <div id="header-wrapper"> + <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"> + <span id="brand-text">Python</span> + </a> + </div> + <ul id="main-nav" class="nav nav-pills pull-right"> + {% for nav in navs %} + {% with subnavs=nav.subnav_set.all %} + {% if nav.link|slice:":4" == "http" or nav.link == "#" %} + <li> + <a href="{{ nav.link }}"> + {% else %} + <li class="dropdown"> + {% if subnavs|length > 0 %} + <a class="dropdown-toggle" data-toggle="dropdown" href="#"> + {% else %} + <a href="{% url 'website:dispatcher' nav.link %}"> + {% endif %} + {% endif %} + {{ nav.nav_name }} {% if subnavs|length > 0 %} <span class="caret"></span> {% endif %} + </a> + {% if subnavs|length > 0 %} + <ul class="dropdown-menu pull-right"> + {% for subnav in subnavs %} + {% if subnav.link|slice:":4" == "http" or subnav.link == "#" %} + <li><a href="{{ subnav.link }}" target="_blank">{{ subnav.subnav_name }}</a></li> + {% else %} + <li><a href="{% url 'website:dispatcher' subnav.link %}">{{ subnav.subnav_name }}</a></li> + {% endif %} + {% endfor %} + </ul> + {% endif %} + </li> + {% endwith %} + {% endfor %} + </ul> + <div class="clearfix"></div> + </div> <!-- /header-inner --> + </div> <!-- /header-wrapper --> + {% endblock %} + + {% block content %} + <div id="content-wrapper"> + <div id="content-inner" class="row"> + + <div id="sidebar" class="col-lg-2 col-md-2 col-sm-2"> + {% for block in sidebar %} + {% if block.linkbox_name %} + <div class="block"> + <h5 class="block-heading">{{ block.linkbox_name }}</h4> + <ul> + {% for link in block.link_set.all|dictsort:"position" %} + {% if link.link|slice:":4" == "http" or nav.link == "#" %} + <li><a href="{{link.link}}" target="_blank">{{ link.link_name }}</a></li> + {% else %} + <li><a href="{% url 'website:dispatcher' link.link %}">{{ link.link_name }}</a></li> + {% endif %} + {% endfor %} + </ul> + </div> <!-- /block --> + {% endif %} + + {% if block.textbox_name %} + <div class="block"> + <h5 class="block-heading">{{ block.textbox_name }}</h4> + <p> + {{ block.content|safe }} + </p> + </div> <!-- /block --> + {% endif %} + + {% endfor %} + </div> <!-- /sidebar --> + + <!--------------------------- --> + {% if permalink == 'python-workshops' %} + <div id="content" class="col-lg-10 col-md-10 col-sm-10"> + + <h3>Python Workshops </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"> + Workshops Completed + </a> + </h4> + </div> + <div id="collapsestats" class="panel-collapse collapse"> + <div class="panel-body"> + <p> + <table id= "statstable" class="tablesorter table table table-striped table-hover"> + <thead> + <tr> + <th>Name</th> + <th>Start Date</th> + <th>Venue</th> + <th>No of Participants</th> + <th> </th> + </tr> + </thead> + <tbody> + {% for b in obj %} + <tr> + <td>{{ b.w_name }}</td> + <td>{{ b.startdate }}</td> + <td>{{ b.venue }}</td> + <td>{{ b.no_of_participant }}</td> + <td><a href="http://fossee.in/events/view_details/{{ b.w_id }}" target="_blank">Details</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> + <p> + {{ page.content|safe }} + </p> + </div> <!-- /content --> + + {% endif %} + <!--------------------------- --> + <div class="clearfix"></div> + </div> <!-- /content-inner --> + </div> <!-- /content-wrapper --> + {% endblock %} + + <div id="extra-wrapper"> + <div id="extra-inner" class="row"> + <!-- /future use --> + </div> <!-- /extra-inner --> + </div> <!-- /extra-wrapper --> + + {% block footer %} + <div id="footer-wrapper"> + <div id="footer-inner"> + {% for block in footer %} + {% if block.linkbox_name %} + <div class="foot col-lg-4 col-md-4 col-sm-4"> + <h5 class="foot-heading">{{ block.linkbox_name }}</h4> + <ul> + {% for link in block.link_set.all|dictsort:"position" %} + {% if link.link|slice:":4" == "http" or link.link == "#" %} + <li><a href="{{ link.link }}" target="_blank">{{ link.link_name }}</a></li> + {% else %} + <li><a href="{% url 'website:dispatcher' link.link %}">{{ link.link_name }}</a></li> + {% endif %} + {% endfor %} + </ul> + </div> <!-- /foot --> + {% endif %} + + {% if block.textbox_name %} + <div class="foot col-lg-4 col-lg-4 col-sm-4"> + <h5 class="foot-heading">{{ block.textbox_name }}</h4> + <p> + {{ block.content|safe }} + </p> + </div> <!-- /foot --> + {% endif %} + + {% endfor %} + <div class="clearfix"></div> + <img id="django-logo" src="{% static 'website/images/django-logo.png' %}"> + </div> <!-- /footer-inner --> + </div> <!-- /footer-wrapper --> + <center> + Sponsored by:<br> + National Mission on Education through ICT<br> + MHRD<br> + <a href="http://www.sakshat.ac.in" target="_blank">http://www.sakshat.ac.in</a> + </center> + {% endblock %} + {% endblock %} + </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/"> + <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a> +</center> +</div> + + <script src="{% static 'website/js/jquery.min.js' %}"></script> + <script src="{% static 'website/js/bootstrap.min.js' %}"></script> + <script src="{% static 'website/js/lightbox.min.js' %}"></script> +< !--Piwik-- > +<script type="text/javascript"> + var _paq = _paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://analytics.spoken-tutorial.org/"; + _paq.push(['setTrackerUrl', u+'piwik.php']); + _paq.push(['setSiteId', 14]); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; + g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); + })(); +</script> +<script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-60190813-1', 'auto'); + ga('send', 'pageview'); + +</script> +<noscript><p><img src="http://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(); + } +); +</script> + </body> +</html> + diff --git a/website/urls.py b/website/urls.py index 808f537..8b753b5 100644 --- a/website/urls.py +++ b/website/urls.py @@ -1,8 +1,8 @@ -from django.conf.urls import patterns, include, url - -urlpatterns = patterns('', +from django.conf.urls import include, url +from .views import dispatcher +urlpatterns = [ # Main pages dispatcher - url(r'^$', 'website.views.dispatcher', name="home"), - url(r'^(?P<permalink>.+)/$', 'website.views.dispatcher', name="dispatcher"), -) + url(r'^$', dispatcher, name="home"), + url(r'^(?P<permalink>.+)/$', dispatcher, name="dispatcher"), +] diff --git a/website/views.py b/website/views.py index 1b9b914..7201427 100644 --- a/website/views.py +++ b/website/views.py @@ -34,7 +34,7 @@ def dispatcher(request, permalink=''): if permalink == 'python-workshops': blocks = get_blocks() - rows = FOSSEEStats.objects.using('fossee_in').filter(foss_name='Python', type ='Workshop').order_by('-w_id') + 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 @@ -60,10 +60,12 @@ def dispatcher(request, permalink=''): 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['page'] = page - context['permalink'] = permalink + context = { + 'page': page, + 'navs': blocks['navs'], + 'sidebar': blocks['sidebar'], + 'footer': blocks['footer'], + 'permalink': permalink + } + return render(request, "website/page.html", context) - context['navs'] = blocks['navs'] - context['sidebar'] = blocks['sidebar'] - context['footer'] = blocks['footer'] - return render(request, 'website/templates/page.html', context) |