Thursday, June 23, 2016

Re: Inconsistent dedent error

On 06/23/2016 02:41 PM, Erik Cederstrand wrote:
>> Den 23. jun. 2016 kl. 21.21 skrev Gary Roach <gary719_list1@verizon.net>:
>>
>> class Choice(models.Model):
>> question = models.ForeignKey(Question, on_delete=models.CASCADE)
>> choice_text = models.CharField(max_length=200)
>> votes = models.IntegerField(default=0)
>>
>> def _str__(self):
>> return self.choice_text
>>
>> The last entry (def __str__(self): throws an error "inconsistent dedent at line .... I can find nothing wrong.
> The error is actually in the line above. Your field definitions are 7-space indented when they should only be 3- or 4-space indented.
>
> Python requires you to have consistent indenting, preferably 4 spaces per every indentation level. Your editor should help you with that. See https://www.python.org/dev/peps/pep-0008/#indentation
>
> Erik
>
Thanks,

Another pair of eyes never hurts.

Gary R.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/00e864c5-6f91-3c05-0635-861e80096768%40verizon.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment