field for mobile number added
This commit is contained in:
parent
3bc70a9cf8
commit
f673ad41c0
|
@ -63,6 +63,22 @@ MEDIA_URL = '/media/'
|
|||
|
||||
STATIC_URL = '/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
|
||||
# trailing slash.
|
||||
|
@ -101,6 +117,8 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'userena.middleware.UserenaLocaleMiddleware',
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware'
|
||||
)
|
||||
|
||||
|
@ -180,9 +198,11 @@ LOGIN_REDIRECT_URL ='/accounts/%(username)s/'
|
|||
LOGIN_URL = '/accounts/signin/'
|
||||
LOGOUT_URL = '/accounts/signout/'
|
||||
#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_GRAVATAR=True
|
||||
USERENA_USE_MESSAGES = True
|
||||
USERENA_MUGSHOT_DEFAULT='monsterid'
|
||||
ANONYMOUS_USER_ID = -1
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ admin.autodiscover()
|
|||
from feeds import RouteFeed
|
||||
#import ox.django.api.urls
|
||||
#import mumbai
|
||||
from users.forms import SignupFormExtra
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
@ -43,9 +44,11 @@ urlpatterns = patterns('',
|
|||
(r'^admin/', include(admin.site.urls)),
|
||||
(r'^matchstops/$', 'mumbai.views.fuzzystops'),
|
||||
(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')),
|
||||
#(r'^accounts/signup/$', 'userena.views.signup',
|
||||
#{'signup_form': SignupFormExtra}),
|
||||
|
||||
url(r'^messages/',include('userena.contrib.umessages.urls')),
|
||||
|
||||
|
|
|
@ -2,28 +2,32 @@ from django import forms
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from userena.forms import SignupForm
|
||||
from users.models import UserProfile
|
||||
|
||||
class SignupFormExtra(SignupForm):
|
||||
first_name = forms.CharField(label = _(u'First name'),
|
||||
max_length =30,
|
||||
required=False)
|
||||
last_name = forms.CharField(label = _(u'Last name'),
|
||||
max_length = 30,
|
||||
required=False)
|
||||
mobile_number = forms.IntegerField(label = _(u'Mobile number'),
|
||||
max_value =9999999999,
|
||||
required=False)
|
||||
def __init__(self, *args, **kw):
|
||||
super(SignupFormExtra, self).__init__(*args, **kw)
|
||||
new_order = self.fields.keyOrder[:-3]
|
||||
new_order.insert(0, 'first_name')
|
||||
new_order.insert(1, 'last_name')
|
||||
new_order.insert(2, 'mobile_number')
|
||||
self.fields.KeyOrder = new_order
|
||||
#first_name = forms.CharField(label = _(u'First name'),
|
||||
# max_length =30,
|
||||
# required=False)
|
||||
#last_name = forms.CharField(label = _(u'Last name'),
|
||||
# max_length = 30,
|
||||
# required=False)
|
||||
mobile_number = forms.CharField(label = _(u'mobile number'),
|
||||
max_length =10,
|
||||
required=True)
|
||||
# def __init__(self, *args, **kw):
|
||||
# super(SignupFormExtra, self).__init__(*args, **kw)
|
||||
# new_order = self.fields.keyOrder[:-3]
|
||||
# new_order.insert(0, 'first_name')
|
||||
# new_order.insert(1, 'last_name')
|
||||
# new_order.insert(2, 'mobile_number')
|
||||
# self.fields.KeyOrder = new_order
|
||||
def save(self):
|
||||
new_user= super(SignupFormExtra, self).save()
|
||||
new_user.first_name = self.cleaned_data['first_name']
|
||||
new_user.last_name = self.cleaned_data['last_name']
|
||||
new_user.mobile_number = self.cleaned_data['mobile_number']
|
||||
new_user.save()
|
||||
return new_user()
|
||||
user_profile = new_user.get_profile()
|
||||
#user_profile.first_name = self.cleaned_data['first_name']
|
||||
#user_profile.last_name = self.cleaned_data['last_name']
|
||||
user_profile.mobile_number = self.cleaned_data['mobile_number']
|
||||
#user_profile.mobile_number = UserProfile.objects.get_or_create(name=user_profile.mobile_number)
|
||||
|
||||
user_profile.save()
|
||||
return new_user
|
||||
|
|
|
@ -30,7 +30,10 @@ class UserProfile(UserenaLanguageBaseProfile):
|
|||
website = models.URLField(_('website'), blank=True, verify_exists=True)
|
||||
location = models.CharField(_('location'), max_length=255, blank=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)
|
||||
|
||||
@property
|
||||
def age(self):
|
||||
if not self.birth_date: return False
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
<p><strong>Fax:</strong><br>
|
||||
{{ profile.fax }}
|
||||
</p>
|
||||
<p><strong>Hello!!</strong></p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock content %}
|
||||
|
|
|
@ -1 +1,44 @@
|
|||
# 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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user