11# Copyright The IETF Trust 2007, All Rights Reserved
22
33from django .db import models
4- from django .conf import settings
5- from ietf .utils .lazy import reverse_lazy
64
7- # ------------------------------------------------------------------------
8- # Models
5+ from ietf . doc . models import DocAlias
6+
97
108LICENSE_CHOICES = (
119 (1 , 'a) No License Required for Implementers.' ),
@@ -42,20 +40,14 @@ class IprSelecttype(models.Model):
4240 type_id = models .AutoField (primary_key = True )
4341 is_pending = models .IntegerField (unique = True , db_column = "selecttype" )
4442 type_display = models .CharField (blank = True , max_length = 15 )
45- def __str__ (self ):
43+ def __unicode__ (self ):
4644 return self .type_display
47- class Meta :
48- if not settings .USE_DB_REDESIGN_PROXY_CLASSES :
49- db_table = 'ipr_selecttype'
5045
5146class IprLicensing (models .Model ):
5247 licensing_option = models .AutoField (primary_key = True )
5348 value = models .CharField (max_length = 255 , db_column = 'licensing_option_value' )
54- def __str__ (self ):
49+ def __unicode__ (self ):
5550 return self .value ;
56- class Meta :
57- if not settings .USE_DB_REDESIGN_PROXY_CLASSES :
58- db_table = 'ipr_licensing'
5951
6052
6153class IprDetail (models .Model ):
@@ -115,17 +107,8 @@ class IprDetail(models.Model):
115107 submitted_date = models .DateField (blank = True )
116108 update_notified_date = models .DateField (null = True , blank = True )
117109
118- def __str__ (self ):
119- return self .title
120110 def __unicode__ (self ):
121- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
122- # the latin-1 decode doesn't seem necessary anymore
123- return self .title
124- return self .title .decode ("latin-1" , 'replace' )
125- def docs (self ):
126- if settings .USE_DB_REDESIGN_PROXY_CLASSES :
127- return list (IprDraftProxy .objects .filter (ipr = self ))
128- return list (self .drafts .all ()) + list (self .rfcs .all ())
111+ return self .title
129112 @models .permalink
130113 def get_absolute_url (self ):
131114 return ('ietf.ipr.views.show' , [str (self .ipr_id )])
@@ -173,8 +156,6 @@ class IprUpdate(models.Model):
173156 processed = models .IntegerField (null = True , blank = True )
174157
175158
176- from ietf .doc .models import DocAlias
177-
178159class IprDocAlias (models .Model ):
179160 ipr = models .ForeignKey (IprDetail , related_name = 'documents' )
180161 doc_alias = models .ForeignKey (DocAlias )
@@ -189,46 +170,3 @@ class Meta:
189170 verbose_name = "IPR document alias"
190171 verbose_name_plural = "IPR document aliases"
191172
192- # proxy stuff
193-
194- from ietf .utils .proxy import TranslatingManager
195-
196- class IprDraftProxy (IprDocAlias ):
197- objects = TranslatingManager (dict (document = "doc_alias__name" ))
198-
199- # document = models.ForeignKey(InternetDraft, db_column='id_document_tag', "ipr")
200- # document = models.ForeignKey(Rfc, db_column='rfc_number', related_name="ipr")
201- @property
202- def document (self ):
203- from ietf .doc .proxy import DraftLikeDocAlias
204- return DraftLikeDocAlias .objects .get (pk = self .doc_alias_id )
205-
206- #revision = models.CharField(max_length=2)
207- @property
208- def revision (self ):
209- return self .rev
210-
211- class Meta :
212- proxy = True
213-
214- IprDraft = IprDraftProxy
215-
216- class IprRfcProxy (IprDocAlias ):
217- objects = TranslatingManager (dict (document = lambda v : ("doc_alias__name" , "rfc%s" % v )))
218-
219- # document = models.ForeignKey(InternetDraft, db_column='id_document_tag', "ipr")
220- # document = models.ForeignKey(Rfc, db_column='rfc_number', related_name="ipr")
221- @property
222- def document (self ):
223- from ietf .doc .proxy import DraftLikeDocAlias
224- return DraftLikeDocAlias .objects .get (pk = self .doc_alias_id )
225-
226- #revision = models.CharField(max_length=2)
227- @property
228- def revision (self ):
229- return self .rev
230-
231- class Meta :
232- proxy = True
233-
234- IprRfc = IprRfcProxy
0 commit comments