I am having a problem when using a model to provide the total number of flown hours so the total flown hours can be added to the hours being submitted. Here is a snippet of the code I am using but so far for the past hour or so of working on it, nothing has worked.
Views.py
pirephours = int(user_profile.totalhours) + 1
user_profile.update(totalhours=pirephours)
Models.py
class UserProfile(models.Model):
user = models.OneToOneField(User)
country = models.CharField("Country", max_length=50)
totalflights = models.IntegerField("Total Flights", default=0)
totalhours = models.IntegerField("Total Hours",default=0)
hub = models.ForeignKey(Airports, default=0)
The + 1 in the view is just for now to add 1 hour to the total hours but I would also like to know if there is a way to use what was submitted in a form instead of a number. The form is just a modelform from the model it self.
Any input would be great.