Skip to content
Advertisement

Tag: django

ModuleNotFoundError: No module named ‘rest_framework’ (tried many solutions but not working)

I have encountered this error. ModuleNotFoundError: No module named ‘rest_framework’ I have a virtual environment setted up and the rest framework is installed correctly. When I run pip3.10 show djangoframework, I get My interpreter is Python 3.10.8 which is the same version and it is for the virtual environment. my VSCode shows my interpreter as Python 3.10.8 (“TESTPY”:venv) .Scriptspython.exe. I

ImportError: cannot import name ‘RightsMaster’ from partially initialized module ‘DATABASE.models’ (most likely due to a circular import)

from DATABASE.models import ModuleMaster, PageMaster, RightsMaster ImportError: cannot import name ‘RightsMaster’ from partially initialized module ‘DATABASE.models’ (most likely due to a circular import) (C:UsersADMINDesktoppython serverDATABASEmodels_init_.py) module_page.py rights_master.py user_rights.py init.py Answer I fixed it I was trying to import ModuleMaster in user_rights.py But it is already connected with Foreign_key in PageMaster

Django – How to save model objects in another model?

Let’s say I have these two models (in models.py file): How can I merge these two models in a new model but with the same Id? So it becomes: PS: In my views.py file I called a save method like that: Thanks in advance and I really appreciate who answers that because I see that many people having the same

Django Rest API from Database

I have 2 APIs from my existing project. Where One provides the latest blog posts and another one provides sorting details. The 2nd API (sorting) gives blog posts ID and an ordering number, which should be in the 1st,2nd,3rd…n position. If I filter in the first API with that given ID I can get the blog post details. How can

Advertisement