From 2db5425fe0e1f86b1e7f7dd72b22fd48d32a8d74 Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 2 Feb 2012 15:49:45 +0530 Subject: [PATCH] created, modified changes + erang css + script to update meeting dates --- itf/app/models.py | 12 ++++++++++++ itf/festival/models.py | 1 + itf/frontpage/views.py | 2 +- itf/settings.py | 28 +++++++++++++++++++++------- itf/static/css/modules/emailer.css | 7 ++++++- itf/tmp/utils.py | 10 ++++++++++ itf/urls.py | 2 ++ requirements.txt | 3 ++- 8 files changed, 55 insertions(+), 10 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index 509a7d4..4483378 100755 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -10,6 +10,7 @@ from insidepages.models import ModuleTab, ModelExtra from os.path import exists from sorl.thumbnail import get_thumbnail from django.template import RequestContext +import datetime def splitSearch(string): ret = [] @@ -36,6 +37,17 @@ class ItfModel(models.Model): hasComments = True title_field = "title" is_itf_model = True + changed = models.DateTimeField(null=True, editable=False) + created = models.DateTimeField(null=True, editable=False) + + def save(self, *args, **kwargs): + ''' On save, update timestamps ''' + if not self.id: + self.created = datetime.datetime.today() + self.changed = datetime.datetime.today() + if self.created == None: + self.created = self.changed + super(ItfModel, self).save(*args, **kwargs) class Meta: abstract = True diff --git a/itf/festival/models.py b/itf/festival/models.py index 74ef193..043524e 100755 --- a/itf/festival/models.py +++ b/itf/festival/models.py @@ -38,6 +38,7 @@ class Meeting(ItfModel): slug = models.SlugField() fts_fields = ['title', 'intro'] + def preview_dict(self): return { 'id': self.id, diff --git a/itf/frontpage/views.py b/itf/frontpage/views.py index 750b726..81ac2b7 100755 --- a/itf/frontpage/views.py +++ b/itf/frontpage/views.py @@ -11,7 +11,7 @@ from django.core.mail import send_mail class ContactForm(forms.Form): name = forms.CharField(max_length=255) - email = forms.EmailField() + email = forms.CharField() message = forms.CharField(widget=Textarea(attrs={'cols': 10, 'rows': 6})) def save(self, fail_silently=False): diff --git a/itf/settings.py b/itf/settings.py index a2e1b5e..85cfdb3 100755 --- a/itf/settings.py +++ b/itf/settings.py @@ -29,7 +29,7 @@ HAYSTACK_WHOOSH_PATH = join(PROJECT_PATH, "../whoosh/itf_index") CKEDITOR_MEDIA_PREFIX = "/static/ckeditor/" CKEDITOR_UPLOAD_PATH = join(PROJECT_PATH, "static/upload/images/") -AUTH_PROFILE_MODULE = "profiles.Person" +AUTH_PROFILE_MODULE = "itfprofiles.ItfProfile" LOGIN_REDIRECT_URL = "/t/" @@ -41,12 +41,25 @@ INTERNAL_IPS = ('127.0.0.1',) MANAGERS = ADMINS -DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = 'theatre' # Or path to database file if using sqlite3. -DATABASE_USER = 'root' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. +#DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +#DATABASE_NAME = 'theatre' # Or path to database file if using sqlite3. +#DATABASE_USER = 'root' # Not used with sqlite3. +#DATABASE_PASSWORD = '' # Not used with sqlite3. +#DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +#DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'theatre', # Or path to database file if using sqlite3. + 'USER': 'root', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} + + TWITTER_ID = "sachin_rt" @@ -160,6 +173,7 @@ INSTALLED_APPS = ( 'scriptbank', 'bestpractices', 'emailer', + 'itfprofiles', 'pages', 'tagging', 'app', diff --git a/itf/static/css/modules/emailer.css b/itf/static/css/modules/emailer.css index a395d32..b66653f 100755 --- a/itf/static/css/modules/emailer.css +++ b/itf/static/css/modules/emailer.css @@ -174,7 +174,12 @@ cursor: pointer; font-family:"Century Gothic", Arial, Helvetica, sans-serif; font-size:12px; padding-right:12px; - float:right; + float:right; +} + +.authorBio { + padding-left:8px; + padding-right:8px; } .articleImg { diff --git a/itf/tmp/utils.py b/itf/tmp/utils.py index dca54f9..d74e97a 100644 --- a/itf/tmp/utils.py +++ b/itf/tmp/utils.py @@ -17,4 +17,14 @@ def clean_participants(): d.delete() print u +def add_meeting_dates(): + for m in Meeting.objects.all(): + dates = MeetingDay.objects.filter(meeting=m) + if len(dates) > 0: + date = dates[0].meeting_date + if not m.created: + m.created = date + if not m.changed: + m.changed = date + m.save() diff --git a/itf/urls.py b/itf/urls.py index ebb4a90..38991b3 100755 --- a/itf/urls.py +++ b/itf/urls.py @@ -4,6 +4,7 @@ import os from os.path import join from django.views.generic.simple import direct_to_template # from django.auth.views import login, logout, register, +from itfprofiles.forms import ItfRegistrationForm # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -31,6 +32,7 @@ urlpatterns = patterns('', (r'jsdoc/', 'api.views.jsdoc'), (r'site.json', 'app.views.site_json'), (r'^itf/', include('festival.urls')), +# (r'^accounts/register/', 'registration.views.register', {'form_class': ItfRegistrationForm }), (r'^accounts/', include('registration.urls')), (r'^admin/', include(admin.site.urls)), ('^getLanguages', 'itfcore.views.getLanguages'), diff --git a/requirements.txt b/requirements.txt index f7d3fba..d2aa5b0 100755 --- a/requirements.txt +++ b/requirements.txt @@ -4,9 +4,10 @@ -e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg -e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_firefogg -e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields +-e git://github.com/bit/django-extensions.git#egg=django_extensions sorl-thumbnail django-tagging -django-extensions +#django-extensions django-debug-toolbar South django-ckeditor