I'm fairly new to Django, but is this possible and if so what exactly is required? I checked the docs and couldn't find what I was looking for.
#models.py
class Car (models.Model):
make = models.CharField(max_length=100)
year = models.IntegerField(max_length=4)
car = Car(make = "Toyota", year = 2011)
*Code in question, will this result in true?*
if (car):
//do stuff
Thanks for any help.
you can do some thing like this:
car = Car.objects.create(make = "Toyota", year = 2011)
if car:
# do some thing
# here you have access to car object like this car.make , car.year