User Profile model.py -'Name error' in django












0















I created the user profile for some useful information. But Iget an error after creating the model.py and form.py
The error is



Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/user/anaconda3/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/home/user/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/user/Desktop/vmail/vm/models.py", line 23, in <module>
class Profile(models.Model):
File "/home/user/Desktop/vmail/vm/models.py", line 24, in Profile
user = user_form.save()
NameError: name 'user_form' is not defined









share|improve this question



























    0















    I created the user profile for some useful information. But Iget an error after creating the model.py and form.py
    The error is



    Traceback (most recent call last):
    File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
    File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
    File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
    File "/home/user/anaconda3/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
    File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
    File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
    File "/home/user/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 994, in _gcd_import
    File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 678, in exec_module
    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    File "/home/user/Desktop/vmail/vm/models.py", line 23, in <module>
    class Profile(models.Model):
    File "/home/user/Desktop/vmail/vm/models.py", line 24, in Profile
    user = user_form.save()
    NameError: name 'user_form' is not defined









    share|improve this question

























      0












      0








      0








      I created the user profile for some useful information. But Iget an error after creating the model.py and form.py
      The error is



      Traceback (most recent call last):
      File "manage.py", line 22, in <module>
      execute_from_command_line(sys.argv)
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
      utility.execute()
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
      django.setup()
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
      apps.populate(settings.INSTALLED_APPS)
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
      app_config.import_models()
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
      self.models_module = import_module(models_module_name)
      File "/home/user/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/user/Desktop/vmail/vm/models.py", line 23, in <module>
      class Profile(models.Model):
      File "/home/user/Desktop/vmail/vm/models.py", line 24, in Profile
      user = user_form.save()
      NameError: name 'user_form' is not defined









      share|improve this question














      I created the user profile for some useful information. But Iget an error after creating the model.py and form.py
      The error is



      Traceback (most recent call last):
      File "manage.py", line 22, in <module>
      execute_from_command_line(sys.argv)
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
      utility.execute()
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
      django.setup()
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
      apps.populate(settings.INSTALLED_APPS)
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
      app_config.import_models()
      File "/home/user/anaconda3/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
      self.models_module = import_module(models_module_name)
      File "/home/user/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/user/Desktop/vmail/vm/models.py", line 23, in <module>
      class Profile(models.Model):
      File "/home/user/Desktop/vmail/vm/models.py", line 24, in Profile
      user = user_form.save()
      NameError: name 'user_form' is not defined






      python-3.x django-forms






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 1 at 14:37









      SenthujaSenthuja

      2018




      2018
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53996332%2fuser-profile-model-py-name-error-in-django%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53996332%2fuser-profile-model-py-name-error-in-django%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith