This commit is contained in:
Sanj 2012-11-13 16:30:22 +05:30
commit 2dadadb86e
9 changed files with 111 additions and 36 deletions

View File

@ -11,7 +11,7 @@
.foot .right img{display:inline; float:right; padding:5px 2px 5px 5px; width:15px; height:15px;} .foot .right img{display:inline; float:right; padding:5px 2px 5px 5px; width:15px; height:15px;}
/* primary navigation */ /* primary navigation */
.banner {background:url('img/header_bg.png') repeat-x; background-size:contain;} /* background image for the global nav + text logo bar */ .banner {background:url('../images/header_bg.png') repeat-x; background-size:contain;} /* background image for the global nav + text logo bar */
.navlink a {color:#fff;} .navlink a {color:#fff;}
.sms { float:right; background-color:green; border:2px solid green;} .sms { float:right; background-color:green; border:2px solid green;}
.trip {float:left; background-color:#BEDB74; border:2px solid #BEDB74;} .trip {float:left; background-color:#BEDB74; border:2px solid #BEDB74;}
@ -228,6 +228,7 @@ span.half {display:inline; float:left; margin:0; padding:0; width:50%;}
.highlight2 ul{font-size:1em; padding-left:6%; list-style-type: none;} .highlight2 ul{font-size:1em; padding-left:6%; list-style-type: none;}
.highlight2 li {padding-bottom:12px;} .highlight2 li {padding-bottom:12px;}
.highlight2 li span.small {font-size:0.8em; font-style:normal !important;}
.highlight p span,.highlight ul span, .highlight2 p span,.highlight2 ul span{font-style:italic;} .highlight p span,.highlight ul span, .highlight2 p span,.highlight2 ul span{font-style:italic;}
.actionbutton {color:red; padding:2px 10px ; background-color:#FBDD09 !important; border:2px solid yellow; border-radius:15px; text-align:center !important;} .actionbutton {color:red; padding:2px 10px ; background-color:#FBDD09 !important; border:2px solid yellow; border-radius:15px; text-align:center !important;}

View File

@ -178,7 +178,7 @@ Change widths as necessary
.nav {height:85px; margin:0;} .nav {height:85px; margin:0;}
.foot {height:50px;} .foot {height:50px;}
.logoimg {display:block; float:left; height: 60px; width:32%; background:URL('img/chalobestlogoS.png') #deeebf no-repeat; background-position: 4px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;} .logoimg {display:block; float:left; height: 60px; width:32%; background:URL('../images/chalobestlogoS.png') #deeebf no-repeat; background-position: 4px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;}
.global{display:block; float:right; width:65.95%; height:30px; padding-right:0.99%; color:#FBDD09;} .global{display:block; float:right; width:65.95%; height:30px; padding-right:0.99%; color:#FBDD09;}
.logotext {display:block; float:left; width:100%; height:30px; margin:0; padding:0;} .logotext {display:block; float:left; width:100%; height:30px; margin:0; padding:0;}
.logotext img {height:100%;} .logotext img {height:100%;}
@ -267,7 +267,7 @@ Change widths as necessary
.nav {height:55px; margin:0;} .nav {height:55px; margin:0;}
.foot {height:50px;} .foot {height:50px;}
.logoimg {display:block; float:left; height: 55px; width:28%; background:URL('img/chalobestlogoS.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;} .logoimg {display:block; float:left; height: 55px; width:28%; background:URL('../images/chalobestlogoS.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;}
.global{display:block; float:left; width:69.95%; height:30px; padding-right:0.99%;} .global{display:block; float:left; width:69.95%; height:30px; padding-right:0.99%;}
.logotext {display:block; float:left; width:51.01%; height:25px; margin:3px 0 0 0;} .logotext {display:block; float:left; width:51.01%; height:25px; margin:3px 0 0 0;}
.globallinks{display:block; float:right; width:48%; height:30px; padding:10px 0.99% 0 0; background-color:inherit; vertical-align:bottom;} .globallinks{display:block; float:right; width:48%; height:30px; padding:10px 0.99% 0 0; background-color:inherit; vertical-align:bottom;}
@ -351,7 +351,7 @@ Change widths as necessary
.nav {height:60px; margin:0;} .nav {height:60px; margin:0;}
.foot {height:50px;} .foot {height:50px;}
.logoimg {display:block; float:left; height: 60px; width:18%; background:URL('img/chalobestlogoS.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;} .logoimg {display:block; float:left; height: 60px; width:18%; background:URL('../images/chalobestlogoS.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;}
.global{display:block; float:left; width:79.95%; height:30px; padding-right:0.99%;} .global{display:block; float:left; width:79.95%; height:30px; padding-right:0.99%;}
.logotext {display:block; float:left; height:30px; margin:0; padding:0;} .logotext {display:block; float:left; height:30px; margin:0; padding:0;}
.globallinks{display:block; float:right; width:30%; height:30px; padding:10px 0.99% 0 0; background-color:inherit; vertical-align:bottom;} .globallinks{display:block; float:right; width:30%; height:30px; padding:10px 0.99% 0 0; background-color:inherit; vertical-align:bottom;}
@ -434,7 +434,7 @@ Change widths as necessary
.nav {height:60px; margin:0;} .nav {height:60px; margin:0;}
.foot {height:50px;} .foot {height:50px;}
.logoimg {display:block; float:left; height: 60px; width:15%; background:URL('img/chalobestlogoS.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;} .logoimg {display:block; float:left; height: 60px; width:15%; background:URL('../images/chalobestlogoS.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;}
.global{display:block; float:left; width:82.95%; height:30px; padding-right:0.99%;} .global{display:block; float:left; width:82.95%; height:30px; padding-right:0.99%;}
.logotext {display:block; float:left; width:23.01%; height:30px; margin:0; padding:0;} .logotext {display:block; float:left; width:23.01%; height:30px; margin:0; padding:0;}
.globallinks{display:block; float:right; width:30%; height:30px; padding:10px 0.99% 0 0; background-color:inherit; vertical-align:bottom;} .globallinks{display:block; float:right; width:30%; height:30px; padding:10px 0.99% 0 0; background-color:inherit; vertical-align:bottom;}
@ -523,7 +523,7 @@ Change widths as necessary
.nav {height:70px; margin:0;} .nav {height:70px; margin:0;}
.foot {height:50px;} .foot {height:50px;}
.logoimg {display:block; float:left; height: 80px; width:12.33%; background:URL('img/chalobestlogoM.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;} .logoimg {display:block; float:left; height: 80px; width:12.33%; background:URL('../images/chalobestlogoM.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;}
.global{display:block; float:left; margin:0; width:85.65%; height:40px;} .global{display:block; float:left; margin:0; width:85.65%; height:40px;}
.logotext {display:block; float:left; width:23.01%; height:40px; margin:0; padding:0;} .logotext {display:block; float:left; width:23.01%; height:40px; margin:0; padding:0;}
.globallinks{display:block; float:right; width:30%; height:30px; padding:17px 0.99% 0 0; background-color:inherit; vertical-align:bottom;} .globallinks{display:block; float:right; width:30%; height:30px; padding:17px 0.99% 0 0; background-color:inherit; vertical-align:bottom;}
@ -609,7 +609,7 @@ Change widths as necessary
.nav {height:80px; margin:0;} .nav {height:80px; margin:0;}
.foot {height:50px;} .foot {height:50px;}
.logoimg {display:block; float:left; height:80px; width:10.33%; background:URL('img/chalobestlogo.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;} .logoimg {display:block; float:left; height:80px; width:10.33%; background:URL('../images/chalobestlogo.png') #deeebf no-repeat; background-position: 12px top; overflow:hidden; margin:0; padding:0 0 0 1.03%;}
.global{display:block; float:left; width:87.65%; height:50px; margin:0;} .global{display:block; float:left; width:87.65%; height:50px; margin:0;}
.logotext {display:block; float:left; width:23.01%; height:50px;} .logotext {display:block; float:left; width:23.01%; height:50px;}
.globallinks{display:block; float:right; width:30%; height:30px; padding:25px 0.99% 0 0; background-color:inherit; vertical-align:bottom;} .globallinks{display:block; float:right; width:30%; height:30px; padding:25px 0.99% 0 0; background-color:inherit; vertical-align:bottom;}

View File

@ -63,6 +63,22 @@ MEDIA_URL = '/media/'
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = join(PROJECT_ROOT, 'static') STATIC_ROOT = join(PROJECT_ROOT, 'static')
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(PROJECT_ROOT, 'mumbai/static'),
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash. # trailing slash.
@ -101,6 +117,8 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'userena.middleware.UserenaLocaleMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware' 'debug_toolbar.middleware.DebugToolbarMiddleware'
) )
@ -180,9 +198,11 @@ LOGIN_REDIRECT_URL ='/accounts/%(username)s/'
LOGIN_URL = '/accounts/signin/' LOGIN_URL = '/accounts/signin/'
LOGOUT_URL = '/accounts/signout/' LOGOUT_URL = '/accounts/signout/'
#LOGIN_REDIRECT_URL = '/profiles/profile/' #LOGIN_REDIRECT_URL = '/profiles/profile/'
USERENA_DISABLE_PROFILE_LIST = False #USERENA_DISABLE_PROFILE_LIST = False
USERENA_DISABLE_PROFILE_LIST = True
USERENA_MUGSHOT_SIZE = 140 USERENA_MUGSHOT_SIZE = 140
USERENA_MUGSHOT_GRAVATAR=True USERENA_MUGSHOT_GRAVATAR=True
USERENA_USE_MESSAGES = True
USERENA_MUGSHOT_DEFAULT='monsterid' USERENA_MUGSHOT_DEFAULT='monsterid'
ANONYMOUS_USER_ID = -1 ANONYMOUS_USER_ID = -1

View File

@ -149,9 +149,9 @@
<h2>ChaloBEST SMS</h2> <h2>ChaloBEST SMS</h2>
<div class="leading20"></div> <div class="leading20"></div>
<ul> <ul>
<li><b>Directions: </b><br /> "<span>[stop name]</span><b> to </b><span>[stop name]</span>"</li> <li><span class="small"><b>Directions: </b></span><br /> <span>[stop name]</span><b>&nbsp;&nbsp; to &nbsp;&nbsp;</b><span>[stop name]</span></li>
<li><b>Buses at your stop:</b><br /> "<span>[stop name]</span>"</li> <li><span class="small"><b>Buses at your stop:</b></span><br /><span>[stop name]</span></li>
<li><b>Bus stop list &amp; frequency:</b><br /> "<span>[number]</span>"</li> <li><span class="small"><b>Bus stop list &amp; frequency:</b></span><br /><span>[bus number]</span></li>
<li><h2>SMS 9619524420</h2></li> <li><h2>SMS 9619524420</h2></li>
</ul> </ul>
</div> </div>

View File

@ -7,6 +7,7 @@ admin.autodiscover()
from feeds import RouteFeed from feeds import RouteFeed
#import ox.django.api.urls #import ox.django.api.urls
#import mumbai #import mumbai
from users.forms import SignupFormExtra
urlpatterns = patterns('', urlpatterns = patterns('',
@ -43,10 +44,12 @@ urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)), (r'^admin/', include(admin.site.urls)),
(r'^matchstops/$', 'mumbai.views.fuzzystops'), (r'^matchstops/$', 'mumbai.views.fuzzystops'),
(r'^fuzzystops_edit/$', 'mumbai.views.fuzzystops_edit'), (r'^fuzzystops_edit/$', 'mumbai.views.fuzzystops_edit'),
# url(r'^accounts/', include('userena.urls')),
url(r'^accounts/signup/$',
'userena.views.signup',
{'signup_form': SignupFormExtra}),
url(r'^accounts/', include('userena.urls')), url(r'^accounts/', include('userena.urls')),
#(r'^accounts/signup/$', 'userena.views.signup',
#{'signup_form': SignupFormExtra}),
url(r'^messages/',include('userena.contrib.umessages.urls')), url(r'^messages/',include('userena.contrib.umessages.urls')),

View File

@ -2,28 +2,32 @@ from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from userena.forms import SignupForm from userena.forms import SignupForm
from users.models import UserProfile
class SignupFormExtra(SignupForm): class SignupFormExtra(SignupForm):
first_name = forms.CharField(label = _(u'First name'), #first_name = forms.CharField(label = _(u'First name'),
max_length =30, # max_length =30,
required=False) # required=False)
last_name = forms.CharField(label = _(u'Last name'), #last_name = forms.CharField(label = _(u'Last name'),
max_length = 30, # max_length = 30,
required=False) # required=False)
mobile_number = forms.IntegerField(label = _(u'Mobile number'), mobile_number = forms.CharField(label = _(u'Mobile number'),
max_value =9999999999, max_length =10,
required=False) required=True)
def __init__(self, *args, **kw): # def __init__(self, *args, **kw):
super(SignupFormExtra, self).__init__(*args, **kw) # super(SignupFormExtra, self).__init__(*args, **kw)
new_order = self.fields.keyOrder[:-3] # new_order = self.fields.keyOrder[:-3]
new_order.insert(0, 'first_name') # new_order.insert(0, 'first_name')
new_order.insert(1, 'last_name') # new_order.insert(1, 'last_name')
new_order.insert(2, 'mobile_number') # new_order.insert(2, 'mobile_number')
self.fields.KeyOrder = new_order # self.fields.KeyOrder = new_order
def save(self): def save(self):
new_user = super(SignupFormExtra, self).save() new_user= super(SignupFormExtra, self).save()
new_user.first_name = self.cleaned_data['first_name'] user_profile = new_user.get_profile()
new_user.last_name = self.cleaned_data['last_name'] #user_profile.first_name = self.cleaned_data['first_name']
new_user.mobile_number = self.cleaned_data['mobile_number'] #user_profile.last_name = self.cleaned_data['last_name']
new_user.save() user_profile.mobile_number = self.cleaned_data['mobile_number']
return new_user() #user_profile.mobile_number = UserProfile.objects.get_or_create(name=user_profile.mobile_number)
user_profile.save()
return new_user

View File

@ -30,7 +30,10 @@ class UserProfile(UserenaLanguageBaseProfile):
website = models.URLField(_('website'), blank=True, verify_exists=True) website = models.URLField(_('website'), blank=True, verify_exists=True)
location = models.CharField(_('location'), max_length=255, blank=True) location = models.CharField(_('location'), max_length=255, blank=True)
birth_date = models.DateField(_('birth date'), blank=True, null=True) birth_date = models.DateField(_('birth date'), blank=True, null=True)
# about_me = models.TextField(_('about me'), blank = True)
mobile_number = models.CharField(_('mobile number'), blank = True, max_length=10)
about_me = models.TextField(_('about me'), blank = True) about_me = models.TextField(_('about me'), blank = True)
@property @property
def age(self): def age(self):
if not self.birth_date: return False if not self.birth_date: return False

View File

@ -85,6 +85,7 @@
<p><strong>Fax:</strong><br> <p><strong>Fax:</strong><br>
{{ profile.fax }} {{ profile.fax }}
</p> </p>
<p><strong>Hello!!</strong></p>
{% endif %} {% endif %}
{% endblock content %} {% endblock content %}

View File

@ -1 +1,44 @@
# Create your views here. # Create your views here.
from django.core.management import setup_environ
import settings
setup_environ(settings)
from users.models import UserProfile
from django.shortcuts import redirect
from django.shortcuts import render_to_response
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.template import RequestContext
import django.utils.simplejson as json
import os
import urllib2
#from users.models import *
from StringIO import StringIO
#from django.http import HttpResponse
from django.contrib.auth.models import User
def getsmsfeed(request):
current_user = request.user
print current_user
users = user.objects.all()
apireq = urllib2.Request('http://sms.chalobest.in/messages_json/?phone_no='+mobilenumber)
apires = urllib2.urlopen(apireq)
try:
#jsonres = json.dumps(apires,sort_keys=True)
##print jsonres.__class__
#print apires
jstr = json.load(apires)
l = (json.dumps(jstr,sort_keys=True)).split("}")
#print l
sjstr = sorted(l, key=lambda l:l[0])
#print sjstr[0]['datetime']
#k = [i for i, j, k in jstr[1]]
print sjstr[-5:]
#print jstr.get('text')
#print l.__class__
except ValueError,e:
print e