Automatic problem completion and _ ("") function in Django database model models.py

recently I have been using vs code to learn django . In models.py , when I type name = CharF, the following prompt will appear.

what I want to ask is

  • Why does it prompt char_field, not CharField,
  • Why is there an extra models after completion? is it bug, or is it my wrong use?
  • After
  • completion, how and why the first parameter _ ("") function in CharField is used.

Thank you.
my vscode has two plug-ins Django and Django Template

installed.

_ () is no different from writing a string directly. After debugging _ (), it is found that it will be transferred to djangotranslationinit.py file in django: ugettext_lazy = lazy (ugettext, six.text_type). It can be seen that _ () points to ugettext_lazy inside django, while lazy implements the lazy calculation of ugettext function. Specifically, you can take a look at this https://www.jb51.net/article/...

Menu