#14183: Geodjango models broken with pydoc --------------------------+------------------------------------------------- Reporter: dzwarg | Owner: nobody Status: new | Milestone: Component: Contrib apps | Version: 1.1 Keywords: pydoc | Stage: Unreviewed Has_patch: 0 | --------------------------+------------------------------------------------- It's not possible to generate docs with pydoc for geographic models.
Use this as pydoctest/geotest/models.py: {{{ #!python """ Models to test pydoc. I'm writing some DocStrings to test pydoc and geodjango. """ # 1) Test that pydoc creates good docs with this line: from django.db import models # 2) Test that pydoc creates bad docs with this line: #from django.contrib.gis.db import models # Create your models here. class TestGeoModel(models.Model): """This is a geographic model. It is very complicated, thus the enormously long docstring.""" name = models.CharField(max_length=50) area = models.IntegerField() lon = models.FloatField() lat = models.FloatField() # 2) Uncomment these lines to generate bad docs with gis models: #geom = models.PolygonField() #objects = models.GeoManager() class Meta: """A meta class helper for TestGeoModel. This meta class tells me how to pluralize the name of TestGeoModel.""" verbose_name_plural = 'TestGeoModelles' def __unicode__(self): """Get a unicode representation of this object (it's just its name).""" return self.name }}} Steps to reproduce: 1. django-admin startproject pydoctest 1. cd pydoctest 1. django-admin startapp geotest 1. edit settings.py -- use a spatial db, like spatialite, add geotest to INSTALLED_APPS 1. cd .. 1. export DJANGO_SETTINGS_MODULE=pydoctest.settings 1. pydoc pydoctest.geotest.models 1. Observe: Good docs! {{{ Help on module pydoctest.geotest.models in pydoctest.geotest: NAME pydoctest.geotest.models - Models to test pydoc. FILE /tmp/pydoctest/geotest/models.py DESCRIPTION I'm writing some DocStrings to test pydoc and geodjango. CLASSES django.db.models.base.Model(__builtin__.object) TestGeoModel class TestGeoModel(django.db.models.base.Model) | This is a geographic model. | | It is very complicated, thus the enormously long docstring. | | Method resolution order: | TestGeoModel | django.db.models.base.Model | __builtin__.object ...etc }}} 1. In pydoctest/geotest/models.py, comment out line 8. 1. In pydoctest/geotest/models.py, uncomment line 11, 23, 24. 1. pydoc pydoctest.geotest.models 1. Observe: Bad docs! {{{ Help on module pydoctest.geotest.models in pydoctest.geotest: NAME pydoctest.geotest.models - Models to test pydoc. FILE /tmp/pydoctest/geotest/models.py DESCRIPTION I'm writing some DocStrings to test pydoc and geodjango. CLASSES django.db.models.base.Model(__builtin__.object) TestGeoModel TestGeoModel = <class 'pydoctest.geotest.models.TestGeoModel'> (END) }}} Please advise. -- Ticket URL: <http://code.djangoproject.com/ticket/14183> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.