@staticmethod
PYL-R0201 23 template_name = "portfolio/project_list.html"
24 context_object_name = "projects"
25
26 def get_queryset(self): 27 """Get queryset"""
28 return Project.objects.filter(deleted_at=None)
29
40 template_name = "polls/detail.html"
41 permission_required = "polls.view_question"
42
43 def get_queryset(self):44 """Excludes any questions that aren't published yet."""
45 return Question.objects.filter(pub_date__lte=timezone.now())
46
18 context_object_name = "latest_question_list"
19 permission_required = "polls.view_question"
20
21 def get_queryset(self):22 """
23 Return the last five published questions (not including those set to be
24 published in the future).
14 """Items"""
15 return self.model.objects.filter(withdrawn=False, deleted_at=None)
16
17 def lastmod(self, obj):18 """Lastmod"""
19 return obj.mod_date
84 template_name = "lyrics/song_list.html"
85 context_object_name = "songs"
86
87 def get_queryset(self): 88 """Get queryset"""
89 return Artist.objects.filter(deleted_at=None)
90
The method doesn't use its bound instance. Decorate this method with @staticmethod
decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.