I would like to empty all things within the following many to many field(weekday_with_class
):
all_existing_class.weekday_with_class = None
Here is the models.py:
weekday_with_class = models.ManyToManyField('Weekday', blank=True, related_name='weekday_with_class')
However, if I execute the above code, I get this error:
Direct assignment to the forward side of a many-to-many set is prohibited. Use weekday_with_class.set() instead.
How is it possible to basically make my weekday_with_class
empty for an instance? Thank you, and please leave a comment if you need any more information.
all_existing_class.weekday_with_class.clear()