I am trying to create an object in my views.py that is an integer from models.py. Usually we have lists in the models.py objects, but in this case it is just a single number.
def answer(request, level_id):
o = Level.objects.get(id=level_id)
correct = o.answers.filter(value__iexact=guess).exists() <--- working boolean function
points = o.points.get('points')
values = { 'score':points }
return render_to_response('game.html', values)
This gives us an error:
Int has no attribute get.
We are trying to create the points variable to contain the number of points from our models.py:
class Level(models.Model):
points = models.IntegerField("Point Value",default=1)