Skip to content

Commit 10f32d8

Browse files
committed
Merged in [9330] from rcross@amsl.com:
Fixes Ticket ietf-tools#1626. Cleanup legacy IPR models. - Legacy-Id: 9332 Note: SVN reference [9330] has been migrated to Git commit 415d0ad
2 parents 469d693 + 415d0ad commit 10f32d8

7 files changed

Lines changed: 297 additions & 297 deletions

File tree

ietf/doc/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,9 @@ def related_ipr(self):
495495
"""Returns the IPR disclosures against this document and those documents this
496496
document directly or indirectly obsoletes or replaces
497497
"""
498-
from ietf.ipr.models import IprDocAlias
499-
aliases = IprDocAlias.objects.filter(doc_alias__in=list(self.docalias_set.all())+self.all_related_that_doc(['obs','replaces'])).filter(ipr__status__in=[1,3]).values_list('ipr', flat=True).distinct()
500-
return aliases
498+
from ietf.ipr.models import IprDocRel
499+
iprs = IprDocRel.objects.filter(document__in=list(self.docalias_set.all())+self.all_related_that_doc(['obs','replaces'])).filter(disclosure__state__in=['posted','removed']).values_list('disclosure', flat=True).distinct()
500+
return iprs
501501

502502
def future_presentations(self):
503503
""" returns related SessionPresentation objects for meetings that

ietf/doc/views_search.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
from ietf.doc.expire import expirable_draft
4848
from ietf.group.models import Group
4949
from ietf.idindex.index import active_drafts_index_by_group
50-
from ietf.ipr.models import IprDocAlias
5150
from ietf.name.models import DocTagName, DocTypeName, StreamName
5251
from ietf.person.models import Person
5352
from ietf.utils.draft_search import normalize_draftname
@@ -136,41 +135,6 @@ def fill_in_search_attributes(docs):
136135
for e in DocEvent.objects.filter(doc__in=doc_ids, type__in=event_types).order_by('time'):
137136
docs_dict[e.doc_id].latest_event_cache[e.type] = e
138137

139-
# IPR
140-
for d in docs:
141-
d.iprs = []
142-
143-
# Consider reworking the following block using all_relations_that_doc? That might simplify the final assembly
144-
# down to the code at "if a not in docs_dict"...
145-
146-
rel_docs = []
147-
rel_id_camefrom = {}
148-
for d in docs:
149-
if isinstance(d,DocAlias):
150-
d = d.document
151-
rel_this_doc = d.all_related_that_doc(['replaces','obs'])
152-
for rel in rel_this_doc:
153-
rel_id_camefrom.setdefault(rel.document.pk,[]).append(d.pk)
154-
rel_docs += [x.document for x in rel_this_doc]
155-
156-
ipr_docaliases = IprDocAlias.objects.filter(doc_alias__document__in=doc_ids, ipr__status__in=[1,3]).select_related('doc_alias')
157-
for a in ipr_docaliases:
158-
if a.ipr not in docs_dict[a.doc_alias.document_id].iprs:
159-
docs_dict[a.doc_alias.document_id].iprs.append(a.ipr)
160-
161-
rel_docs_dict = dict((d.pk, d) for d in rel_docs)
162-
rel_doc_ids = rel_docs_dict.keys()
163-
rel_ipr_docaliases = IprDocAlias.objects.filter(doc_alias__document__in=rel_doc_ids, ipr__status__in=[1,3]).select_related('doc_alias')
164-
for a in rel_ipr_docaliases:
165-
if a.doc_alias.document_id in rel_id_camefrom:
166-
for k in rel_id_camefrom[a.doc_alias.document_id]:
167-
if a.ipr not in docs_dict[k].iprs:
168-
docs_dict[k].iprs.append(a.ipr)
169-
170-
# Clean up, make sure these temporary variables aren't used later
171-
# (so we can re-work the code in due time):
172-
del rel_docs, rel_id_camefrom, rel_docs_dict, rel_doc_ids, rel_ipr_docaliases
173-
174138
# telechat date, can't do this with above query as we need to get TelechatDocEvents out
175139
seen = set()
176140
for e in TelechatDocEvent.objects.filter(doc__in=doc_ids, type="scheduled_for_telechat").order_by('-time'):

ietf/ipr/admin.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django import forms
33
from django.contrib import admin
44
from ietf.name.models import DocRelationshipName
5-
from ietf.ipr.models import (IprNotification, IprDisclosureBase, IprDocRel, IprEvent,
5+
from ietf.ipr.models import (IprDisclosureBase, IprDocRel, IprEvent,
66
RelatedIpr, HolderIprDisclosure, ThirdPartyIprDisclosure, GenericIprDisclosure,
77
NonDocSpecificIprDisclosure)
88

@@ -85,10 +85,6 @@ def related_docs(self, obj):
8585

8686
admin.site.register(NonDocSpecificIprDisclosure, NonDocSpecificIprDisclosureAdmin)
8787

88-
class IprNotificationAdmin(admin.ModelAdmin):
89-
pass
90-
admin.site.register(IprNotification, IprNotificationAdmin)
91-
9288
class IprDocRelAdmin(admin.ModelAdmin):
9389
raw_id_fields = ["disclosure", "document"]
9490
admin.site.register(IprDocRel, IprDocRelAdmin)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('ipr', '0001_initial'),
11+
]
12+
13+
operations = [
14+
migrations.RemoveField(
15+
model_name='iprcontact',
16+
name='ipr',
17+
),
18+
migrations.DeleteModel(
19+
name='IprContact',
20+
),
21+
migrations.RemoveField(
22+
model_name='iprdocalias',
23+
name='doc_alias',
24+
),
25+
migrations.RemoveField(
26+
model_name='iprdocalias',
27+
name='ipr',
28+
),
29+
migrations.DeleteModel(
30+
name='IprDocAlias',
31+
),
32+
migrations.RemoveField(
33+
model_name='iprnotification',
34+
name='ipr',
35+
),
36+
migrations.DeleteModel(
37+
name='IprNotification',
38+
),
39+
migrations.RemoveField(
40+
model_name='iprupdate',
41+
name='ipr',
42+
),
43+
migrations.RemoveField(
44+
model_name='iprupdate',
45+
name='updated',
46+
),
47+
migrations.DeleteModel(
48+
name='IprDetail',
49+
),
50+
migrations.DeleteModel(
51+
name='IprUpdate',
52+
),
53+
]

ietf/ipr/models.py

Lines changed: 2 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,12 @@
11
# Copyright The IETF Trust 2007, All Rights Reserved
22

3-
from django.db import models
4-
5-
from ietf.doc.models import DocAlias
6-
7-
8-
LICENSE_CHOICES = (
9-
(0, ''),
10-
(1, 'a) No License Required for Implementers.'),
11-
(2, 'b) Royalty-Free, Reasonable and Non-Discriminatory License to All Implementers.'),
12-
(3, 'c) Reasonable and Non-Discriminatory License to All Implementers with Possible Royalty/Fee.'),
13-
(4, 'd) Licensing Declaration to be Provided Later (implies a willingness'
14-
' to commit to the provisions of a), b), or c) above to all implementers;'
15-
' otherwise, the next option "Unwilling to Commit to the Provisions of'
16-
' a), b), or c) Above". - must be selected).'),
17-
(5, 'e) Unwilling to Commit to the Provisions of a), b), or c) Above.'),
18-
(6, 'f) See Text Below for Licensing Declaration.'),
19-
)
20-
STDONLY_CHOICES = (
21-
(0, ""),
22-
(1, "The licensing declaration is limited solely to standards-track IETF documents."),
23-
)
24-
SELECT_CHOICES = (
25-
(0, 'NO'),
26-
(1, 'YES'),
27-
(2, 'NO'),
28-
)
29-
STATUS_CHOICES = (
30-
( 0, "Waiting for approval" ),
31-
( 1, "Approved and Posted" ),
32-
( 2, "Rejected by Administrator" ),
33-
( 3, "Removed by Request" ),
34-
)
35-
36-
class IprDetail(models.Model):
37-
ipr_id = models.AutoField(primary_key=True)
38-
title = models.CharField(blank=True, db_column="document_title", max_length=255)
39-
40-
# Legacy information fieldset
41-
legacy_url_0 = models.CharField(blank=True, null=True, db_column="old_ipr_url", max_length=255)
42-
legacy_url_1 = models.CharField(blank=True, null=True, db_column="additional_old_url1", max_length=255)
43-
legacy_title_1 = models.CharField(blank=True, null=True, db_column="additional_old_title1", max_length=255)
44-
legacy_url_2 = models.CharField(blank=True, null=True, db_column="additional_old_url2", max_length=255)
45-
legacy_title_2 = models.CharField(blank=True, null=True, db_column="additional_old_title2", max_length=255)
46-
47-
# Patent holder fieldset
48-
legal_name = models.CharField("Legal Name", db_column="p_h_legal_name", max_length=255)
49-
50-
# Patent Holder Contact fieldset
51-
# self.contact.filter(contact_type=1)
52-
53-
# IETF Contact fieldset
54-
# self.contact.filter(contact_type=3)
55-
56-
# Related IETF Documents fieldset
57-
rfc_number = models.IntegerField(null=True, editable=False, blank=True) # always NULL
58-
id_document_tag = models.IntegerField(null=True, editable=False, blank=True) # always NULL
59-
other_designations = models.CharField(blank=True, max_length=255)
60-
document_sections = models.TextField("Specific document sections covered", blank=True, max_length=255, db_column='disclouser_identify')
61-
62-
# Patent Information fieldset
63-
patents = models.TextField("Patent Applications", db_column="p_applications", max_length=255)
64-
date_applied = models.CharField(max_length=255)
65-
country = models.CharField(max_length=255)
66-
notes = models.TextField("Additional notes", db_column="p_notes", blank=True)
67-
is_pending = models.IntegerField("Unpublished Pending Patent Application", blank=True, null=True, choices=SELECT_CHOICES, db_column="selecttype")
68-
applies_to_all = models.IntegerField("Applies to all IPR owned by Submitter", blank=True, null=True, choices=SELECT_CHOICES, db_column="selectowned")
69-
70-
# Licensing Declaration fieldset
71-
licensing_option = models.IntegerField(null=True, blank=True, choices=LICENSE_CHOICES)
72-
lic_opt_a_sub = models.IntegerField(null=True, editable=False, choices=STDONLY_CHOICES)
73-
lic_opt_b_sub = models.IntegerField(null=True, editable=False, choices=STDONLY_CHOICES)
74-
lic_opt_c_sub = models.IntegerField(null=True, editable=False, choices=STDONLY_CHOICES)
75-
comments = models.TextField("Licensing Comments", blank=True)
76-
lic_checkbox = models.BooleanField("All terms and conditions has been disclosed", default=False)
77-
78-
79-
# Other notes fieldset
80-
other_notes = models.TextField(blank=True)
81-
82-
# Generated fields, not part of the submission form
83-
# Hidden fields
84-
third_party = models.BooleanField(default=False)
85-
generic = models.BooleanField(default=False)
86-
comply = models.BooleanField(default=False)
87-
88-
status = models.IntegerField(null=True, blank=True, choices=STATUS_CHOICES)
89-
submitted_date = models.DateField(blank=True)
90-
update_notified_date = models.DateField(null=True, blank=True)
91-
92-
def __unicode__(self):
93-
return self.title
94-
95-
@models.permalink
96-
def get_absolute_url(self):
97-
return ('ietf.ipr.views.show', [str(self.ipr_id)])
98-
99-
def get_submitter(self):
100-
try:
101-
return self.contact.get(contact_type=3)
102-
except IprContact.DoesNotExist:
103-
return None
104-
except IprContact.MultipleObjectsReturned:
105-
return self.contact.filter(contact_type=3)[0]
106-
107-
def docs(self):
108-
return self.iprdocalias_set.select_related("doc_alias", "doc_alias__document").order_by("id")
109-
110-
class IprContact(models.Model):
111-
TYPE_CHOICES = (
112-
(1, 'Patent Holder Contact'),
113-
(2, 'IETF Participant Contact'),
114-
(3, 'Submitter Contact'),
115-
)
116-
contact_id = models.AutoField(primary_key=True)
117-
ipr = models.ForeignKey(IprDetail, related_name="contact")
118-
contact_type = models.IntegerField(choices=TYPE_CHOICES)
119-
name = models.CharField(max_length=255)
120-
title = models.CharField(blank=True, max_length=255)
121-
department = models.CharField(blank=True, max_length=255)
122-
address1 = models.CharField(blank=True, max_length=255)
123-
address2 = models.CharField(blank=True, max_length=255)
124-
telephone = models.CharField(blank=True, max_length=25)
125-
fax = models.CharField(blank=True, max_length=25)
126-
email = models.EmailField(max_length=255)
127-
def __str__(self):
128-
return self.name or '<no name>'
129-
130-
131-
class IprNotification(models.Model):
132-
ipr = models.ForeignKey(IprDetail)
133-
notification = models.TextField(blank=True)
134-
date_sent = models.DateField(null=True, blank=True)
135-
time_sent = models.CharField(blank=True, max_length=25)
136-
def __str__(self):
137-
return "IPR notification for %s sent %s %s" % (self.ipr, self.date_sent, self.time_sent)
138-
139-
class IprUpdate(models.Model):
140-
ipr = models.ForeignKey(IprDetail, related_name='updates')
141-
updated = models.ForeignKey(IprDetail, db_column='updated', related_name='updated_by')
142-
status_to_be = models.IntegerField(null=True, blank=True)
143-
processed = models.IntegerField(null=True, blank=True)
144-
145-
146-
class IprDocAlias(models.Model):
147-
ipr = models.ForeignKey(IprDetail)
148-
doc_alias = models.ForeignKey(DocAlias)
149-
rev = models.CharField(max_length=2, blank=True)
150-
151-
def formatted_name(self):
152-
name = self.doc_alias.name
153-
if name.startswith("rfc"):
154-
return name.upper()
155-
elif self.rev:
156-
return "%s-%s" % (name, self.rev)
157-
else:
158-
return name
159-
160-
def __unicode__(self):
161-
if self.rev:
162-
return u"%s which applies to %s-%s" % (self.ipr, self.doc_alias.name, self.rev)
163-
else:
164-
return u"%s which applies to %s" % (self.ipr, self.doc_alias.name)
165-
166-
class Meta:
167-
verbose_name = "IPR document alias"
168-
verbose_name_plural = "IPR document aliases"
169-
170-
# ===================================
171-
# New Models
172-
# ===================================
173-
1743
import datetime
1754

1765
from django.conf import settings
1776
from django.core.urlresolvers import reverse
7+
from django.db import models
1788

9+
from ietf.doc.models import DocAlias
17910
from ietf.name.models import DocRelationshipName,IprDisclosureStateName,IprLicenseTypeName,IprEventTypeName
18011
from ietf.person.models import Person
18112
from ietf.message.models import Message

0 commit comments

Comments
 (0)