Commit 72250295c643eca65164df6a55c632dedc04f078
Exists in
master
Merge branch 'master' of https://git.ucsd.edu/110swag/flashy-backend
Showing 3 changed files Side-by-side Diff
README.md
View file @
7225029
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 | |
3 | 3 | All of these commands should be run from this directory (the one containing README.md) |
4 | 4 | |
5 | +Virtualenv for Windows creates a dir inexplicably named scripts rather than bin. So substitute venv/bin for venv/scripts if you are on Windows. | |
6 | + | |
5 | 7 | Install virtualenv before continuing. This is most easily accomplished with: |
6 | 8 | |
7 | 9 | pip install virtualenv |
flashcards/models.py
View file @
7225029
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | :param user: |
159 | 159 | :return: A queryset with all cards that should be visible to a user. |
160 | 160 | """ |
161 | - return cls.objects.filter(is_hidden=False).exclude(userflashcard__user=user, userflashcard__pulled=None) | |
161 | + return cls.objects.filter(is_hidden=False).exclude(flashcardhide__user=user) | |
162 | 162 | |
163 | 163 | |
164 | 164 | class UserFlashcardQuiz(Model): |
flashcards/views.py
View file @
7225029
... | ... | @@ -16,7 +16,6 @@ |
16 | 16 | from rest_framework.response import Response |
17 | 17 | from rest_framework.exceptions import AuthenticationFailed, NotAuthenticated, ValidationError, PermissionDenied |
18 | 18 | from simple_email_confirmation import EmailAddress |
19 | -from datetime import datetime | |
20 | 19 | |
21 | 20 | |
22 | 21 | class SectionViewSet(ReadOnlyModelViewSet): |
... | ... | @@ -31,9 +30,7 @@ |
31 | 30 | Gets flashcards for a section, excluding hidden cards. |
32 | 31 | Returned in strictly chronological order (material date). |
33 | 32 | """ |
34 | - flashcards = Flashcard.cards_visible_to(request.user).filter( \ | |
35 | - section=self.get_object(), is_hidden=False).all() | |
36 | - | |
33 | + flashcards = Flashcard.cards_visible_to(request.user).filter(section=self.get_object()) | |
37 | 34 | return Response(FlashcardSerializer(flashcards, many=True).data) |
38 | 35 | |
39 | 36 | @detail_route(methods=['post'], permission_classes=[IsAuthenticated]) |
... | ... | @@ -89,7 +86,7 @@ |
89 | 86 | """ |
90 | 87 | qs = Flashcard.objects.all() |
91 | 88 | qs = qs.filter(userflashcard__user=request.user) |
92 | - qs = qs.filter(section = self.get_object()) | |
89 | + qs = qs.filter(section=self.get_object()) | |
93 | 90 | serializer = FlashcardSerializer(qs, many=True) |
94 | 91 | return Response(serializer.data) |
95 | 92 |