i am trying to create a "Kriskras" that has a list of activities behind it.
so i used a foreign key to link them. but every time i am trying to add something to the list i get the error
AttributeError: 'QuerySet' object has no attribute 'vergadering_set'
this is my model
from django.db import models
# Create your models here.
class Kriskras(models.Model):
tak = models.CharField(max_length=20)
def __str__(self):
return self.tak
class Vergadering(models.Model):
kriskras = models.ForeignKey(Kriskras, on_delete=models.CASCADE)
date = models.CharField(max_length=50)
extra = models.CharField(max_length=5)
activiteit = models.CharField(max_length=500)
def __str__(self):
return self.activiteit
how can i solve it so i can use the vergadering_set attribute?
question from:
https://stackoverflow.com/questions/65952251/querset-object-has-no-attribute 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…