@@ -31,10 +31,10 @@ class WgAsociatedRule(RuleManager):
3131 description = 'All I-Ds associated with a particular WG'
3232
3333 def get_documents (self ):
34- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' ) ).filter (group__acronym = self .value ).distinct ()
34+ return Document .objects .filter (type = 'draft' ).filter (group__acronym = self .value ).distinct ()
3535
3636 def options (self ):
37- return [(i .acronym , i . name ) for i in Group .objects .filter (type = 'wg' , state = 'active' ).distinct ().order_by ('name' )]
37+ return [(i .acronym , "%s — %s" % ( i . acronym , i . name ) ) for i in Group .objects .filter (type = 'wg' , state = 'active' ).distinct ().order_by ('name' )]
3838
3939 def show_value (self ):
4040 try :
@@ -48,10 +48,10 @@ class AreaAsociatedRule(RuleManager):
4848 description = 'All I-Ds associated with all WGs in a particular Area'
4949
5050 def get_documents (self ):
51- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' ) ).filter (group__parent__acronym = self .value , group__parent__type = 'area' ).distinct ()
51+ return Document .objects .filter (type = 'draft' ).filter (group__parent__acronym = self .value , group__parent__type = 'area' ).distinct ()
5252
5353 def options (self ):
54- return [(i .acronym , i . name ) for i in Group .objects .filter (type = 'area' , state = 'active' ).distinct ().order_by ('name' )]
54+ return [(i .acronym , "%s — %s" % ( i . acronym , i . name ) ) for i in Group .objects .filter (type = 'area' , state = 'active' ).distinct ().order_by ('name' )]
5555
5656 def show_value (self ):
5757 try :
@@ -65,10 +65,10 @@ class AdResponsibleRule(RuleManager):
6565 description = 'All I-Ds with a particular responsible AD'
6666
6767 def get_documents (self ):
68- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' ) ).filter (ad = self .value ).distinct ()
68+ return Document .objects .filter (type = 'draft' ).filter (ad = self .value ).distinct ()
6969
7070 def options (self ):
71- return [(i .pk , i .name ) for i in Person .objects .filter (role__name = 'ad' ).distinct ().order_by ('name' )]
71+ return [(i .pk , i .name ) for i in Person .objects .filter (role__name = 'ad' , group__state = 'active' ).distinct ().order_by ('name' )]
7272
7373 def show_value (self ):
7474 try :
@@ -82,39 +82,39 @@ class AuthorRule(RuleManager):
8282 description = 'All I-Ds with a particular author'
8383
8484 def get_documents (self ):
85- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' ) ).filter (authors__person__name__icontains = self .value ).distinct ()
85+ return Document .objects .filter (type = 'draft' ).filter (authors__person__name__icontains = self .value ).distinct ()
8686
8787
8888class ShepherdRule (RuleManager ):
8989 codename = 'shepherd'
9090 description = 'All I-Ds with a particular document shepherd'
9191
9292 def get_documents (self ):
93- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' ) ).filter (shepherd__name__icontains = self .value ).distinct ()
93+ return Document .objects .filter (type = 'draft' ).filter (shepherd__name__icontains = self .value ).distinct ()
9494
9595
9696class ReferenceToRFCRule (RuleManager ):
9797 codename = 'reference_to_rfc'
9898 description = 'All I-Ds that have a reference to a particular RFC'
9999
100100 def get_documents (self ):
101- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' )) .filter (relateddocument__target__document__states__name = 'rfc' , relateddocument__target__document__name__icontains = self .value ).distinct ()
101+ return Document .objects .filter (type = 'draft' ) .filter (relateddocument__target__document__states = 'rfc' , relateddocument__target__document__name__icontains = self .value ).distinct ()
102102
103103
104104class ReferenceToIDRule (RuleManager ):
105105 codename = 'reference_to_id'
106106 description = 'All I-Ds that have a reference to a particular I-D'
107107
108108 def get_documents (self ):
109- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' )) .filter (relateddocument__target__document__type__name = 'Draft ' , relateddocument__target__document__name__icontains = self .value ).distinct ()
109+ return Document .objects .filter (type = 'draft' ) .filter (relateddocument__target__document__type = 'draft ' , relateddocument__target__document__name__icontains = self .value ).distinct ()
110110
111111
112112class ReferenceFromRFCRule (RuleManager ):
113113 codename = 'reference_from_rfc'
114114 description = 'All I-Ds that are referenced by a particular RFC'
115115
116116 def get_documents (self ):
117- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' )) .filter (relateddocument__source__states__name = 'rfc' , relateddocument__source__name__icontains = self .value ).distinct ()
117+ return Document .objects .filter (type = 'draft' ) .filter (relateddocument__source__states = 'rfc' , relateddocument__source__name__icontains = self .value ).distinct ()
118118
119119
120120
@@ -123,15 +123,15 @@ class ReferenceFromIDRule(RuleManager):
123123 description = 'All I-Ds that are referenced by a particular I-D'
124124
125125 def get_documents (self ):
126- return Document .objects .filter (Q ( type__name = 'Draft' ) | Q ( states__name = 'rfc' )) .filter (relateddocument__source__type__name = 'Draft ' , relateddocument__source__name__icontains = self .value ).distinct ()
126+ return Document .objects .filter (type = 'draft' ) .filter (relateddocument__source__type = 'draft ' , relateddocument__source__name__icontains = self .value ).distinct ()
127127
128128
129129class WithTextRule (RuleManager ):
130130 codename = 'with_text'
131131 description = 'All I-Ds that contain a particular text string in the name'
132132
133133 def get_documents (self ):
134- return Document .objects .filter (type__name = 'Draft ' ).filter (name__icontains = self .value ).distinct ()
134+ return Document .objects .filter (type = 'draft ' ).filter (name__icontains = self .value ).distinct ()
135135
136136
137137TYPES_OF_RULES = [(i .codename , i .description ) for i in RuleManager .__subclasses__ ()]
0 commit comments