The question is simple. im building a recipe website with multiple users to submit their recipes. i want to build one page listing all the users and arrange the user hierarchy based on their latest post. what is the best way to query the users in the views.py and pass to the context?
the code snippet is something like this;
models.py
class UserRecipe(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=200)
created_date = models.DateTimeField(default=timezone.now)
as you can see the UserRecipe model linked to user using ForeignKey. So im building a view in views.py to list users and rank them based on the date of their last UserRecipe created_date.
so in order to query users and arrange them based on their UserRecipe created_date what is the best way to do it?