60👍
✅
You can reference a class like this:
class B(object):
"""docs for B with reference to :class:`.A`"""
pass
Sphinx will intelligently try and figure out what you’re referencing. If there are multiple classes with the name A
, you might get a warning, but it should pick up the one in the current module.
15👍
Don’t know if I understand the problem but this works flawlessly to me with autodoc, as per Cross-referencing Python objects
class FlowDirection(GeneralTable):
'''
Heat Flow Direction
:cvar int id: database primary key
:cvar unicode name: name
'''
def __repr__(self):
return u'<FlowDirection {0} instance at {1}>'.format(
self.name, hex(id(self))).encode('utf-8')
def __unicode__(self):
return self.name
class AirCavityRes(GeneralTable):
'''
Air Cavity :term:`thermal resistance`
:cvar flow_direction: heat flow direction
(see :class:`FlowDirection`)
:cvar int id: database primary key
:cvar int if_fd: database foreign key to :class:`FlowDirection`
:cvar float res: :term:`thermal resistance`
:cvar float thick: thickness
'''
def __repr__(self):
return u'<AirCavityRes {0} instance at {1}>'.format(
self.res, hex(id(self)))
- [Django]-Django CSRF framework cannot be disabled and is breaking my site
- [Django]-Get type of Django form widget from within template
- [Django]-How to debug Django commands in PyCharm
Source:stackexchange.com