0

This is my code I'm trying to:

class PublisherDetail(SingleObjectMixin, ListView):
    paginate_by = 2
    template_name = "books/publisher_detail.html"

    def get(self, request, *args, **kwargs):
        self.object = self.get_object(queryset=Publisher.objects.all())
        return super().get(request, *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['publisher'] = self.object
        return context

    def get_queryset(self):
        return self.object.book_set.all()

in this line:

context = super().get_context_data(**kwargs)

Pycharm says: python version 2.7 does not support this syntax. P.S: 1) Setting > Editor > Inspection > Code compatibility is disabled 2) My interpreter is python 3.6.3

and the second error is about (in the same line):

Unresolved attribute reference 'get_context_data' for class 'super'

P.S: I have marked source root in Pycharm.

How can I get rid of these errors? (both are errors, not warnings)

Pycharm version: PyCharm 2018.2.3 (Professional Edition) Build #PY-182.4323.49, built on September 4, 2018 Windows 10 10.0

Amin.B
  • 117
  • 2
  • 9

1 Answers1

0

It's solved. Just close and open Pycharm (restart). That was so weird. You can also use: File > Invalidate Caches / Restart

Amin.B
  • 117
  • 2
  • 9