S
S
sortfact3332021-03-04 17:13:13
Django
sortfact333, 2021-03-04 17:13:13

Why am I getting no such table: accounts_accountparameters?

I have a model

class AccountParameters(models.Model):
  user = models.OneToOneField(User, on_delete=models.CASCADE)
  phone = models.CharField('Phone',max_length=15,)
  basket = models.ManyToManyField(Offer, blank=True)

I migrated it to the project and then registered it.
admin.site.register(AccountParameters)
But when I go to the admin panel at the address
127.0.0.1:8000/admin/accounts/accountparameters

then I get an error
OperationalError at /admin/accounts/accountparameters/
no such table: accounts_accountparameters
Request Method:	GET
Request URL:	http://127.0.0.1:8000/admin/accounts/accountparameters/
Django Version:	3.1.1
Exception Type:	OperationalError
Exception Value:	
no such table: accounts_accountparameters
Exception Location:	C:\Users\Admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\sqlite3\base.py, line 413, in execute
Python Executable:	C:\Users\Admin\AppData\Local\Programs\Python\Python37\python.exe
Python Version:	3.7.6
Python Path:	
['D:\\Work\\Project\\git\\shop2',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\win32',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\win32\\lib',
 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\Pythonwin',
 'D:\\Work\\Project\\git\\shop2\\apps']
Server time:	Thu, 04 Mar 2021 14:05:58 +0000

Why is this and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2021-03-04
@bacon

I migrated it to the project and then registered it
migrated, migrated, but did not migrate. To you explicitly write that there is no such table. Exactly when "migrated", first a new migration was created and then you applied it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question