Django Project

from django.db import models
from django.core.validators import MinValueValidator
import datetime
from datetime import datetime as dt
from datetime import timedelta
from django.db.models.signals import post_save,pre_save
from django.forms import ModelForm

class Customer(models.Model):
initial = models.CharField(max_length=1)
last_name = models.CharField(max_length=45)
email_id = models.EmailField()
drivers_lic_no = models.CharField(max_length=45,unique=True)
phone_no = models.CharField(max_length=20)
no_of_rentals = models.PositiveIntegerField(default=0)
cc_no = models.CharField(max_length=45)
expiry = models.CharField(max_length=8)
cvv = models.PositiveSmallIntegerField()
def __unicode__(self):
return str(self.id)

class Customerform(ModelForm):
class Meta:
model = Customer
fields = '__all__'
#fields = ['initial','last_name','email_id','drivers_lic_no','phone_no',
# 'no_of_rentals','cc_no','expiry','cvv']

class CarType(models.Model):
ctypes = (('COMPACT','COMPACT'),('LARGE','LARGE'),('MEDIUM','MEDIUM'),
 ('SUV','SUV'),('TRUCK','TRUCK'),('VAN','VAN'))
typename = models.CharField(max_length=10,choices=ctypes,default='COMPACT')
daily_rate = models.DecimalField(max_digits = 17,decimal_places=2,validators=[MinValueValidator(0.00)])
weekly_rate = models.DecimalField(max_digits = 17,decimal_places=2,validators=[MinValueValidator(0.00)])
def __unicode__(self):
return self.typename

class CarTypeform(ModelForm):
class Meta:
model = CarType
fields = '__all__'
class Car(models.Model):
cmodels = (('AUDI','AUDI'),('BMW','BMW'),('CHEVY','CHEVY'),('FORD','FORD'),
 ('GM','GeneralMotors'),('HONDA','HONDA'),('LINCOLN','LINCOLN'),
 ('MUSTANG','MUSTANG'),('SUBARU','SUBARU'),('TOYOTA','TOYOTA'))
cyears = tuple((str(n), str(n)) for n in range(2002, dt.now().year + 1))
carmodel = models.CharField(max_length=15,choices=cmodels)
car_year = models.CharField(max_length=4,choices=cyears)
typeid = models.ForeignKey(CarType,null=True)
def __unicode__(self):
return str(self.id)

class Carform(ModelForm):
class Meta:
model = Car
fields = '__all__'

class Rental(models.Model):
tday = datetime.date.today()
start_date = models.DateField(default=tday)
tomorrow = datetime.date.today() + timedelta(days=1)
end_date = models.DateField(default=tomorrow)
rental_status = models.CharField(max_length=10,choices=(('Available','Available'),('Rented','Rented'),('Booked','Booked')),default='Rented')
rental_type = models.CharField(max_length=7,choices=(('Daily','Daily'),('Weekly','Weekly')),default='Daily')
customer_ID = models.ForeignKey(Customer)
car_Id = models.ForeignKey(Car)
def __unicode__(self):
return str(self.id)

#def save(self, *args, **kwargs):
# if self.end_date < datetime.datetime.now().date():
# self.rental_status = 'Available'
# if self.start_date > datetime.datetime.now().date():
# self.rental_status = 'Available'

class Rentalform(ModelForm):
class Meta:
model = Rental
fields = ['start_date','end_date','rental_type','customer_ID','car_Id']

class Transaction(models.Model):
total_amount = models.DecimalField(max_digits = 17,decimal_places=2)
no_of_days = models.PositiveIntegerField()
no_of_weeks = models.DecimalField(max_digits = 10,decimal_places=1)
amount_paid = models.DecimalField(max_digits = 17,decimal_places=2)
amount_due = models.DecimalField(max_digits = 17,decimal_places=2)
rental_Id = models.ForeignKey(Rental,null=True)
def __unicode__(self):
return str(self.id)

class Transactionform(ModelForm):
class Meta:
model = Transaction
fields = ['rental_Id','amount_paid']

from django.shortcuts import render
from myapp.models import Customer,CarType,Car,Rental,Transaction
from myapp.models import Customerform,CarTypeform,Carform,Rentalform,Transactionform
import csv
from django.http import HttpResponse
from datetime import datetime
from django.db.models import Q

