Skip to content

Commit c2c08c9

Browse files
committed
* Added a new funtion in utils.py: split_form()
* Re-wrote the IPR declaration form using form.to_table() and the split_form() function in order to get sub-blocks of the form which could easily be used with the existing IPR detail display templates. How to merge forms from multiple models took some thinking; since the forms have a common ancestor, multiple inheritance doesn't preserve the form data. In the end the merging didn't turn out too horrible. See ipr.views.new(). * Changed the IprDetail model; first to specify editable=False for all fieleds which shouldn't be shown in the form, but this has the drawback of also removing them from the admin page form. Simply bagging them in an un-used sub block with split_form() works fine. * Changed the URLs for IPR by-date some again * Updated the ipr/new* templates to use the form sub-blocks - Legacy-Id: 97
1 parent 5872696 commit c2c08c9

7 files changed

Lines changed: 149 additions & 97 deletions

File tree

ietf/ipr/models.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class Admin:
4646

4747
class IprDetail(models.Model):
4848
ipr_id = models.AutoField(primary_key=True)
49-
p_h_legal_name = models.CharField("Patent Holder's Legal Name", blank=True, maxlength=255)
49+
p_h_legal_name = models.CharField("Legal Name", blank=True, maxlength=255)
5050
document_title = models.CharField(blank=True, maxlength=255)
51-
rfc_number = models.IntegerField(null=True, blank=True) # always NULL
52-
id_document_tag = models.IntegerField(null=True, blank=True) # always NULL
51+
rfc_number = models.IntegerField(null=True, editable=False, blank=True) # always NULL
52+
id_document_tag = models.IntegerField(null=True, editable=False, blank=True) # always NULL
5353
other_designations = models.CharField(blank=True, maxlength=255)
5454
p_applications = models.TextField(blank=True, maxlength=255)
5555
date_applied = models.CharField(blank=True, maxlength=255)
@@ -69,14 +69,13 @@ class IprDetail(models.Model):
6969
additional_old_url2 = models.CharField(blank=True, maxlength=255)
7070
country = models.CharField(blank=True, maxlength=100)
7171
p_notes = models.TextField(blank=True)
72-
third_party = models.BooleanField()
73-
lic_opt_a_sub = models.IntegerField(choices=STDONLY_CHOICES)
74-
lic_opt_b_sub = models.IntegerField(choices=STDONLY_CHOICES)
75-
lic_opt_c_sub = models.IntegerField(choices=STDONLY_CHOICES)
76-
generic = models.BooleanField()
77-
# I don't understand selectowned, it looks like it should be a boolean field.
72+
third_party = models.BooleanField(editable=False)
73+
lic_opt_a_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
74+
lic_opt_b_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
75+
lic_opt_c_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
76+
generic = models.BooleanField(editable=False)
7877
selectowned = models.IntegerField(null=True, blank=True, choices=SELECT_CHOICES)
79-
comply = models.BooleanField()
78+
comply = models.BooleanField(editable=False)
8079
lic_checkbox = models.BooleanField()
8180
update_notified_date = models.DateField(null=True, blank=True)
8281
def __str__(self):
@@ -103,16 +102,16 @@ class IprContact(models.Model):
103102
('3', 'Submitter Contact'),
104103
)
105104
contact_id = models.AutoField(primary_key=True)
106-
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, related_name="contact")
107-
contact_type = models.IntegerField(choices=TYPE_CHOICES)
105+
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, editable=False, related_name="contact")
106+
contact_type = models.IntegerField(editable=False, choices=TYPE_CHOICES)
108107
name = models.CharField(maxlength=255)
109108
title = models.CharField(blank=True, maxlength=255)
110109
department = models.CharField(blank=True, maxlength=255)
110+
address1 = models.CharField(blank=True, maxlength=255)
111+
address2 = models.CharField(blank=True, maxlength=255)
111112
telephone = models.CharField(maxlength=25)
112113
fax = models.CharField(blank=True, maxlength=25)
113114
email = models.CharField(maxlength=255)
114-
address1 = models.CharField(blank=True, maxlength=255)
115-
address2 = models.CharField(blank=True, maxlength=255)
116115
def __str__(self):
117116
return self.name
118117
class Meta:

ietf/ipr/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
archive = {'queryset':queryset, 'date_field': 'submitted_date', 'allow_empty':True }
1515

