From 7dac1e7475cb7c76001fbe213a3c005b1f39eb60 Mon Sep 17 00:00:00 2001 From: Akshen Date: Wed, 19 Jul 2017 11:44:10 +0530 Subject: Migrates to 1.10 --- .gitignore | 35 ++++++++ manage.py | 18 +++- pyfoss/settings.py | 48 ++++++---- pyfoss/urls.py | 6 +- requirements.txt | 7 +- static/website/templates/page.html | 7 +- website/admin.py | 3 +- website/models.py | 2 +- website/templates/content.html | 3 - website/templates/footer.html | 0 website/templates/header.html | 0 website/templates/home.html | 0 website/templates/page.html | 154 --------------------------------- website/templates/website/content.html | 3 + website/templates/website/footer.html | 0 website/templates/website/header.html | 0 website/templates/website/home.html | 0 website/templates/website/page.html | 154 +++++++++++++++++++++++++++++++++ website/urls.py | 12 +-- website/views.py | 5 +- 20 files changed, 263 insertions(+), 194 deletions(-) create mode 100644 .gitignore delete mode 100644 website/templates/content.html delete mode 100644 website/templates/footer.html delete mode 100644 website/templates/header.html delete mode 100644 website/templates/home.html delete mode 100644 website/templates/page.html create mode 100644 website/templates/website/content.html create mode 100644 website/templates/website/footer.html create mode 100644 website/templates/website/header.html create mode 100644 website/templates/website/home.html create mode 100644 website/templates/website/page.html 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 + diff --git a/manage.py b/manage.py index ba18135..350f15c 100644 --- a/manage.py +++ b/manage.py @@ -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 2eae224..d676b4a 100644 --- a/pyfoss/settings.py +++ b/pyfoss/settings.py @@ -1,11 +1,14 @@ #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 +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 @@ -32,19 +35,21 @@ 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': { '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. - 'PORT': DB_PORT_FOSSEEIN, # Set to empty string for default. + 'HOST': DB_HOST_FOSSEEIN, + 'PORT': DB_PORT_FOSSEEIN,# Or path to database file if using sqlite3 + # Set to empty string for default. } } @@ -108,18 +113,31 @@ 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', @@ -128,7 +146,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' @@ -150,7 +168,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 f9f3eb0..7e44ee5 100644 --- a/static/website/templates/page.html +++ b/static/website/templates/page.html @@ -122,11 +122,11 @@

- Python Workshop Statistics + Workshops Completed

-
+

@@ -230,8 +230,7 @@ - - +< !--Piwik-- > - - - - diff --git a/website/templates/website/content.html b/website/templates/website/content.html new file mode 100644 index 0000000..88e9736 --- /dev/null +++ b/website/templates/website/content.html @@ -0,0 +1,3 @@ +{% block content %} +

Contene

+{% endblock%} \ No newline at end of file diff --git a/website/templates/website/footer.html b/website/templates/website/footer.html new file mode 100644 index 0000000..e69de29 diff --git a/website/templates/website/header.html b/website/templates/website/header.html new file mode 100644 index 0000000..e69de29 diff --git a/website/templates/website/home.html b/website/templates/website/home.html new file mode 100644 index 0000000..e69de29 diff --git a/website/templates/website/page.html b/website/templates/website/page.html new file mode 100644 index 0000000..cebac2c --- /dev/null +++ b/website/templates/website/page.html @@ -0,0 +1,154 @@ +{% load static %} + + + + {{ page.heading }} | python.fossee.in + + + + + +
+ {% block page %} + + {% block header %} +
+
+ + +
+
+
+ {% endblock %} + + {% block content %} +
+
+
+

{{ page.heading }}

+

+ {{ page.content|safe }} +

