I need to get only the objects of the last month present in the DB. I don't mean the last 30 days or the last calendar month, but the most recent month recorded in the database... I have seen that django has the latest() function that returns the most recent object in the table based on in the given field(s), however I want it to return multiple objects based on the given month.
revisoes = Revisao.objects.filter(apicultor__in=apicultores).order_by('-data_registro')
This is the queryset I am using, only it returns all revisions for a given beekeeper. I need it to return only revisions based on the last month of the data_registro field.