In models.py I have class Memo:
class Memo(models.Model):
MonthName = models.ForeignKey(Months, on_delete=models.CASCADE)
ProjectName = models.ForeignKey(Project, on_delete=models.CASCADE)
Hours = models.IntegerField(blank=True, null=True)
# ProjectManager = models.ForeignKey(ItEmployee, on_delete=models.CASCADE)
def __str__(self):
return str(self.MonthName) + ' - ' + str(self.ProjectName)
In views.py I am getting warning Unresolved attribute reference 'objects' for class Memo:
from django.http import HttpResponse
from History.models import Memo
def memos(request):
all_memos = Memo.objects.all()
html = ''
for memo in all_memos:
url = '/memo/' + str(Memo.MonthName) + '/'
html += '<a href="' + url + '">' + Memo.ProjectName + '</a><br>'
return HttpResponse(html)