1616
urlpatterns += patterns('django.views.generic.date_based',
17+
(r'^by-date/$', 'archive_index', archive),
1718
(r'^(?P<year>\d{4})/$', 'archive_year', archive),
1819
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', archive),
1920
)

ietf/ipr/views.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import models
22
from django.shortcuts import render_to_response as render
33
import django.newforms as forms
4+
import ietf.utils
45

56
def default(request):
67
"""Default page, with links to sub-pages"""
@@ -62,35 +63,45 @@ def update(request, ipr_id=None):
6263
def new(request, type):
6364
"""Form to make a new IPR disclosure"""
6465
debug = ""
65-
66+
sections = {
67+
"section1": "p_h_legal_name ",
68+
"section2": "ph_name ph_title ph_department ph_address1 ph_address2 ph_telephone ph_fax ph_email",
69+
"section3": "ietf_name ietf_title ietf_department ietf_address1 ietf_address2 ietf_telephone ietf_fax ietf_email",
70+
"section4": "rfclist draftlist other_designations",
71+
"section5": "p_applications date_applied country selecttype p_notes discloser_identify",
72+
"section6": "licensing_option stdonly_license comments lic_checkbox selectowned",
73+
"section7": "sub_name sub_title sub_department sub_address1 sub_address2 sub_telephone sub_fax sub_email",
74+
"section8": "other_notes",
75+
"ignore" : "document_title rfc_number id_document_tag submitted_date status " +
76+
"old_ipr_url additional_old_title1 additional_old_title2 " +
77+
"additional_old_url1 additional_old_url2 update_notified_date",
78+
}
6679
IprForm = forms.form_for_model(models.IprDetail, formfield_callback=detail_field_fixup)
80+
ContactForm = forms.form_for_model(models.IprContact)
81+
82+
# It would be nicer if we could use mixin subclassing, but that won't
83+
# work with multiple classes with the same elements.
84+
for prefix in ["ph", "ietf", "sub"]:
85+
for field in ContactForm.base_fields:
86+
IprForm.base_fields[prefix + "_" + field] = ContactForm.base_fields[field]
87+
6788
# Some extra fields which will get post-processing to generate the IprRfcs
6889
# and IprDrafts entries which go into the database:
6990
IprForm.base_fields["rfclist"] = forms.CharField(required=False)
7091
IprForm.base_fields["draftlist"] = forms.CharField(required=False)
7192
IprForm.base_fields["stdonly_license"] = forms.BooleanField(required=False)
7293

73-
ContactForm = forms.form_for_model(models.IprContact)
74-
7594
if request.method == 'POST':
7695
form = IprForm(request.POST)
77-
78-
form.holder_contact = ContactForm(request.POST, prefix="ph")
79-
form.ietf_contact = ContactForm(request.POST, prefix="ietf")
80-
form.submitter = ContactForm(request.POST, prefix="sub")
81-
8296
if form.is_valid():
8397
form.save()
8498
return HttpResponseRedirect("/ipr/")
8599
else:
86100
form = IprForm()
87-
form.holder_contact = ContactForm(prefix="ph")
88-
form.ietf_contact = ContactForm(prefix="ietf")
89-
form.submitter = ContactForm(prefix="sub")
90101

91-
form.unbound_form = not form.is_bound
92-
form.disclosure_type = type.capitalize()
93-
return render("ipr/new_%s.html" % type, {"ipr": form, "debug": debug, })
102+
blocks = ietf.utils.split_form(form.as_table(), sections )
103+
104+
return render("ipr/new_%s.html" % type, {"ipr": form, "form": blocks})
94105

95106
def detail_field_fixup(field):
96107
if field.name == "licensing_option":

ietf/templates/ipr/details.html

