NameError name is not defined

0 votes
PS E:\CokeStudio\std> python manage.py makemigrations
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Lenovo\python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\Lenovo\python38\lib\site-packages\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "C:\Users\Lenovo\python38\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Lenovo\python38\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Users\Lenovo\python38\lib\site-packages\django\apps\config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\Lenovo\python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "E:\CokeStudio\std\Home\models.py", line 4, in <module>
    class services(models.Model):
  File "E:\CokeStudio\std\Home\models.py", line 7, in services
    phone =models.CharField(_(""), max_length=50)
NameError: name '_' is not defined
Jul 30, 2020 in Web Development by anonymous
• 120 points
860 views

1 answer to this question.

0 votes

Hello,

Just include this in you snippet:

from django.utils.translation import gettext as _

Hope this solve you error!! if not share your code

Thank You!

answered Aug 3, 2020 by Niroj
• 82,760 points

Related Questions In Web Development

0 votes
1 answer

Node js nodemiler Status 250 ok but mail is not received

Hi, @Sagar, I think you might simply be queuing the ...READ MORE

answered Dec 24, 2020 in Web Development by Gitika
• 65,910 points
373 views
0 votes
0 answers

TypeError: this.client.incrementMaxListeners is not a function

I'm making a command for my discord ...READ MORE

Dec 28, 2020 in Web Development by anonymous
• 120 points
160 views
0 votes
1 answer

What is the difference between span and div?

The div should be used to wrap sections of ...READ MORE

answered Jan 16, 2020 in Web Development by Niraj

edited Jan 21, 2020 by Niroj 1,695 views
+1 vote
9 answers

What is the difference between web design and web development?

A designer designs the web pages and ...READ MORE

answered Jan 22, 2020 in Web Development by Niroj
• 82,760 points
419 views
+1 vote
1 answer

What is SQL injection?

hey @Fighnithi, Yes,SQL injection is one of the ...READ MORE

answered Jan 22, 2020 in Web Development by Niroj
• 82,760 points
258 views
0 votes
1 answer

What is data binding in AngularJS?

Data binding is synchronization of data between the ...READ MORE

answered Jan 23, 2020 in Web Development by Niroj
• 82,760 points
134 views
0 votes
1 answer
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,760 points

edited Jan 21, 2020 by Niroj 244 views
+1 vote
1 answer

What is css box module?

Hey, All the element present in html follows ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,760 points

edited Jan 21, 2020 by Niroj 275 views