31 | | for ct in content_types: |
32 | | if verbosity >= 2: |
33 | | print "Deleting stale content type '%s | %s'" % (ct.app_label, ct.model) |
34 | | ct.delete() |
| 31 | if content_types: |
| 32 | if kwargs.get('delete_stale', False): |
| 33 | for ct in content_types: |
| 34 | if verbosity >= 2: |
| 35 | print "Deleting stale content type '%s | %s'" % (ct.app_label, ct.model) |
| 36 | ct.delete() |
| 37 | else: |
| 38 | print """ |
| 39 | The following content types are stale: |
| 40 | %s |
| 41 | They may still be referenced by other models, so they are not being deleted. |
| 42 | To delete them, run: |
| 43 | >>> from django.contrib.contenttypes.management import update_all_contenttypes |
| 44 | >>> update_all_contenttypes(verbosity=2, delete_stale=False) |
| 45 | Verify that no other models reference those content types, then run: |
| 46 | >>> update_all_contenttypes(verbosity=2, delete_stale=True) |
| 47 | """ % ', '.join(['%s | %s' % (ct.app_label, ct.model) for ct in content_types]) |