[Fixed]-How to call one field from another model?

1👍

You need to remove the self., d is the object that is currently being iterated over.

for d in Shiftdate.objects.select_related('sit_date'):
    d.shift_date=self.sit_date

Note:

  1. You won’t actually be storing the value in the models since you don’t save() it

  2. Your return won’t work since its outside the loop and even then it will only return the first.

👤Sayse

Leave a comment