Skip to content

Commit 9766ab3

Browse files
committed
Some IPR admin tweaks. Provide a __unicode__ method and show a contact even if multiple have been set for an IPR declaration.
- Legacy-Id: 3197
1 parent f598e4b commit 9766ab3

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

ietf/ipr/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class IprContactAdmin(admin.ModelAdmin):
77
admin.site.register(IprContact, IprContactAdmin)
88

99
class IprDetailAdmin(admin.ModelAdmin):
10+
list_display = ['title', 'submitted_date', 'docs', ]
11+
search_fields = ['title', 'legal_name', ]
1012
pass
1113
admin.site.register(IprDetail, IprDetailAdmin)
1214

ietf/ipr/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ class IprDetail(models.Model):
114114

115115
def __str__(self):
116116
return self.title
117+
def __unicode__(self):
118+
return self.title.decode("latin-1", 'replace')
117119
def docs(self):
118120
return list(self.drafts.all()) + list(self.rfcs.all())
119121
@models.permalink
@@ -124,6 +126,8 @@ def get_submitter(self):
124126
return self.contact.get(contact_type=3)
125127
except IprContact.DoesNotExist:
126128
return None
129+
except IprContact.MultipleObjectsReturned:
130+
return self.contact.filter(contact_type=3)[0]
127131
class Meta:
128132
db_table = 'ipr_detail'
129133

0 commit comments

Comments
 (0)