+
+ + +
+
+
+ {% endblock %} + +
+
+ +
+
+ + {% block footer %} + +
+ Sponsored by:
+ National Mission on Education through ICT
+ MHRD
+ http://www.sakshat.ac.in +
+ {% endblock %} + + {% endblock %} +
+ + + + + + 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.+)/$', 'website.views.dispatcher', name="dispatcher"), -) + url(r'^$', dispatcher, name="home"), + url(r'^(?P.+)/$', dispatcher, name="dispatcher"), +] diff --git a/website/views.py b/website/views.py index c0a61e1..36693bd 100644 --- a/website/views.py +++ b/website/views.py @@ -32,7 +32,7 @@ def get_blocks(): 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 = { @@ -66,4 +66,5 @@ def dispatcher(request, permalink=''): 'footer': blocks['footer'], 'permalink': permalink } - return render(request, 'website/templates/page.html', context) + + return render(request, "website/page.html", context) -- cgit From 830ce9396c6ce97dcbcb5e79484545efbd4276e1 Mon Sep 17 00:00:00 2001 From: Akshen Date: Mon, 24 Jul 2017 14:47:01 +0530 Subject: NavBar reset to leftside --- pyfoss/settings.py | 9 +- website/templates/website/page.html | 400 +++++++++++++++++++++++------------- 2 files changed, 259 insertions(+), 150 deletions(-) diff --git a/pyfoss/settings.py b/pyfoss/settings.py index d676b4a..6670a04 100644 --- a/pyfoss/settings.py +++ b/pyfoss/settings.py @@ -12,7 +12,7 @@ BASE_DIR = dirname(dirname(abspath(__file__))) # Django settings for pyfoss project. DEBUG = True -TEMPLATE_DEBUG = DEBUG + ADMINS = ( # ('Your Name', 'your_email@example.com'), @@ -139,6 +139,7 @@ TEMPLATES = [ ] + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -154,12 +155,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', diff --git a/website/templates/website/page.html b/website/templates/website/page.html index cebac2c..7e44ee5 100644 --- a/website/templates/website/page.html +++ b/website/templates/website/page.html @@ -1,154 +1,268 @@ + {% load static %} - - {{ page.heading }} | python.fossee.in - - - - - -
- {% block page %} - - {% block header %} -
-
-
- - + + {{ page.heading }} | python.fossee.in + + + + + + + + {% if permalink == 'home'%} + + + + + {% endif %} +
+ {% block page %} + + {% block header %} +
+
+ - -
-
-
- {% endblock %} - - {% block content %} -
-
-
-

{{ page.heading }}

-

- {{ page.content|safe }} -

-
- - -
-
-
- {% endblock %} - -
-
- -
-
- - {% block footer %} - +
+ {% endblock %} + + {% block content %} +
+
+ + + + {% if permalink == 'python-workshops' %} +
+ +

Python Workshops

+
+

+ {% if page.content %} + {{ page.content|safe }} + {% endif %} +

+
+ +
+
+

+

+ + + + + + + + + + + {% for b in obj %} + + + + + + + {% endfor %} -
- - - -
+
+
NameStart DateVenueNo of Participants
{{ b.w_name }}{{ b.startdate }}{{ b.venue }}{{ b.no_of_participant }}Details
+

+
+
+
+ + {% else %} +
+

{{ page.heading }}

+

+ {{ page.content|safe }} +

+
+ + {% endif %} + +
+ + + {% endblock %} + +
+
+ +
+
+ + {% block footer %} + +
Sponsored by:
National Mission on Education through ICT
MHRD
http://www.sakshat.ac.in -
- {% endblock %} - - {% endblock %} - - - - - - + + {% endblock %} + {% endblock %} + +
+
+ This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
+ + Creative Commons License +
+
+ + + + +< !--Piwik-- > + + + + + + + + -- cgit From 409675848cea1cd35910283367097e8e298349b4 Mon Sep 17 00:00:00 2001 From: Akshen Date: Tue, 25 Jul 2017 11:52:26 +0530 Subject: Updates DB reference --- pyfoss/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfoss/settings.py b/pyfoss/settings.py index 6670a04..8e0c8db 100644 --- a/pyfoss/settings.py +++ b/pyfoss/settings.py @@ -42,7 +42,7 @@ DATABASES = { '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, 'USER': DB_USER_FOSSEEIN, -- cgit