Answer the question
In order to leave comments, you need to log in
'Ba' object has no attribute 'print' Django error, how to solve?
from django.db import models
class Bb(models.Model):
title = models.CharField(max_length = 50)
content = models.TextField(null = True, blank = True)
price = models.FloatField( null=True, blank = True)
published = models.DateTimeField(auto_now_add=True, db_index=True)
from django.http import HttpResponse
from .models import Ba
def index(request):
s = 'Список объявлений\n\r\n\r\n\r'
for b in Ba.objects.order_by('-published'):
s += 'Название: ' + b.title + '\n\r\n\r' + 'Описание: ' + b.content + '\n\r\n\r' + 'Цена: ' + b.print
return HttpResponse(s, content_type = 'text/plain; charset=utf-8')
'Ba' object has no attribute 'print'
Answer the question
In order to leave comments, you need to log in
Well, firstly - you declare and bring the model Bb, and import the model Ba
Well, and secondly - if you take the model Bb for the model Ba - then it really does not have a print property
, maybe 'price' did you mean?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question