Hello friends, I'm new to django. I would like to make a query to update the number field.
What I want to do is filter by the user and filter by the last entry of that user, and then update the number field.
The querysets I know are the following, but I do not know how I could implement them to make the query:
My model is as follows:
class Model(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) id = models.AutoField(primary_key=True) number = models.FloatField(default=0) created = models.DateTimeField(auto_now_add=True, null=True) class Meta: ordering = ['-created']
With the class Meta I ordered the records for the most recent, but now how I could access the last record to update it.
Thank you very much friends!