response = HttpResponse()
def Homepage(request):
    return render(request,'index.html')

def Upload(request):
if request.method =='POST':
for file in request.FILES:
if file == 'custfile':
for line in request.FILES[file]:
row = line.split(',')
try:
cust = Customer(initial=row[0],last_name=row[1],
email_id=row[2],drivers_lic_no=row[3],
phone_no=row[4],no_of_rentals=row[5],
cc_no = row[6],expiry=row[7],cvv=row[8])
#cust.save()
except:
continue
elif file == 'carfile':
for line in request.FILES[file]:
row = line.split(',')
try:
car = Car(carmodel=row[0],car_year=int(row[1]))#,typeid=)
car.save()
except Exception as e:
response.write(str(e.message))
return response
continue
elif file == 'cartypefile':
for line in request.FILES[file]:
row = line.split(',')
try:
cartype = CarType(typename=row[0],weekly_rate=float(row[1]),daily_rate=float(row[2].strip('\r\n')))
#cartype.save()
except:
response.write('exception'+str(row))
return response
continue
elif file == 'rentalfile':
for line in request.FILES[file]:
row = line.split(',')
try:
rentals = Rental(start_date=row[0],end_date=row[1],
rental_status=row[2],rental_type=row[3],
customer_ID=row[4],car_Id=row[5])
rentals.save()
except:
continue
elif file == 'transfile':
for line in request.FILES[file]:
row = line.split(',')
try:
transac = Transaction(rental_Id=row[0],no_of_days=row[1],
no_of_weeks=row[2],amount_paid=row[3],
total_amount=row[4],amount_due=row[5])
transac.save()
except:
continue
return render(request,'results.html',{'custlist':Customer.objects.all(),
     'cartypelist':CarType.objects.all(),
     'carlist':Car.objects.all(),
     'rlist':Rental.objects.all(),
     'tlist':Transaction.objects.all()})

else:
    return render(request, 'name.html')

def insertCust(request):
if request.method == 'POST':
form = Customerform(request.POST)
if form.is_valid():
fd = form.cleaned_data
cust = Customer(initial=fd['initial'],last_name=fd['last_name'],
email_id=fd['email_id'],drivers_lic_no=fd['drivers_lic_no'],
phone_no=fd['phone_no'],no_of_rentals=fd['no_of_rentals'],
cc_no = fd['cc_no'],expiry=fd['expiry'],cvv=fd['cvv'])
cust.save()
else:
return render(request,'insert.html',{'form':form})
return render(request,'tablesresult.html',{'custlist':Customer.objects.all(),'opt':1})

else:
form = Customerform()
return render(request,'insert.html',{'form':form})

def insertCtype(request):
if request.method == 'POST':
form = CarTypeform(request.POST)
if form.is_valid():
fd = form.cleaned_data
cartype = CarType(typename=fd['typename'],weekly_rate=fd['weekly_rate'],daily_rate=fd['daily_rate'])
cartype.save()
else:
return render(request,'insert.html',{'form':form})
return render(request,'tablesresult.html',{'cartypelist':CarType.objects.all(),'opt':2})
else:
form = CarTypeform()
return render(request,'insert.html',{'form':form})

def insertCar(request):
if request.method == 'POST':
form = Carform(request.POST)
if form.is_valid():
fd = form.cleaned_data
car = Car(carmodel=fd['carmodel'],car_year=fd['car_year'])#,typeid=)
car.save()
else:
return render(request,'insert.html',{'form':form})
return render(request,'tablesresult.html',{'carlist':Car.objects.all(),'opt':3})
else:
form = Carform()
return render(request,'insert.html',{'form':form})

def insertTrans(request):
if request.method == 'POST':
form = Transactionform(request.POST)
if form.is_valid():
row = form.cleaned_data
rid = row['rental_Id']
amtpaid = row['amount_paid']
rentlist = Rental.objects.get(id=rid.id)
stdate = rentlist.start_date
edate = rentlist.end_date
rentype = rentlist.rental_type
carid = rentlist.car_Id
carlist = Car.objects.get(id=carid.id)
cartype = carlist.typeid
ctypes = CarType.objects.get(id=cartype.id)
dailyrate = ctypes.daily_rate
weeklyrate = ctypes.weekly_rate

