1👍
✅
In this case the error message isn’t very helpful. What it’s trying to say is that you can’t save a ManyToMany relationship until you have an id for both objects. You need to save an instance of Seats
first, and then add the ManyToMany field:
seats = Seats.objects.create(movie_name=m, multiplex_name=mul,
date=dt, time=tm)
seats.seat_no.add(st)
You can read more about it in the docs.
0👍
In this line
Seats.objects.bulk_create(
[
Seats(movie_name = m, multiplex_name = mul,
seat_no = st, date = dt, time=tm, seats = 1 ),
]
)
you are setting seats = 1
. But the Seats
model does not have a seats
field. This is most likely why you are getting the error.
- How combine (merge) several number of querysets?
- Django not searching for translation messages
- How to return JSON Response correctly in joining multiple table in Django
- CSS not rendering in Django
Source:stackexchange.com