Closed morbanjunior closed 4 years ago
Hello I trying to make a blog but, I have the next error.
[pylint] E1101:Class 'Post' has no 'objetcs' member class Post(*args, **kwargs) class Post
this is my view: from django.shortcuts import render from django.http import HttpResponse from .models import Post as po def index(request):
post= po.objetcs.all()[:10] context={ 'title':'Latest Posts', 'posts': post } return render(request, 'post/index.html',context)
and this is my Model:
from django.db import models from datetime import datetime class Post(models.Model): title=models.CharField(max_length=200) body=models.TextField() created_at=models.DateTimeField(default=datetime.now, blank=True) def str(self): return self.title
I dont now what going on, can someone tell me what is the problem? Thanks.
I reset my server 6 time and now it is working .
Hello I trying to make a blog but, I have the next error.
Error E1101
[pylint] E1101:Class 'Post' has no 'objetcs' member class Post(*args, **kwargs) class Post
this is my view: from django.shortcuts import render from django.http import HttpResponse from .models import Post as po def index(request):
return HttpResponse('Hello From Posts')
and this is my Model:
from django.db import models from datetime import datetime class Post(models.Model): title=models.CharField(max_length=200) body=models.TextField() created_at=models.DateTimeField(default=datetime.now, blank=True) def str(self): return self.title
I dont now what going on, can someone tell me what is the problem? Thanks.