コード例 #1
0
ファイル: tests.py プロジェクト: jorgii/fuck-book
    def test_get_diaries_for_people(self):
        expected_diary_list = [self.diary1, self.diary2, self.empty_diary]
        received_diary_list = Diary.get_diaries_for_people(self.person1)
        self.assertItemsEqual(expected_diary_list, received_diary_list)

        expected_diary_list = [self.diary1, self.diary2]
        received_diary_list = Diary.get_diaries_for_people(self.person1, self.person2)
        self.assertItemsEqual(expected_diary_list, received_diary_list)
コード例 #2
0
    def test_get_diaries_for_people(self):
        expected_diary_list = [self.diary1, self.diary2, self.empty_diary]
        received_diary_list = Diary.get_diaries_for_people(self.person1)
        self.assertItemsEqual(expected_diary_list, received_diary_list)

        expected_diary_list = [self.diary1, self.diary2]
        received_diary_list = Diary.get_diaries_for_people(
            self.person1, self.person2)
        self.assertItemsEqual(expected_diary_list, received_diary_list)
コード例 #3
0
ファイル: views.py プロジェクト: jorgii/fuck-book
def diary(request):
    checkins_by_diary = OrderedDict()
    diary_list = sorted(
        list(Diary.get_diaries_for_people(request.user.person).all()), key=lambda x: x.datetime_created, reverse=True
    )
    for diary in diary_list:
        checkins_by_diary[diary] = sorted(list(diary.checkins.all()), key=lambda x: x.datetime_created, reverse=True)
    return render(request, "diary.html", locals())
コード例 #4
0
ファイル: views.py プロジェクト: jorgii/fuck-book
def diary(request):
    checkins_by_diary = OrderedDict()
    diary_list = sorted(list(Diary.get_diaries_for_people(request.user.person).all()), key=lambda x: x.datetime_created, reverse=True)
    for diary in diary_list:
        checkins_by_diary[diary] = sorted(list(diary.checkins.all()), key=lambda x: x.datetime_created, reverse=True)
    return render(request, "diary.html", locals())