diff options
-rw-r--r-- | .gitignore | 35 | ||||
-rw-r--r-- | manage.py | 18 | ||||
-rw-r--r-- | pyfoss/settings.py | 48 | ||||
-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/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 (renamed from website/templates/page.html) | 0 | ||||
-rw-r--r-- | website/urls.py | 12 | ||||
-rw-r--r-- | website/views.py | 5 |
15 files changed, 106 insertions, 37 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 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 @@ <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"> @@ -230,8 +230,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 7afce12..7b7b228 100644 --- a/website/models.py +++ b/website/models.py @@ -78,7 +78,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/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/page.html b/website/templates/website/page.html index cebac2c..cebac2c 100644 --- a/website/templates/page.html +++ b/website/templates/website/page.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 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) |