"Cannot find declaration to go" with Django template_name in class based views after upgrade

Hello.
I upgraded my Pycharm Professional to the latest version today, after upgrade the editor could not find my html files no more if they are placed into a class based view, as "template_name" variable.

def index(request):
return render(request, 'index.html'

Is displaying the link on the side correctly, and brings me to the file with ctrl+click.

class CreateItem(MyCreateView):
model = models.Item
template_name = 'warehouse_form.html'
form_class = forms.ItemForm

Is not finding the warehouse_form.html file it was before the upgrade.

Django support is enabled. Template folder is correctly marked and correctly shows up pink in the editor.

I tried to "invalidate caches and restart", reload all project files from disk and to delete the whole .idea folder and reset the editor (this last try led to all projet files being shown as yellow and all the Django configuration go nuts).

Template folder is also mapped on Project: MyProject > Project Structure.

2 comments
Comment actions Permalink

What version did you use before?
I see the same result in 2020.3.3 and 2020.2.5

0
Comment actions Permalink

Turns out it was the view name. As you can see from the snippet above I was using a custom Create View I made, inheriting from the base class, and not the django base class from django.views.generic, that suggestion is working only on the base classes for me.

Also adding to the base class LoginRequiredMixin breaks the link.

0

Please sign in to leave a comment.