o[
class Category(models.Model):
name = models.CharField(max_length=20, name='Имя')
def str(self):
return str(self.name)
class Meta:
verbose_name = 'Категории'
verbose_name_plural = 'Категории'
и такая ошибка:
AttributeError at /admin/main/category/
'Category' object has no attribute 'name'
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/main/category/
Django Version: 2.2.3
Exception Type: AttributeError
Exception Value:
'Category' object has no attribute 'name'
Exception Location: /home/one-plance/django/shop/main/models.py in str, line 7
Python Executable: /usr/bin/python3
Python Version: 3.6.8
Python Path:
['/home/one-plance/django/shop',
'/usr/lib/python36.zip',
'/usr/lib/python3.6',
'/usr/lib/python3.6/lib-dynload',
'/home/one-plance/.local/lib/python3.6/site-packages',
'/usr/local/lib/python3.6/dist-packages',
'/usr/lib/python3/dist-packages']
Server time: Пн, 29 Июл 2019 10:26:38 +0000
В чём я ошибся?