Lines changed: 50 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
input { width: 72ex; font-family: sans-serif; font-size: 11pt; font-weight: normal; }
2525
input[type="radio"] { width: auto; }
2626
input[type="checkbox"] { width: auto; }
27+
input[type="submit"] { width: auto; }
2728
textarea { width: 72ex; height: 5em; font-family: sans-serif; font-size: 11pt; font-weight: normal; }
2829
.required { color: red; }
2930
</style>
@@ -113,7 +114,9 @@ <h3>{{ ipr.document_title }}</h3>
113114
</th>
114115
</tr>
115116
<tr>
117+
{% block section1_data %}
116118
<td class="fixwidth">Legal Name:</td> <td><b> {{ ipr.p_h_legal_name }} </b></td>
119+
{% endblock %}
117120
</tr>
118121
</table>
119122
</blockquote>
@@ -128,6 +131,7 @@ <h3>{{ ipr.document_title }}</h3>
128131
Patent Holder's Contact for License Application
129132
</th>
130133
</tr>
134+
{% block section2_data %}
131135
<tr><td class="fixwidth">Name:</td> <td><b>{{ ipr.holder_contact.name }}</b></td></tr>
132136
<tr><td class="fixwidth">Title:</td> <td><b>{{ ipr.holder_contact.title }}</b></td></tr>
133137
<tr><td class="fixwidth">Department:</td> <td><b>{{ ipr.holder_contact.department }}</b></td></tr>
@@ -136,13 +140,14 @@ <h3>{{ ipr.document_title }}</h3>
136140
<tr><td class="fixwidth">Telephone:</td> <td><b>{{ ipr.holder_contact.telephone }}</b></td></tr>
137141
<tr><td class="fixwidth">Fax:</td> <td><b>{{ ipr.holder_contact.fax }}</b></td></tr>
138142
<tr><td class="fixwidth">Email:</td> <td><b>{{ ipr.holder_contact.email }}</b></td></tr>
143+
{% endblock %}
139144
</table>
140145
</blockquote>
141146
{% endblock %}
142147

143148

144149
{% block section3 %}
145-
{% if ipr.unbound_form or not ipr.old_ipr_url %}
150+
{% if not ipr.is_bound or not ipr.old_ipr_url %}
146151
<blockquote class="{% cycle parity %}">
147152
<table border="0" cellpadding="0" cellspacing="0" class="ipr person">
148153
<tr>
@@ -151,6 +156,7 @@ <h3>{{ ipr.document_title }}</h3>
151156
Contact Information for the IETF Participant Whose Personal Belief Triggered this Disclosure:
152157
</th>
153158
</tr>
159+
{% block section3_data %}
154160
{% if ipr.unbond_form or ipr.ietf_contact.name %}
155161
<tr><td class="fixwidth">Name:</td> <td><b>{{ ipr.ietf_contact.name }}</b></td></tr>
156162
<tr><td class="fixwidth">Title:</td> <td><b>{{ ipr.ietf_contact.title }}</b></td></tr>
@@ -163,6 +169,7 @@ <h3>{{ ipr.document_title }}</h3>
163169
{% else %}
164170
<tr><td colspan="2"><i>No information submitted</td></tr>
165171
{% endif %}
172+
{% endblock %}
166173
</table>
167174
</blockquote>
168175
{% else %}
@@ -180,29 +187,23 @@ <h3>{{ ipr.document_title }}</h3>
180187
IETF Document or Other Contribution to Which this IPR Disclosure Relates:
181188
</th>
182189
</tr>
183-
{% if ipr.unbound_form %}
184-
<tr><td class="fixwidth">RFC Number(s) (Numeric value only):</td><td>{{ ipr.rfclist }}</td></tr>
185-
{% else %}
190+
{% block section4_data %}
186191
{% for rfc in ipr.rfcs.all %}
187192
<tr><td class="fixwidth"><b>RFC {{ rfc.rfc_number.rfc_number }}:</b></td><td><b>"{{ rfc.rfc_number.rfc_name }}"</b></td></tr>
188193
{% endfor %}
189-
{% endif %}
190-
<!-- XXX: Omitting code to display information from the rfc_number field of ipr here, as it's always NULL in the database today. -->
191-
{% if ipr.unbound_form %}
192-
<tr><td class="fixwidth">I-D filename(s) (draft-...):</td><td><b>{{ ipr.draftlist }}</b></td></tr>
193-
{% else %}
194+
<!-- XXX: Omitting code to display information from the rfc_number field of ipr here, as it's always NULL in the database today. -->
194195
{% for draft in ipr.drafts.all %}
195196
<tr><td class="fixwidth">Internet-Draft:</td><td><b>"{{ draft.document.id_document_name }}"<br />(<tt><big>{{ draft.document.filename }}-{{ draft.document.revision }}</big></tt>)</b></td></tr>
196197
{% endfor %}
197-
{% endif %}
198-
{% if ipr.unbound_form or ipr.other_designations %}
198+
{% if ipr.other_designations %}
199199
<tr><td class="fixwidth">Designations for Other Contributions:</td><td><b>{{ ipr.other_designations }}</b></td></tr>
200-
{% endif %}
200+
{% endif %}
201+
{% endblock %}
201202
</table>
202203
</blockquote>
203204
{% endblock %}
204205

