"object 'Target' has no attribute 'ObjectDoesNotExist'" with fresh install
Closed this issue · 3 comments
ComFreek commented
I did a fresh clone and install as of today according to the readme and am faced with the following error when navigating to http://127.0.0.1:8000/. Note that http://127.0.0.1:8000/adminbackend/ flawlessly works.
System Information:
- Windows 10 Pro 64-bit
- Python 3.7.3
AttributeError at /
type object 'Target' has no attribute 'ObjectDoesNotExist'
Request Method:
GET
Request URL:
http://127.0.0.1:8000/
Django Version:
2.2.6
Exception Type:
AttributeError
Exception Value:
type object 'Target' has no attribute 'ObjectDoesNotExist'
Exception Location:
D:\Documents\CaloriesTracker\pants\pants\targets\models.py in get_primary_target, line 85
Python Executable:
C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\Scripts\python.exe
Python Version:
3.7.3
Python Path:
['D:\\Documents\\CaloriesTracker\\pants\\pants',
'C:\\Users\\ComFreek\\.virtualenvs\\CaloriesTracker-r75ZFtn5\\Scripts\\python37.zip',
'C:\\Users\\ComFreek\\.virtualenvs\\CaloriesTracker-r75ZFtn5\\DLLs',
'C:\\Users\\ComFreek\\.virtualenvs\\CaloriesTracker-r75ZFtn5\\lib',
'C:\\Users\\ComFreek\\.virtualenvs\\CaloriesTracker-r75ZFtn5\\Scripts',
'c:\\python37\\Lib',
'c:\\python37\\DLLs',
'C:\\Users\\ComFreek\\.virtualenvs\\CaloriesTracker-r75ZFtn5',
'C:\\Users\\ComFreek\\.virtualenvs\\CaloriesTracker-r75ZFtn5\\lib\\site-packages']
Server time:
Tue, 15 Oct 2019 19:42:40 +1100
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 2.2.6
Python Version: 3.7.3
Installed Applications:
['ingredients.apps.IngredientsConfig',
'products.apps.ProductsConfig',
'recipes.apps.RecipesConfig',
'diary.apps.DiaryConfig',
'targets.apps.TargetsConfig',
'website.apps.WebsiteConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'django_filters']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "D:\Documents\CaloriesTracker\pants\pants\targets\models.py" in get_primary_target
84. return Target.objects.get(user=user,daily_target=True)
File "C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\lib\site-packages\django\db\models\manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\lib\site-packages\django\db\models\query.py" in get
408. self.model._meta.object_name
During handling of the above exception (Target matching query does not exist.), another exception occurred:
File "C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)
File "C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\lib\site-packages\django\core\handlers\base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\lib\site-packages\django\core\handlers\base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\ComFreek\.virtualenvs\CaloriesTracker-r75ZFtn5\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
21. return view_func(request, *args, **kwargs)
File "D:\Documents\CaloriesTracker\pants\pants\website\views.py" in index
30. 'daily_target': Target.get_primary_target(user),
File "D:\Documents\CaloriesTracker\pants\pants\targets\models.py" in get_primary_target
85. except Target.ObjectDoesNotExist:
Exception Type: AttributeError at /
Exception Value: type object 'Target' has no attribute 'ObjectDoesNotExist'
dylanleigh commented
Thanks for reporting this - it should be fixed by this commit: 1e8d47b
ComFreek commented
Thanks, it works! Now I just have to figure out how to actually enter something. Do I do this in the admin backend?
dylanleigh commented
Thanks, it works! Now I just have to figure out how to actually enter something. Do I do this in the admin backend?
Sorry I missed your comment @ComFreek , for some reason I didn't get a notification.
All data entry is in the admin backend at the moment.