7
7
from roles .helpers import login_required_ajax
8
8
from buyandsell .models import Ban , Category , ImageURL , Limit , Product , Report
9
9
from buyandsell .serializers import ProductSerializer
10
- from helpers .misc import query_from_num , query_search
10
+ from helpers .misc import query_search
11
11
from users .models import UserProfile
12
12
from django .db .models import Q
13
13
import json
14
14
from django .utils import timezone
15
- import traceback
16
15
17
16
REPORTS_THRES = 3
18
17
@@ -24,7 +23,8 @@ class BuyAndSellViewSet(viewsets.ModelViewSet):
24
23
25
24
def mail_moderator (self , report : Report ):
26
25
msg = f"""
27
- { str (report .reporter )} lodged a report against the product { str (report .product )} posted by { str (report .product .user )} .
26
+ { str (report .reporter )} lodged a report against the product
27
+ { str (report .product )} posted by { str (report .product .user )} .
28
28
Alleged Reason: { report .reason } ."""
29
29
send_mail (
30
30
"New Report" , msg , settings .DEFAULT_FROM_EMAIL , [report .moderator_email ]
@@ -36,7 +36,7 @@ def update_limits(self):
36
36
limit .delete ()
37
37
38
38
def update_bans (self , product : Product = None ):
39
- if product != None :
39
+ if product is not None :
40
40
"""Get the existing reports on this product that have been accepted by the moderator
41
41
but have not been addressed (by initiating a ban)."""
42
42
reports = Report .objects .filter (
@@ -74,7 +74,7 @@ def seller_filter(self, request, queryset):
74
74
return queryset
75
75
76
76
def list (self , request ):
77
- ## introduce tags?
77
+ # introduce tags?
78
78
self .update_bans ()
79
79
queryset = self .queryset .filter (status = True )
80
80
"""remove products from banned users"""
@@ -157,7 +157,7 @@ def get_product(self, pk):
157
157
@login_required_ajax
158
158
def update (self , request , pk ):
159
159
product = self .get_product (pk )
160
- ## TO TEST:
160
+ # TO TEST:
161
161
# product.category.numproducts-=1
162
162
# product.category.numproducts-=1
163
163
if product .user == UserProfile .objects .get (user = request .user ):
0 commit comments