205-
{% if ipr.unbound_form or not ipr.old_ipr_url %}
206+
{% if not ipr.is_bound or not ipr.old_ipr_url %}
206207

207208
{% block section5 %}
208209
<blockquote class="{% cycle parity %}">
@@ -214,34 +215,24 @@ <h3>{{ ipr.document_title }}</h3>
214215
applications required to be disclosed by Section 6 of RFC 3979)
215216
</th>
216217
</tr>
217-
{% if ipr.unbound_form or ipr.p_applications or ipr.p_notes %}
218-
<tr>
219-
<td colspan="2"><i>
220-
A. For granted patents or published pending patent applications,
221-
please provide the following information:</i></td>
222-
</tr>
223-
<tr><td>Patent, Serial, Publication, Registration,
224-
or Application/File number(s):</td><td><b>{{ ipr.p_applications }}</b></td></tr>
225-
<tr><td>Date(s) granted or applied for: </td><td><b>{{ ipr.date_applied }}</b></td></tr>
226-
<tr><td>Country: </td><td><b>{{ ipr.country }}</b></td></tr>
227-
{% if ipr.unbound_form %}
228-
<tr><td>Additional Notes: </td><td><b>{{ ipr.p_notes }}</b></td></tr>
229-
{% else %}
230-
<tr><td>Additional Notes: </td><td><b>{{ ipr.p_notes|escape|linebreaks }}</b></td></tr>
231-
{% endif %}
232-
<tr>
233-
<td colspan="2"><i>
234-
B. Does this disclosure relate to an unpublished pending patent
235-
application?: </i>
236-
<b>{{ ipr.get_selecttype_display }}</b>
237-
</tr>
238-
{% if ipr.unbound_form %}
239-
<tr><td></td>
240-
<td>
241-
{{ ipr.selecttype }}
242-
</td>
243-
</tr>
244-
{% endif %}
218+
{% block section5_data %}
219+
{% if ipr.p_applications or ipr.p_notes %}
220+
<tr>
221+
<td colspan="2"><i>
222+
A. For granted patents or published pending patent applications,
223+
please provide the following information:</i></td>
224+
</tr>
225+
<tr><td>Patent, Serial, Publication, Registration,
226+
or Application/File number(s):</td><td><b>{{ ipr.p_applications }}</b></td></tr>
227+
<tr><td>Date(s) granted or applied for: </td><td><b>{{ ipr.date_applied }}</b></td></tr>
228+
<tr><td>Country: </td><td><b>{{ ipr.country }}</b></td></tr>
229+
<tr><td>Additional Notes: </td><td><b>{{ ipr.p_notes|escape|linebreaks }}</b></td></tr>
230+
<tr>
231+
<td colspan="2"><i>
232+
B. Does this disclosure relate to an unpublished pending patent
233+
application?: </i>
234+
<b>{{ ipr.get_selecttype_display }}</b>
235+
</tr>
245236
{% block clause5c %}
246237
<tr>
247238
<td colspan="2"><i>
@@ -253,19 +244,16 @@ <h3>{{ ipr.document_title }}</h3>
253244
covered:</i>
254245
</td>
255246
</tr>
256-
{% if ipr.unbound_form %}
257-
<tr><td class="fixwidth"> </td><td><b>{{ ipr.discloser_identify }}</b></td></tr>
247+
{% if ipr.discloser_identify %}
248+
<tr><td class="fixwidth"> </td><td><b>{{ ipr.discloser_identify|escape|linebreaks }}</b></td></tr>
258249
{% else %}
259-
{% if ipr.discloser_identify %}
260-
<tr><td class="fixwidth"> </td><td><b>{{ ipr.discloser_identify|escape|linebreaks }}</b></td></tr>
261-
{% else %}
262-
<tr><td class="fixwidth"> </td><td><i>No information submitted</i></td></tr>
263-
{% endif %}
250+
<tr><td class="fixwidth"> </td><td><i>No information submitted</i></td></tr>
264251
{% endif %}
265252
{% endblock %}
266253
{% else %}
267254
<tr><td class="fixwidth"></td><td><b>This disclosure relates to an unpublished pending patent application.</b></td></tr>
268255
{% endif %}
256+
{% endblock %}
269257
</table>
270258
</blockquote>
271259
{% endblock %}
@@ -290,46 +278,37 @@ <h3>{{ ipr.document_title }}</h3>
290278
specification, is as follows(select one licensing declaration option only):</i>
291279
</td>
292280
</tr>
281+
{% block section6_data %}
293282
<tr>
294283
<td> </td><td>
295-
{% if ipr.unbound_form %}
296-
{{ ipr.licensing_option }}
297-
{{ ipr.stdonly_license }}
298-
This licensing declaration is limited solely to standards-track IETF documents.
299-
{% else %}
300284
<b>{{ ipr.get_licensing_option_display }}<br/>
301285
{{ ipr.get_lic_opt_a_sub_display }}
302286
{{ ipr.get_lic_opt_b_sub_display }}
303287
{{ ipr.get_lic_opt_c_sub_display }}</b>
304-
{% endif %}
305288
</td>
306289
</tr>
307290
<tr>
308291
<td colspan="2">
309292
<i>Licensing information, comments, notes, or URL for further information:</i>
310293
</td>
311294
</tr>
312-
{% if ipr.unbound_form %}
313-
<tr><td class="fixwidth"> </td><td><b>{{ ipr.comments }}</b></td></tr>
295+
{% if ipr.comments %}
296+
<tr><td class="fixwidth"> </td><td><b>{{ ipr.comments|escape|linebreaks }}</b></td></tr>
314297
{% else %}
315-
{% if ipr.comments %}
316-
<tr><td class="fixwidth"> </td><td><b>{{ ipr.comments|escape|linebreaks }}</b></td></tr>
317-
{% else %}
318-
<tr><td class="fixwidth"> </td><td><i>No information submitted</td></tr>
319-
{% endif %}
298+
<tr><td class="fixwidth"> </td><td><i>No information submitted</i></td></tr>
320299
{% endif %}
321300