noofdays = 0
noofweeks = 0
diff = edate - stdate
if rentype in ['Daily','D']:
noofdays = diff.days
totalamt = dailyrate * noofdays
amtdue = totalamt - amtpaid
elif rentype in ['Weekly','W']:
noofweeks = round(diff.days/7.0,1)
totalamt = weeklyrate * noofweeks
amtdue = totalamt - amtpaid
transac = Transaction(rental_Id=row['rental_Id'],no_of_days=noofdays,
no_of_weeks=noofweeks,amount_paid=row['amount_paid'],
total_amount=totalamt,amount_due=amtdue)
transac.save()
else:
return render(request,'insert.html',{'form':form})
return render(request,'tablesresult.html',{'tlist':Transaction.objects.all(),'opt':5})
else:
form = Transactionform()
return render(request,'insert.html',{'form':form})

def insertRental(request):
if request.method == 'POST':
form = Rentalform(request.POST)
if form.is_valid():
row = form.cleaned_data

rentals = Rental(start_date=row['start_date'],end_date=row['end_date'],
rental_type=row['rental_type'],
customer_ID=row['customer_ID'],car_Id=row['car_Id'])
rentals.save()
else:
ids = Rental.objects.values_list('car_Id',flat=True).filter(Q(rental_status ='Rented') | Q(rental_status='R')
    | Q(rental_status ='Booked') | Q(rental_status='B'))
clist = Car.objects.exclude(id__in=set(ids))
return render(request,'insert.html',{'form':form,'check':1,'clist':clist})
return render(request,'tablesresult.html',{'rlist':Rental.objects.all(),'opt':4})
else:
form = Rentalform()
ids = Rental.objects.values_list('car_Id',flat=True).filter(Q(rental_status ='Rented') | Q(rental_status='R')
    | Q(rental_status ='Booked') | Q(rental_status='B'))
clist = Car.objects.exclude(id__in=set(ids))
return render(request,'insert.html',{'form':form,'check':1,'clist':clist})

from django.contrib import admin

from myapp.models import Customer,CarType,Car,Rental,Transaction
# Register your models here.
admin.site.register(Customer)
admin.site.register(CarType)
admin.site.register(Car)
admin.site.register(Rental)
admin.site.register(Transaction)


Andy Installation problems - untracked pid

So i found out the bug which would result in a black screen when starting the Andy OS from your desktop or Virtual Box or results in a infinite untracked pid issue.

Try the below steps to resolve the issue.

1) Run Andy and from taskbar right click the "Andy- android for your pc" and  select the Andy Launcher as shown in the below pic.


2) Click on New Andy and give some name, i gave here as "n1". And then press the launch button.



3) Now goto network settings from control panel and there you can find "VirtualBox Host-Only Network" which is a network where VirtualBox connects. Click on that.


4) Click on Diagnose and here u can find an issue like "DHCP is not enabled for the network"
Repair and fix this issue with Diagnose tool.


Now after fixing that issue you should be able to see the android setup page. 



Let me know for any other issues.

How to remove / bypass Bios password

