Hello Everyone

42 views
Skip to first unread message

Lachi Teaching

unread,
Sep 15, 2021, 12:10:11 PM9/15/21
to Django users

I'm receiving that error  I add the line from .forms import CustomUserCreationForm into my views.py and it's driving me insane. I have no idea how to fix this. 

Exception in thread django-main-thread:

Traceback (most recent call last):

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner  

    self.run()

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run

    self._target(*self._args, **self._kwargs)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper

    fn(*args, **kwargs)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run

    self.check(display_num_errors=True)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 392, in check

    all_issues = checks.run_checks(

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks

    new_errors = check(app_configs=app_configs, databases=databases)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config

    return check_resolver(resolver)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver

    return check_method()

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 

408, in check

    for pattern in self.url_patterns:

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 

589, in url_patterns

    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in __get__

    res = instance.__dict__[self.name] = self.func(instance)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 

582, in urlconf_module

    return import_module(self.urlconf_name)

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\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:\coding\django\djecommerce\django-crm\djcrm\urls.py", line 22, in <module>

    from leads.views import LandingPageView, SignupView

  File "E:\coding\django\djecommerce\django-crm\leads\views.py", line 6, in <module>

    from .forms import LeadModelForm, LeadModelForm

  File "E:\coding\django\djecommerce\django-crm\leads\forms.py", line 27, in <module>

    class CustomUserCreationForm(UserCreationForm):

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\forms\models.py", line 253, in __new__

    fields = fields_for_model(

  File "C:\Users\Technicalsmirchis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\forms\models.py", line 142, in fields_for_model

    opts = model._meta

AttributeError: 'function' object has no attribute '_meta'


bnmng

unread,
Sep 22, 2021, 6:22:11 PM9/22/21
to Django users
I'm not sure but you might be calling a function without the parentheses somewhere.   Seems like the function would return an object that has a _meta attribute, but without the parentheses the code is looking at the function itself, and not the object that the function returns
Reply all
Reply to author
Forward
0 new messages