From 8c012e3a73c205def110ab56d615e716ecfece95 Mon Sep 17 00:00:00 2001 From: sandy Date: Thu, 27 Mar 2014 23:46:24 +0530 Subject: [PATCH 1/4] Changes made for new year --- __init__.pyc | Bin 166 -> 146 bytes apache/django.wsgi | 2 +- report/__init__.pyc | Bin 153 -> 153 bytes report/choices.pyc | Bin 670 -> 670 bytes report/forms.pyc | Bin 14147 -> 14147 bytes report/models.pyc | Bin 26594 -> 26594 bytes report/pdf.pyc | Bin 2711 -> 2711 bytes report/search.pyc | Bin 3014 -> 3014 bytes report/urls.pyc | Bin 4316 -> 4316 bytes report/views.pyc | Bin 52297 -> 52297 bytes settings.py | 21 +++--- tcc/models.py | 1 + tcc/views.py | 151 +++++++++++++++++++++++++------------------- 13 files changed, 98 insertions(+), 77 deletions(-) diff --git a/__init__.pyc b/__init__.pyc index fc5ca90978730a48a90ea4f881dd02f04c87b0cd..6dc5e9e5fa3cdd8577ad372cedd7d546f5d66caa 100644 GIT binary patch delta 28 kcmZ3+IEj&+`7}HJC6Yca^^3xJaC$=a70D991!vFvP delta 48 vcmbQlxQvmV`7^9~AI~N8i delta 16 XcmX?{cQ}uo`7>Jr{rvm^<#0LEU diff --git a/report/pdf.pyc b/report/pdf.pyc index e9dad8e50d1a3c5a48cefef4f99166fdc9b6074a..42f91fb3b6e45a1e69e4f8b0167d0e2415b75a0f 100644 GIT binary patch delta 16 XcmbO(I$e~V`7=U>EEUpDc delta 16 XcmbO(I$e~V`7meoUO5`7meoUO5`7{kT(gZbnPW_IS!yj<^7Og6GRodEzvfCnl7 delta 18 acmX>(gZbnPW_IS!yj=Ax>>Jsg&Hw;EPX;Xj diff --git a/settings.py b/settings.py index 0ce7632..dd94a00 100755 --- a/settings.py +++ b/settings.py @@ -1,4 +1,4 @@ -# Django settings for Automation project. +# Django settings for TCC11_12 project. DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -12,9 +12,9 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'db_name', # Or path to database file if using sqlite3. - 'USER': 'db_user', # Not used with sqlite3. - 'PASSWORD': 'db_password', + 'NAME': 'git_auto', # Or path to database file if using sqlite3. + 'USER': 'root', # Not used with sqlite3. + 'PASSWORD': 'a', 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } @@ -34,10 +34,10 @@ LANGUAGE_CODE = 'en-us' SITE_ID = 1 -DEFAULT_FROM_EMAIL = 'user@host.com' -EMAIL_HOST = 'smtp.host.com' -EMAIL_HOST_USER = 'user@host.com' -EMAIL_HOST_PASSWORD = 'user@host.com' +DEFAULT_FROM_EMAIL = 'email_add' +EMAIL_HOST = 'localhost' +EMAIL_HOST_USER = 'email_user' +EMAIL_HOST_PASSWORD = 'email_pass' EMAIL_USE_TLS = True EMAIL_PORT = "587" @@ -54,7 +54,6 @@ # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/' -STATIC_ROOT = 'mpath/ofau/static/' LOCAL_URL = 'http://localhost/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a @@ -62,7 +61,7 @@ # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = 'http://localhost/media/' #MEDIA_URL = 'http://localhost/media/' -STATIC_URL = '/static/' + # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". @@ -114,7 +113,7 @@ ROOT_URLCONF = 'ofau.urls' -TEMPLATE_DIRS = ("mpath/ofau/templates" +TEMPLATE_DIRS = ("/home/sandy/Documents/githubwork/great_dev/ofau/templates" # 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. diff --git a/tcc/models.py b/tcc/models.py index 8db4f34..caa3149 100644 --- a/tcc/models.py +++ b/tcc/models.py @@ -618,6 +618,7 @@ class Bill(models.Model): """ job_no = models.IntegerField(editable =False) + date = models.DateField(auto_now_add=True) education_tax = models.IntegerField(blank=True,null=True) higher_education_tax = models.IntegerField(blank=True,null=True) service_tax = models.IntegerField(blank=True,null=True) diff --git a/tcc/views.py b/tcc/views.py index 22777ff..92eee69 100644 --- a/tcc/views.py +++ b/tcc/views.py @@ -30,14 +30,14 @@ def home(request): active is the normal user. Depending upon there status different views are created in index1.html and index2.html respectively. ''' - + id = Job.objects.aggregate(Max('job_no')) maxid = id['job_no__max'] ''' id is assigned the max value of job_no which is an attribute of relation Job. id gets an array in result and max value is actually stored in id['job_no__max'] ''' - + if maxid == None : maxid = 1 else: @@ -145,7 +145,6 @@ def view_profile(request): @stop_caching @login_required -@login_required def profile(request): """ ** profile ** @@ -435,15 +434,17 @@ def selectfield(request): user = request.user jobno = request.GET.get('job','') if jobno =='': - id = Bill.objects.aggregate(Max('job_no')) - maxid =id['job_no__max'] - if maxid== None : - maxid = 1 + id = Bill.objects.aggregate(Max('id')) + maxid =id['id__max'] + get_last_jobno = Bill.objects.get(id = maxid) + last_jobno = get_last_jobno.job_no + if last_jobno== None : + last_jobno = 1 else: - maxid = maxid + 1 + last_jobno = last_jobno + 1 else: - maxid = jobno - m = Clientadd(client = client,user=user,job_no=maxid) + last_jobno = jobno + m = Clientadd(client = client,user=user,job_no=last_jobno) m.save() client = Clientadd.objects.aggregate(Max('id')) client =client['id__max'] @@ -936,19 +937,21 @@ def job_ok(request): tds amount etc. """ material =request.GET.get('id', '') - id = Job.objects.aggregate(Max('job_no')) - maxid =id['job_no__max'] - job_no = maxid + id = Job.objects.aggregate(Max('id')) + maxid =id['id__max'] + last_job_no = Job.objects.get(id=maxid) + get_job_no = last_job_no.job_no + date = last_job_no.date value =Job.objects.values_list('testtotal__unit_price',flat=True)\ - .filter(job_no=maxid) + .filter(job_no=get_job_no).filter(date=date) price = sum(value) from ofau.tcc.variable import * try: trans_value = Job.objects.values_list('suspence__rate',flat=\ - True).filter(job_no=maxid) + True).filter(job_no=get_job_no).filter(date=date) trans_total = sum(trans_value) discount_value = Job.objects.values_list('discount',flat=True)\ - .filter(job_no=maxid) + .filter(job_no=get_job_no).filter(date=date) discount_total = sum(discount_value) trans_net_total = price + trans_total - discount_total service_tax= round(servicetax * trans_net_total) @@ -958,17 +961,17 @@ def job_ok(request): net_total = trans_net_total + higher_education_tax +\ education_tax + service_tax bal = Job.objects.values_list('tds',flat=True).\ - filter(job_no=maxid) + filter(job_no=get_job_no).filter(date=date) tdstotal = sum(bal) balance = net_total - tdstotal - m = Bill(job_no = job_no, price = price, service_tax=service_tax, + m = Bill(job_no = get_job_no, price = price, service_tax=service_tax, higher_education_tax = higher_education_tax, education_tax = - education_tax, net_total = net_total, balance = + education_tax, net_total = net_total, date = date, balance = balance,trans_total=trans_total,trans_net_total=trans_net_total, discount_total=discount_total) except Exception: discount_value = Job.objects.values_list('discount',flat=True).\ - filter(job_no=maxid) + filter(job_no=get_job_no).filter(date=date) discount_total = sum(discount_value) trans_net_total = price - discount_total service_tax= round(servicetax * trans_net_total) @@ -978,16 +981,17 @@ def job_ok(request): net_total = trans_net_total + higher_education_tax +\ education_tax + service_tax bal = Job.objects.values_list('tds',flat=True).\ - filter(job_no=maxid) + filter(job_no=get_job_no).filter(date=date) tdstotal = sum(bal) balance = net_total - tdstotal - m = Bill(job_no = job_no, price = price, service_tax=service_tax, + m = Bill(job_no = get_job_no, price = price, service_tax=service_tax, higher_education_tax = higher_education_tax, education_tax = - education_tax, net_total = net_total, balance = balance, + education_tax, net_total = net_total, date = date,balance = balance, discount_total=discount_total,trans_net_total=trans_net_total,) m.save() - amt = Job.objects.filter(job_no=maxid).values('amount__report_type') - temp = {"maxid":maxid,'amt':amt} + amt = Job.objects.filter(job_no=get_job_no).values('amount__report_type').\ + filter(date=date) + temp = {"maxid":get_job_no,'amt':amt} if request.user.is_staff == 1 and request.user.is_active == 1 and \ request.user.is_superuser == 1 : return HttpResponseRedirect('job_ok_show') @@ -997,22 +1001,27 @@ def job_ok(request): @stop_caching def job_ok_show(request): material =request.GET.get('id', '') - id = Job.objects.aggregate(Max('job_no')) - maxid =id['job_no__max'] - job_no = maxid - amt = Job.objects.filter(job_no=maxid).values('amount__report_type') - temp = {"maxid":maxid,'amt':amt} + id = Job.objects.aggregate(Max('id')) + maxid =id['id__max'] + job = Job.objects.get(id=maxid) + last_job_no = job.job_no + date=job.date + amt = Job.objects.filter(job_no=last_job_no).filter(date=date).\ + values('amount__report_type') + temp = {"maxid":last_job_no,'amt':amt} return render_to_response('tcc/job_ok.html',dict(temp.items() + tmp.items()), context_instance=RequestContext(request)) @stop_caching def client_job_ok_show(request): - material =request.GET.get('id', '') - id = Job.objects.aggregate(Max('job_no')) - maxid =id['job_no__max'] - job_no = maxid - amt = Job.objects.filter(job_no=maxid).values('amount__report_type') - temp = {"maxid":maxid,'amt':amt} + id = Job.objects.aggregate(Max('id')) + maxid =id['id__max'] + job = Job.objects.get(id=maxid) + last_job_no = job.job_no + date=job.date + amt = Job.objects.filter(job_no=last_job_no).filter(date=date).\ + values('amount__report_type') + temp = {"maxid":last_job_no,'amt':amt} return render_to_response('tcc/client_job_ok.html', dict(temp.items() + tmp.items()), context_instance=RequestContext(request)) @@ -1058,17 +1067,17 @@ def bill(request): jobid = job.id job_no = job.job_no job_date =job.date - getjob = Job.objects.all().filter(job_no=job_no).values( - 'clientjob__material__name','date','testtotal__unit_price','site', + getjob = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\ + values( 'clientjob__material__name','date','testtotal__unit_price','site', 'suspencejob__field__name','report_type', 'clientjob__other_test', 'clientjob__material__matcomment_id','suspencejob__field__matcomment_id', 'sample','letter_no','letter_date', 'suspencejob__other', 'clientjob__material__id','suspencejob__field__id', 'suspencejob__other_test',).distinct() - testname = Job.objects.all().filter(job_no=job_no).values( + testname = Job.objects.all().filter(job_no=job_no).filter(date=job_date).values( 'clientjob__test__name','clientjob__test__material', 'suspencejob__test__material','suspencejob__test__name' ).distinct() - gettest = Job.objects.all().filter(job_no=job_no).values( + gettest = Job.objects.all().filter(job_no=job_no).filter(date=job_date).values( 'clientjob__material__test__name','clientjob__material__id', 'clientjob__material__test__name') getadd = Job.objects.all().filter(id = jobid).values( @@ -1077,7 +1086,9 @@ def bill(request): 'client__client__city', 'client__client__company', 'client__client__state','site',).distinct() from ofau.tcc.variable import * - bill = Bill.objects.get(job_no=job_no) + get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) matcomment= MatComment.objects.all() servicetaxprint = servicetaxprint educationtaxprint = educationtaxprint @@ -1113,17 +1124,17 @@ def suspence_bill(request): jobid = job.id job_no = job.job_no job_date =job.date - getjob = Job.objects.all().filter(job_no=job_no).values( - 'clientjob__material__name','date','testtotal__unit_price','site', - 'suspencejob__field__name','report_type', - 'clientjob__material__matcomment_id','suspencejob__field__matcomment_id', - 'sample','letter_no','letter_date', 'suspencejob__other', - 'clientjob__material__id','suspencejob__field__id').distinct() - testname = Job.objects.all().filter(job_no=job_no).values( - 'clientjob__test__name','clientjob__test__material', + getjob = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\ + values('clientjob__material__name','date','testtotal__unit_price','site', + 'suspencejob__field__name','report_type', 'clientjob__material__matcomment_id', + 'suspencejob__field__matcomment_id','sample','letter_no','letter_date', + 'suspencejob__other','clientjob__material__id', + 'suspencejob__field__id').distinct() + testname = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\ + values('clientjob__test__name','clientjob__test__material', 'suspencejob__test__material','suspencejob__test__name' ).distinct() - gettest = Job.objects.all().filter(job_no=job_no).values( - 'clientjob__material__test__name','clientjob__material__id', + gettest = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\ + values('clientjob__material__test__name','clientjob__material__id', 'clientjob__material__test__name') getadd = Job.objects.all().filter(id = jobid).values( 'client__client__first_name', 'client__client__middle_name', @@ -1131,7 +1142,9 @@ def suspence_bill(request): 'client__client__city', 'client__client__company', 'client__client__state','site',).distinct() from ofau.tcc.variable import * - bill = Bill.objects.get(job_no=job_no) + get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) matcomment= MatComment.objects.all() servicetaxprint = servicetaxprint educationtaxprint = educationtaxprint @@ -1176,11 +1189,13 @@ def receipt_report(request): 'client__client__first_name', 'client__client__middle_name', 'client__client__last_name','client__client__address', 'client__client__city','client__client__company') - mate = Job.objects.all().filter(job_no=job_no).values( - 'clientjob__material__name','suspencejob__field__name', + mate = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\ + values('clientjob__material__name','suspencejob__field__name', 'report_type','date','clientjob__material__matcomment_id', 'suspencejob__field__matcomment_id').distinct() - bill = Bill.objects.get(job_no=job_no) + get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) matcomment= MatComment.objects.all() balance = bill.balance net_total_eng = num2eng(balance) @@ -1207,7 +1222,10 @@ def additional(request): maxid =id['id__max'] job = Job.objects.get(id = maxid) job_no = job.job_no - bill = Bill.objects.get(job_no=job_no) + job_date = job.date + get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) template = {'job':job,'job_no': job_no ,'bill':bill,'servicetaxprint' : servicetaxprint, 'highereducationtaxprint' : highereducationtaxprint,'educationtaxprint' :educationtaxprint,} @@ -1232,8 +1250,8 @@ def s_report(request): jobid = job.id job_no = job.job_no job_date = job.date - getjob = Job.objects.all().filter(job_no=job_no).values( - 'clientjob__material__name','testtotal__unit_price','site', + getjob = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\ + values('clientjob__material__name','testtotal__unit_price','site', 'suspencejob__field__name','report_type','sample','pay', 'check_number','check_dd_date','clientjob__material__matcomment_id', 'suspencejob__field__matcomment_id').distinct() @@ -1243,8 +1261,11 @@ def s_report(request): 'client__client__city', 'client__client__state','site','letter_no', 'letter_date','client__client__company').distinct() from ofau.tcc.variable import * - bill = Bill.objects.get(job_no=job_no) - bal = Job.objects.values_list('tds',flat=True).filter(job_no=job_no) + get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) + bal = Job.objects.values_list('tds',flat=True).filter(job_no=job_no).\ + filter(date=job_date) tdstotal = sum(bal) net_total1 = bill.balance from ofau.tcc.convert_function import * @@ -1289,10 +1310,10 @@ def rep(request): amount = Amount.objects.all().get(job_id =query) user = Job.objects.all().get(id=query) job = user.job_no - id = Job.objects.aggregate(Max('id')) - maxid =id['id__max'] - jobid = Job.objects.get(id = maxid) - bill = Bill.objects.all().get(job_no=job) + job_date = user.date + get_bill_id = Bill.objects.filter(job_no=job).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) name = Job.objects.all().filter(id=query).values(\ 'client__client__first_name', 'client__client__middle_name', 'client__client__last_name','client__client__address', @@ -1321,7 +1342,7 @@ def rep(request): amount,'con_type':con_type, 'ratio1':ratio1, 'ratio2':ratio2, 'collegeincome':collegeincome, 'admincharge' : admincharge, 'user' :user, 'name':name, 'mate':mate, 'staff':staff,'bill':bill,'job':job, - 'jobid':jobid} + 'jobid':user} return render_to_response('tcc/report.html', dict(template.items() + tmp.items()), context_instance = RequestContext(request)) From 508d183c06b1a70219e6631e3e6f4b3e46faee9c Mon Sep 17 00:00:00 2001 From: Sandeep kaur Date: Thu, 27 Mar 2014 23:50:26 +0530 Subject: [PATCH 2/4] Update django.wsgi --- apache/django.wsgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apache/django.wsgi b/apache/django.wsgi index ddd5974..6185370 100755 --- a/apache/django.wsgi +++ b/apache/django.wsgi @@ -5,5 +5,4 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'ofau.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() -sys.path.append('/home/sandy/Documents/githubwork/great_dev/') - +sys.path.append('mpath') From 9ee388b93d2a3a7c77984e3701be8b74770df000 Mon Sep 17 00:00:00 2001 From: Sandeep kaur Date: Thu, 27 Mar 2014 23:52:21 +0530 Subject: [PATCH 3/4] Update settings.py --- settings.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/settings.py b/settings.py index dd94a00..0ce7632 100755 --- a/settings.py +++ b/settings.py @@ -1,4 +1,4 @@ -# Django settings for TCC11_12 project. +# Django settings for Automation project. DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -12,9 +12,9 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'git_auto', # Or path to database file if using sqlite3. - 'USER': 'root', # Not used with sqlite3. - 'PASSWORD': 'a', + 'NAME': 'db_name', # Or path to database file if using sqlite3. + 'USER': 'db_user', # Not used with sqlite3. + 'PASSWORD': 'db_password', 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } @@ -34,10 +34,10 @@ LANGUAGE_CODE = 'en-us' SITE_ID = 1 -DEFAULT_FROM_EMAIL = 'email_add' -EMAIL_HOST = 'localhost' -EMAIL_HOST_USER = 'email_user' -EMAIL_HOST_PASSWORD = 'email_pass' +DEFAULT_FROM_EMAIL = 'user@host.com' +EMAIL_HOST = 'smtp.host.com' +EMAIL_HOST_USER = 'user@host.com' +EMAIL_HOST_PASSWORD = 'user@host.com' EMAIL_USE_TLS = True EMAIL_PORT = "587" @@ -54,6 +54,7 @@ # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/' +STATIC_ROOT = 'mpath/ofau/static/' LOCAL_URL = 'http://localhost/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a @@ -61,7 +62,7 @@ # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = 'http://localhost/media/' #MEDIA_URL = 'http://localhost/media/' - +STATIC_URL = '/static/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". @@ -113,7 +114,7 @@ ROOT_URLCONF = 'ofau.urls' -TEMPLATE_DIRS = ("/home/sandy/Documents/githubwork/great_dev/ofau/templates" +TEMPLATE_DIRS = ("mpath/ofau/templates" # 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. From 00db486e44c3cfe4297f8f66b0f1bb583f36116a Mon Sep 17 00:00:00 2001 From: sandy Date: Wed, 2 Apr 2014 04:03:00 +0530 Subject: [PATCH 4/4] changes in non_payment_job --- apache/django.wsgi | 8 --- settings.py | 142 --------------------------------------------- tcc/views.py | 18 +++--- 3 files changed, 10 insertions(+), 158 deletions(-) delete mode 100755 apache/django.wsgi delete mode 100755 settings.py diff --git a/apache/django.wsgi b/apache/django.wsgi deleted file mode 100755 index 6185370..0000000 --- a/apache/django.wsgi +++ /dev/null @@ -1,8 +0,0 @@ -import os -import sys - -os.environ['DJANGO_SETTINGS_MODULE'] = 'ofau.settings' - -import django.core.handlers.wsgi -application = django.core.handlers.wsgi.WSGIHandler() -sys.path.append('mpath') diff --git a/settings.py b/settings.py deleted file mode 100755 index 0ce7632..0000000 --- a/settings.py +++ /dev/null @@ -1,142 +0,0 @@ -# Django settings for Automation project. - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - #('Your Name', 'your_email@domain.com'), -) - -MANAGERS = ADMINS - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'db_name', # Or path to database file if using sqlite3. - 'USER': 'db_user', # Not used with sqlite3. - 'PASSWORD': 'db_password', - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# On Unix systems, a value of None will cause Django to use the same -# timezone as the operating system. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'Asia/Kolkata' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' - -SITE_ID = 1 -DEFAULT_FROM_EMAIL = 'user@host.com' -EMAIL_HOST = 'smtp.host.com' -EMAIL_HOST_USER = 'user@host.com' -EMAIL_HOST_PASSWORD = 'user@host.com' -EMAIL_USE_TLS = True -EMAIL_PORT = "587" - -SESSION_KEY = '_auth_user_id' -BACKEND_SESSION_KEY = '_auth_user_backend' -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale -USE_L10N = True - -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/' -STATIC_ROOT = 'mpath/ofau/static/' - -LOCAL_URL = 'http://localhost/' -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = 'http://localhost/media/' -#MEDIA_URL = 'http://localhost/media/' -STATIC_URL = '/static/' -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/media/' - -AUTH_PROFILE_MODULE = 'tcc.UserProfile' - -# 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. -) - -# 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', -) - -# Make this unique, and don't share it with anybody. -SECRET_KEY = '@3t%hg=e4%fuwrxhq#qm4gp!%0albmve6natdxiqoxcx8#8$wd' - -EASY_MAPS_GOOGLE_KEY = "AIzaSyDRekokepCbXBsF7DC8uyR_95pikeWdPqc" -# 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', -) - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "ofau.tcc.context_processors.base_template", -) - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.cache.UpdateCacheMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.cache.FetchFromCacheMiddleware', -) - -ROOT_URLCONF = 'ofau.urls' - -TEMPLATE_DIRS = ("mpath/ofau/templates" - # 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. -) - - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - # Uncomment the next line to enable the admin: - 'django.contrib.admin', - 'django.contrib.humanize', - 'registration', - 'ofau.tcc', - 'tagging', -) - - -ACCOUNT_ACTIVATION_DAYS = 2 - - -LOGIN_REDIRECT_URL = '/automation/tcc/index' diff --git a/tcc/views.py b/tcc/views.py index 92eee69..78a2be9 100644 --- a/tcc/views.py +++ b/tcc/views.py @@ -302,12 +302,14 @@ def non_payment_job(request): means the job that describes the work to be done without making any payment. """ - id = NonPaymentJob.objects.aggregate(Max('job_no')) - maxid =id['job_no__max'] - if maxid== None : - maxid = 1 - else: - maxid = maxid + 1 + id = NonPaymentJob.objects.aggregate(Max('id')) + maxid =id['id__max'] + get_job_no=NonPaymentJob.objects.get(id = maxid) + job_no = get_job_no.job_no + if job_no == None : + job_no = 1 + else : + job_no = job_no+1 user = UserProfile.objects.get(id=request.GET['id']) id=request.GET['id'] if request.method == 'POST': @@ -315,7 +317,7 @@ def non_payment_job(request): if form.is_valid(): profile = form.save(commit=False) profile.client= user - profile.job_no = maxid + profile.job_no = job_no profile.save() form.save_m2m() x = {'form': form, 'user': id} @@ -324,7 +326,7 @@ def non_payment_job(request): RequestContext(request)) else: form = NonPaymentJobForm() - form = {'form':form, 'maxid':maxid} + form = {'form':form, 'maxid':job_no} return render_to_response('tcc/non_payment_job.html',dict(form.\ items() + tmp.items()),context_instance=RequestContext(request))