I'm a complete novice to python and Django.
I have tried several solutions I found on stack overflow, but I still get the same issue. I've tried querying from shell and it works well, but not on my code.
I've installed `pylint` using
pip install pylint-django
I have also changed the Linter settings on Settings > User Settings > Python from `pyLint` to `pylint_django` and also to `flake8`, but no positive results.
I still get the message "Class Courses has no 'objects' member pylint(no-member)"
These are my codes from models.py:
class Courses(models.Model):
course_title = models.CharField(max_length=200)
course_image = models.ImageField(upload_to='course_images/')
course_duration = models.TimeField()
def __str__(self):
return self.course_title
The views.py looks like this:
from django.shortcuts import render
from django.http import HttpResponse
from .models import Courses
def homepage(request):
cos = Courses.objects.all()
context={ 'courses': cos }
return render(request, "main/home.html", context)
I need help. I'm completely stuck.