How to Bypass or Remove a BIOS Password by Removing the CMOS Battery:
The simplest way to remove a BIOS password is to simply remove the CMOS battery. A computer will remember its settings and keep the time even when it is turned off and unplugged because these parts are powered by small battery inside the computer called a CMOS battery. If we pull out this battery, the computer will forget alot of its hardware settings, including its BIOS password. This should not be performed on Laptops if you are not experienced working with laptop hardware.
Finding the CMOS BatteryAnyway, open up the computer case using a screw driver and locate the flat, circular and metallic CMOS battery. It should look something like the picture to the right. Some computers have this part standing upright.
Once you have located it, observe how the latches are holding it. There are many different ways to remove a CMOS battery but the most common way on newer computers can be seen in the picture below.
Removing the CMOS Battery
Make sure to power down the computer, unplug the power cables and unplug any USB devices if they are powered. The computer must not be able to get power from anywhere for this to work. Take out the CMOS battery and wait 10 – 25 minutes before putting it back in. The reason for this wait is because the computer can still store power in its capacitors even though everything is unplugged. The waiting period allows enough time for them to discharge.
Plug everything back in, power up the computer and enter the BIOS again. If everything went well there should be no more password. In some cases, if you get weird error messages during bootup now, you will need to goto “Load BIOS Defaults” in BIOS and save the changes to fix them.
If this method didn’t work, try one of the methods below.
How to Bypass or Remove a BIOS Password using Software:
!BIOS is a freeware utility which is designed to be a whole BIOS and security suite. It has the ability to decrypt the passwords used in some of the most common BIOS makes such as Award, Phoenix, American Megatrends, IMB etc..
It also has the ability to brute force the password (known as “blasters”). However, this method is dangerous and can result in some unexpected and unwanted results.
Note: Because of this applications password cracking abilities, some antivirus software may report it as a virus/trojan. This is a false positive.
To start using !BIOS, reboot your computer and take note of the BIOS type and version you are running. For example, If your motherboard uses Award BIOS you should look for the text “Award Medallion BIOS 6.0″ or something similar.
Download !BIOS from here and save it to your desktop. Then, open a DOS command windows by going toStart > Run and type: cmd
Once you see a black screen in front of you, type: cd desktop
You should now see something like: C:\Documents and Settings\YourUserName\Desktop>
Now type the name of the file you just downloaded, if you haven’t changed the name just type in: bios320.exe
!BIOS - Decrypting a BIOS Password
Use the down arrow and choose “Crackers” and then press the right arrow. Using the up and down arrows, select the BIOS that the motherboard is using and press Enter.
You should now see a menu asking what you want to crack, in most cases its the Supervisor or System Passwords you want to crack, so press the 1 key on your keyboard. It will then show you another menu asking how you want it to be cracked. Option 1 is pretty good so try that first by pressing the 1 key on your keyboard. You should now have your BIOS password.
Reboot the computer, enter the BIOS and try it out.
How to Bypass or Remove a BIOS Password using the manufacturer backdoor password:
On many computers (especially old ones), computer manufacturers build in backdoor passwords for their own technicians to use so they can access the BIOS when the hardware is being serviced. Here are some of the ones that have been reported. You may need to try quite a few passwords before you find one that works
These passwords are CaSe SeNsItIve.
AMI BIOS Backdoor Passwords:
  • A.M.I.
  • AAAMMMII
  • AMI
  • AMI?SW
  • AMI_SW
  • BIOS
  • CONDO
  • HEWITT RAND
  • LKWPETER
  • MI
  • Oder
  • PASSWORD
Award BIOS Backdoor Passwords:
    • (eight spaces)
    • 01322222
    • 589589
    • 589721
    • 595595
    • 598598
    • ALFAROME
    • ALLY
    • ALLy
    • aLLY
    • aLLy
    • aPAf
    • award
    • AWARD PW
    • AWARD SW
    • AWARD?SW
    • AWARD_PW
    • AWARD_SW
    • AWKWARD
    • awkward
    • IOSTAR
    • CONCAT
    • CONDO
    • Condo
    • condo
    • d8on
    • djonet
    • HLT
    • J256
    • J262
    • j262
    • j322
    • j332
    • J64
    • KDD
    • LKWPETER
    • Lkwpeter
    • PINT
    • pint
    • SER
    • SKY_FOXSYXZ
    • SKY_FOX
    • syxz
    • SYXZ
    • TTPTHA
    • ZAAAADA
    • ZAAADA
    • ZBAAACA
    • ZJAAADC
Russian Award BIOS Passwords:
  • %øåñòü ïpîáåëîâ%
  • %äåâÿòü ïpîáåëîâ%
Phoenix Backdoor BIOS Passwords:
  • BIOS
  • CMOS
  • phoenix
  • PHOENIX
Other Manufcaturers Backdoor Passwords: (manufacturer name – password)
  • VOBIS and IBM – merlin
  • Dell – Dell
  • Biostar – Biostar
  • Compaq – Compaq
  • Enox – xo11nE
  • Epox – central
  • Freetech – Posterie
  • IWill – iwill
  • Jetway – spooml
  • Packard Bell – bell9
  • QDI – QDI
  • Siemens – SKY_FOX
  • SOYO – SY_MB
  • TMC – BIGO
  • Toshiba – Toshiba