A
A
artchis2020-12-25 18:17:08
Django
artchis, 2020-12-25 18:17:08

Where is the Python Django error?

Good afternoon, I don’t understand where the error is, help me figure out what value in the table can be set for the
models numbers:

from django.db import models

class user(models.Model):
    name = models.CharField('Ник-найм', max_length = 50)
    stat = models.CharField('Статус' max_length = 160)
    balance = models.CharField('Баланс' max_length = 50)

    def __str__(self):
        return self.name


Error:
Traceback (most recent call last):
File "manage.py", line 22, in
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Admin" \anaconda3\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Admin\anaconda3\lib\site-packages\django\core \management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\Admin\anaconda3\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate (settings.INSTALLED_APPS)
File "C:\Users\Admin\anaconda3\lib\site-packages\django\apps\registry.py",line 114, in populate
app_config.import_models()
File "C:\Users\Admin\anaconda3\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users \Admin\anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 779, in exec_module
File "", line 916, in get_code
File "", line 846,in source_to_code
File "", line 219, in _call_with_frames_removed
File "C:\Users\Admin\Desktop\PlayTi\playti\main\models.py", line 5
stat = models.CharField('Status' max_length = 160)
^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
samperirrrrr, 2020-12-25
@artchis

Commas - balance = models.CharField('Balance', max_length = 50)
stat = models.CharField('Status', max_length = 160)

D
Dr. Bacon, 2020-12-25
@bacon

Line number 5.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question