Skip to content
Advertisement

Tag: django

‘function’ object has no attribute ‘objects’ Django, help me

I’m designing a Django app and experiencing an error message: This is my views.py that generates the message: and this is my model.py Thanks for any help. Answer You wrote a view function named Post, hence Post.objects refers to the Post function, not the model. You furthermore named your model posts, instead of Post. I strongly advise to rename your

Django 3.x error: ‘mysql.connector.django’ isn’t an available database backend

Having recently upgraded a Django project from 2.x to 3.x, I noticed that the mysql.connector.django backend (from mysql-connector-python) no longer works. The last version of Django that it works with is 2.2.11. It breaks with 3.0. I am using mysql-connector-python==8.0.19. When running manage.py runserver, the following error occurs: I am aware that this is not an official Django backend but

Cannot access Django administrator site in Django-3

Successfully created an admin user using py manage.py createsuperuser. Entered username, e-mail, password but whenever I try to access this link http://127.0.0.1:8000/admin/ it says “This site can’t be reached” and “127.0.0.1 refused to connect, ” How do I fix this error and access the administrator site ? I’m using Windows 10 with the latest version of Django. before accessing admin

Django filter on OneToOne field appending “_id” and failing

In my Django application I have the following model: Note user is a OneToOneField to my CustomUser table and also the primary key of this table. In views.py, I attempt to query this table with Provider.objects.filter(user=request.user) and get django.db.utils.OperationalError: (1054, “Unknown column ‘appname_provider.user_id’ in ‘field list'”). Checking my MySql database, I see the columns are (user, company_id). So why is

Template file not found Django

I am trying to make a home page of a new website via Django. My app name is ‘blog’, home page is home.html I still receive the error template does not exist when I go to http://127.0.0.1:8000/blog/home/ I made sure I added ‘blog’ to my templates in settings.py and that I added the folder templates in the main directory as

RelatedObjectDoesNotExist. User has no profile

I’ve read some other answers for this (almost) question but they didn’t help. I have the following 2 files mixed for user and profile apps(?). In other answers they said this happens if you don’t use >objects.get_or_create or not making signals.py file you’ll get this error but I’ve gone through both of those ways and no results. This is the

Advertisement