Answer the question
In order to leave comments, you need to log in
Django ORM: Query objects.all() gives error "object has no attribute 'name'"?
Greetings!
When I try to call Apparel.objects.all() or Apparel.objects.get(pk=1) I get an error
AttributeError: 'Apparel' object has no attribute 'name'
class Apparel(models.Model):
price = models.IntegerField()
color = models.CharField()
...
class ApparelSize(models.Model):
size = models.CharField()
apparel = models.ForeignKey(Apparel, on_delete=models.PROTECT)
class Material(models.Model):
material = models.CharField()
apparel = models.ForeignKey(Apparel, on_delete=models.PROTECT)
class ApparelDetail(Apparel):
name = models.CharField()
description = models.TextField()
...
Answer the question
In order to leave comments, you need to log in
Thanks for the replies, but after restarting the problem resolved itself.
If possible, please delete the question.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question