File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,10 +114,10 @@ <h2>Attributes</h2>
114114 </ code >
115115 </ td >
116116 < td >
117- {% if attribute.klass_id == class.db_id %}
117+ {% if not attribute.class_url %}
118118 {{ class.name }}
119119 {% else %}
120- < a href ="{{ attribute.klass.get_absolute_url }} "> {{ attribute.klass.name }}</ a >
120+ < a href ="{{ attribute.class_url }} "> {{ attribute.class_name }}</ a >
121121 {% endif %}
122122 </ td >
123123 </ tr >
Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ class MethodInstance:
5858 kwargs : str
5959 namesakes : Sequence [MethodInstance ]
6060
61+ @attrs .frozen
62+ class Attribute :
63+ name : str
64+ value : str
65+ overridden : bool
66+ class_url : str | None
67+ class_name : str
68+
6169 def get_context_data (self , ** kwargs ):
6270 qs = Klass .objects .filter (
6371 name__iexact = self .kwargs ["klass" ],
@@ -123,10 +131,24 @@ def get_context_data(self, **kwargs):
123131 )
124132 for method in klass .get_methods ()
125133 ]
134+ attributes = [
135+ self .Attribute (
136+ name = attribute .name ,
137+ value = attribute .value ,
138+ overridden = hasattr (attribute , "overridden" ),
139+ class_url = (
140+ attribute .klass .get_absolute_url ()
141+ if attribute .klass_id != klass .id
142+ else None
143+ ),
144+ class_name = attribute .klass .name ,
145+ )
146+ for attribute in self ._get_prepared_attributes (klass )
147+ ]
126148 return {
127149 "all_ancestors" : ancestors ,
128150 "all_children" : children ,
129- "attributes" : self . _get_prepared_attributes ( klass ) ,
151+ "attributes" : attributes ,
130152 "canonical_url" : self .request .build_absolute_uri (canonical_url_path ),
131153 "class" : class_data ,
132154 "methods" : methods ,
You can’t perform that action at this time.
0 commit comments