Hi all,
I have having problems with syntax error in a form class. Code looked good on the editor, so I tested it and server did rise the exception. Problem seemed related with indentation. Notification of the editor appeared after a copy & paste. Not from an external source, but between files opened on pythonanywhere editor.
Rewriting the whole code solves the problem. However, I like copy paste so I finally found some workaround to use it and fix this syntax error:
I will use a form class as an example. Given:
class ExampleForm(forms.ModelForm):
class Meta:
model = Example
name = forms.CharField(
label='Name',
...
)
other = forms.CharField(
label='Other',
...
)
And you have a Syntax Error on 'other' line. Then, do:
- From the previous variable end character ')', push enter.
- Cursor will be put automatically indented. Return to the beginning of the line with backspace.
- Now, use Tab to put the cursor indented again.
- Write the first character of the next line ('o' in this example).5. Use Delete until next line go up and you replace the first character of it.
It worked for me, I hope it does it for other people too.
Kind regards
IƱaki