322-
{% if ipr.unbound_form or ipr.lic_checkbox %}
301+
{% if ipr.lic_checkbox %}
323302
<tr>
324303
<td colspan="2">
325-
{% if ipr.unbound_form %} {{ ipr.lic_checkbox }} {% endif %}
326304
The individual submitting this template represents and warrants that all
327305
terms and conditions that must be satisfied for implementers of any
328306
covered IETF specification to obtain a license have been disclosed in this
329307
IPR disclosure statement.
330308
</td>
331309
</tr>
332310
{% endif %}
311+
{% endblock %}
333312
<tr>
334313
<td colspan="2">
335314
<b><i>Note: The individual submitting this template represents and warrants
@@ -352,7 +331,8 @@ <h3>{{ ipr.document_title }}</h3>
352331
IETF Participant in Section III above)
353332
</th>
354333
</tr>
355-
{% if ipr.unbound_form or ipr.submitter.name %}
334+
{% block section7_data %}
335+
{% if ipr.submitter.name %}
356336
<tr><td class="fixwidth">Name:</td> <td><b>{{ ipr.submitter.name }}</b></td></tr>
357337
<tr><td class="fixwidth">Title:</td> <td><b>{{ ipr.submitter.title }}</b></td></tr>
358338
<tr><td class="fixwidth">Department:</td> <td><b>{{ ipr.submitter.department }}</b></td></tr>
@@ -364,6 +344,7 @@ <h3>{{ ipr.document_title }}</h3>
364344
{% else %}
365345
<tr><td colspan="2"><i>No information submitted</td></tr>
366346
{% endif %}
347+
{% endblock %}
367348
</table>
368349
</blockquote>
369350
{% endblock %}
@@ -378,19 +359,20 @@ <h3>{{ ipr.document_title }}</h3>
378359
Other Notes:
379360
</th>
380361
</tr>
381-
{% if ipr.unbound_form %}
382-
<tr><td class="fixwidth"> </td><td><b>{{ ipr.other_notes }}</b></td></tr>
383-
{% else %}
362+
{% block section8_data %}
384363
{% if ipr.other_notes %}
385364
<tr><td> </td><td><b>{{ ipr.other_notes|escape|linebreaks }}</b></td></tr>
386365
{% else %}
387366
<tr><td colspan="2"><i>No information submitted</i></td></tr>
388367
{% endif %}
389-
{% endif %}
368+
{% endblock %}
390369
</table>
391370
</blockquote>
392371
{% endblock %}
393372

394373
{% endif %}
395374
{{ debug }}
375+
376+
{% block bot_info %}
377+
{% endblock %}
396378
{% endblock %}

0 commit comments

Comments
 (0)