Ticket #1253: doc.py.diff
File doc.py.diff, 2.0 KB (added by , 19 years ago) |
---|
-
doc.py
137 137 if not utils.docutils_is_available: 138 138 return missing_docutils_page(request) 139 139 140 m odels= []140 m = [] 141 141 for app in models.get_installed_model_modules(): 142 142 for model in app._MODELS: 143 143 opts = model._meta 144 m odels.append({145 'name': '%s.%s' % ( opts.app_label, opts.module_name),144 m.append({ 145 'name': '%s.%s' % (model.__module__, model.__name__), 146 146 'module': opts.app_label, 147 147 'class': opts.module_name, 148 148 }) 149 return render_to_response('admin_doc/model_index', {'models': m odels}, context_instance=RequestContext(request))149 return render_to_response('admin_doc/model_index', {'models': m}, context_instance=RequestContext(request)) 150 150 model_index = staff_member_required(model_index) 151 151 152 152 def model_detail(request, model): … … 154 154 return missing_docutils_page(request) 155 155 156 156 try: 157 model = models.get_app(model) 157 comp = model.split('.') 158 modulename = '.'.join(comp[:-1]) 159 modelname = comp[-1] 160 mod = __import__(modulename, '', '', ['']) 161 model = getattr(mod, modelname) 158 162 except ImportError: 159 163 raise Http404 160 opts = model. Klass._meta164 opts = model._meta 161 165 162 166 # Gather fields/field descriptions 163 167 fields = [] … … 168 172 'verbose': field.verbose_name, 169 173 'help': field.help_text, 170 174 }) 171 for func_name, func in model. Klass.__dict__.items():172 if callable(func) and len(inspect.getargspec(func)[0]) == 0:175 for func_name, func in model.__dict__.items(): 176 if (inspect.isfunction(func) or inspect.ismethod(func)) and len(inspect.getargspec(func)[0]) == 0: 173 177 try: 174 178 for exclude in MODEL_METHODS_EXCLUDE: 175 179 if func_name.startswith(exclude):