#24865: Add a feature to programmatically remove stale content types
--------------------------------------+------------------------------------
     Reporter:  Protosac              |                    Owner:  nobody
         Type:  New feature           |                   Status:  new
    Component:  contrib.contenttypes  |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:  stale contenttypes    |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  1
  Needs tests:  1                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Protosac):

 Replying to [comment:1 timgraham]:
 > Could you please send a pull request with tests and documentation? You
 may find the [https://docs.djangoproject.com/en/dev/internals/contributing
 /writing-code/submitting-patches/#patch-review-checklist patch review
 checklist] helpful.

 I've looked the specs over and I'm not sure this warrants a test. The
 current Django tests for `update_contenttypes` already test for
 interactive. All this change does is automatically respond to it's prompt
 in the very same way the `test_interactive_true` does.

 ````
 def test_interactive_true(self):
         """
         interactive mode of update_contenttypes() (the default) should
 delete
         stale contenttypes.
         """
         management.input = lambda x: force_str("yes")
         with captured_stdout() as stdout:
             management.update_contenttypes(self.app_config)
         self.assertIn("Deleting stale content type", stdout.getvalue())
         self.assertEqual(ContentType.objects.count(), self.before_count)
 ````
 As for documentation I was considering placing it in the contenttypes.txt
 and adding a Management section to describe the `force_remove` argument
 and `remove_contenttypes` method. If that's an inappropriate place, please
 make a recommendation. Thanks again.

--
Ticket URL: <https://code.djangoproject.com/ticket/24865#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.9e3c31a85fbbb6c7ebad54fd76457b16%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to