move comments filtration from model to view
This commit is contained in:
parent
2dc1674f81
commit
8d8a5f50fb
|
|
@ -17,7 +17,7 @@ class CommentLstView(generics.ListCreateAPIView):
|
|||
"establishment": Establishment.__name__.lower()
|
||||
}
|
||||
|
||||
qs = models.Comment.objects.with_base_related()
|
||||
qs = models.Comment.objects.with_base_related().filter(status=models.Comment.WAITING)
|
||||
|
||||
if "object" in self.kwargs:
|
||||
qs = qs.by_object_id(self.kwargs["object"])
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ def parse_cookies(get_response):
|
|||
|
||||
# processing country country cookie
|
||||
country_code = get_country_code(cookie_dict)
|
||||
request.country_code = country_code
|
||||
if country_code and country_code != 'None':
|
||||
request.country_code = country_code
|
||||
else:
|
||||
request.country_code = None
|
||||
|
||||
response = get_response(request)
|
||||
return response
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user