First, you’ll need to clear the relationship(s) by using .clear() or .remove(), whichever suits your needs better according to the docs.
After that, you’ll need to delete the object(s) by using the [YourModel].delete() method.
More Related Contents:
- Proper way to handle multiple forms on one page in Django
- Django Forms: if not valid, show form with error message
- How to set a Django model field’s default value to a function call / callable (e.g., a date relative to the time of model object creation)
- How can I change the default Django date template format?
- Using a UUID as a primary key in Django models (generic relations impact)
- Django ManyToMany filter()
- Limit foreign key choices in select in an inline form in admin
- Django Rest Framework: Dynamically return subset of fields
- Django get the static files URL in view
- Confusion in Django admin, static and media files
- What’s the cleanest, simplest-to-get running datepicker in Django?
- Django multi-select widget?
- Using Heroku for Django Media Files
- Where can I find the error logs of nginx, using FastCGI and Django?
- Django’s self.client.login(…) does not work in unit tests
- Django ManyToMany model validation
- Django – Overriding the Model.create() method?
- How to create a Django queryset filter comparing two date fields in the same model
- Redirect on admin Save
- Effects of changing Django’s SECRET_KEY
- Django Queryset with filtering on reverse foreign key
- Can Django automatically create a related one-to-one model?
- Django how to pass custom variables to context to use in custom admin template?
- Django Admin – Overriding the widget of a custom form field
- How to add Check Constraints for Django Model fields?
- Django queryset get exact manytomany lookup [duplicate]
- Django / Comet (Push): Least of all evils?
- 110: Connection timed out (Nginx/Gunicorn)
- How to show related items using DeleteView in Django?
- CSRF verification failed. Request aborted. on django