Mariusz Kryński avatar Mariusz Kryński committed 65c589b

api 1.0 merge with reloaded, disable fuzzy (w/o directors) matching

Comments (0)

Files changed (2)

film20/api/api_1_0/handlers.py

     def short_reviews(cls, film):
         return film.pk and ShortReview.objects.filter(object__type=Object.TYPE_FILM,
                                              object__permalink=film.permalink,
+                                             kind=ShortReview.REVIEW,
                                             ).order_by('-created_at').select_related('user', 'object') or QuerySet().none()
 
     @classmethod
             rating = rating_helper.guess_score(user, film.pk)
             has_short_review = bool(ShortReview.objects.filter(object__type=Object.TYPE_FILM,
                                                    object__permalink=film.permalink,
+                                                   kind=ShortReview.REVIEW,
                                                    user=user).count())
             has_posts = bool(film.related_film.all()[0:1])
             checkins = ScreeningCheckIn.objects.filter(film=film, user=user)
     def read(self, request, permalink):
         reviews = ShortReview.objects.filter(object__type=Object.TYPE_FILM,
                                              object__permalink=permalink,
+                                             kind=ShortReview.REVIEW,
                                             ).order_by('-created_at')
         reviews = reviews.select_related('user', 'object')
         return paginated_collection(request, reviews)
     def read(self, request, username):
         reviews = ShortReview.objects.filter(user__username=username,
                                              object__type=Object.TYPE_FILM,
+                                             kind=ShortReview.REVIEW,
                                             ).order_by('-created_at')
         reviews = reviews.select_related('user', 'object', 'film')
         return paginated_collection(request, reviews)
 
 class UserShortReviewCommentsHandler(AnonBaseCommentsViewHandler):
     def get_object(self, username, permalink):
-        return get_object_or_404(ShortReview, user__username=username, object__permalink=permalink)
+        return get_object_or_404(ShortReview, kind=ShortReview.REVIEW, user__username=username, object__permalink=permalink)
 
 class AnonUserFilmShortReviewHandler(AnonymousBaseHandler):
     model = ShortReview
         objects = ShortReview.objects.filter(
             user__username=username,
             object__permalink=permalink,
-            object__type=Object.TYPE_FILM
+            object__type=Object.TYPE_FILM,
+            kind=ShortReview.REVIEW,
         ).order_by('-created_at')[0:1]
         if not objects:
             raise Http404

film20/showtimes/models.py

                 candidates = len(films) > 1 and films or []
                 match = film and MATCHED or candidates and HAS_CANDIDATES or UNMATCHED
             else:
-                film = len(films)==1 and films[0] or None
-                candidates = len(films) > 1 and films or []
+#                film = len(films)==1 and films[0] or None
+                film = None
+                candidates = films or []
                 match = film and FUZZY_MATCHED or candidates and HAS_CANDIDATES or UNMATCHED
 
         
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.