Opened 14 years ago
Closed 13 years ago
#14183 closed Bug (worksforme)
Geodjango models broken with pydoc
Reported by: | dzwarg | Owned by: | dario |
---|---|---|---|
Component: | GIS | Version: | 1.1 |
Severity: | Normal | Keywords: | pydoc |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It's not possible to generate docs with pydoc for geographic models.
Use this as pydoctest/geotest/models.py:
""" 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:
- django-admin startproject pydoctest
- cd pydoctest
- django-admin startapp geotest
- edit settings.py -- use a spatial db, like spatialite, add geotest to INSTALLED_APPS
- cd ..
- export DJANGO_SETTINGS_MODULE=pydoctest.settings
- pydoc pydoctest.geotest.models
- 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
- In pydoctest/geotest/models.py, comment out line 8.
- In pydoctest/geotest/models.py, uncomment line 11, 23, 24.
- pydoc pydoctest.geotest.models
- 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.
Attachments (2)
Change History (8)
by , 14 years ago
Attachment: | good_docs.txt added |
---|
by , 14 years ago
Attachment: | bad_docs.txt added |
---|
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Owner: | changed from | to
---|
comment:3 by , 14 years ago
My platform:
ubuntu 10.4
django 1.1
python 2.6.5
postgres 8.4.5
postgis 1.4.0
Has this been resolved in the new version of django?
comment:4 by , 14 years ago
Component: | Contrib apps → GIS |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:5 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:6 by , 13 years ago
Easy pickings: | unset |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
UI/UX: | unset |
Testing pydoc on Django's trunk using the gis version of models.Model and it worked fine. I am closing the ticket. Please reopen if still broken using Django trunk.
Note:
See TracTickets
for help on using tickets.
I probed it with python 2.6.4 and spatialite 2.3 and it works fine.
With the same definition in models.py I follow the same steps.
Steps to reproduce:
See attach: good_docs.txt
See attach: bad_docs.txt
Please give more information about the platform you are using.