Skip to content

Commit f1e70cb

Browse files
committed
Some ipr/model.py field re-arranging to make the admin interface come out nicer
- Legacy-Id: 110
1 parent d6b3281 commit f1e70cb

4 files changed

Lines changed: 63 additions & 35 deletions

File tree

ietf/idtracker/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ class DocumentComment(models.Model):
414414
version = models.CharField(blank=True, maxlength=3)
415415
comment_text = models.TextField(blank=True)
416416
created_by = models.ForeignKey(IESGLogin, db_column='created_by', null=True)
417-
result_state = models.ForeignKey(IDState, db_column='result_state', null=True, related_name=None)
418-
origin_state = models.ForeignKey(IDState, db_column='origin_state', null=True, related_name=None)
417+
result_state = models.ForeignKey(IDState, db_column='result_state', null=True, related_name="comments_leading_to_state")
418+
origin_state = models.ForeignKey(IDState, db_column='origin_state', null=True, related_name="comments_coming_from_state")
419419
ballot = models.IntegerField(null=True, choices=BALLOT_CHOICES)
420420
def get_absolute_url(self):
421421
if self.rfc_flag:

ietf/ipr/models.py

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# New field classes
1111

1212
phone_re = re.compile(r'^\+?[0-9 ]*(\([0-9]+\))?[0-9 -]+$')
13-
class InternationalPhoneNumberField(models.PhoneNumberField):
13+
class InternationalPhoneNumberField(models.CharField):
1414
error_message = 'Phone numbers may have a leading "+", and otherwise only contain numbers [0-9], dash, space, and parentheses. '
1515
def validate(self, field_data, all_data):
1616
if not phone_re.search(field_data):
@@ -77,38 +77,59 @@ class Admin:
7777

7878
class IprDetail(models.Model):
7979
ipr_id = models.AutoField(primary_key=True)
80-
p_h_legal_name = models.CharField("Legal Name", maxlength=255)
8180
document_title = models.CharField(blank=True, maxlength=255)
82-
rfc_number = models.IntegerField(null=True, editable=False, blank=True) # always NULL
83-
id_document_tag = models.IntegerField(null=True, editable=False, blank=True) # always NULL
84-
other_designations = models.CharField(blank=True, maxlength=255)
85-
p_applications = models.TextField(blank=True, maxlength=255)
86-
date_applied = models.CharField(blank=True, maxlength=255)
87-
#selecttype = models.ForeignKey(IprSelecttype, to_field='selecttype', db_column='selecttype')
88-
selecttype = models.IntegerField(null=True, choices=SELECT_CHOICES)
89-
discloser_identify = models.TextField(blank=True, maxlength=255, db_column='disclouser_identify')
90-
#licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option')
91-
licensing_option = models.IntegerField(null=True, blank=True, choices=LICENSE_CHOICES)
92-
other_notes = models.TextField(blank=True)
93-
submitted_date = models.DateField(null=True, blank=True)
94-
status = models.IntegerField(null=True, blank=True)
95-
comments = models.TextField(blank=True)
81+
82+
# Legacy information fieldset
9683
old_ipr_url = models.CharField(blank=True, maxlength=255)
9784
additional_old_title1 = models.CharField(blank=True, maxlength=255)
9885
additional_old_url1 = models.CharField(blank=True, maxlength=255)
9986
additional_old_title2 = models.CharField(blank=True, maxlength=255)
10087
additional_old_url2 = models.CharField(blank=True, maxlength=255)
88+
89+
# Patent holder fieldset
90+
p_h_legal_name = models.CharField("Legal Name", maxlength=255)
91+
92+
# Patent Holder Contact fieldset
93+
# self.contacts.filter(contact_type=1)
94+
95+
# IETF Contact fieldset
96+
# self.contacts.filter(contact_type=1)
97+
98+
# Related IETF Documents fieldset
99+
rfc_number = models.IntegerField(null=True, editable=False, blank=True) # always NULL
100+
id_document_tag = models.IntegerField(null=True, editable=False, blank=True) # always NULL
101+
other_designations = models.CharField(blank=True, maxlength=255)
102+
discloser_identify = models.TextField("Specific document sections covered", blank=True, maxlength=255, db_column='disclouser_identify')
103+
104+
# Patent Information fieldset
105+
p_applications = models.TextField("Patent Applications", blank=True, maxlength=255)
106+
date_applied = models.CharField(blank=True, maxlength=255)
101107
country = models.CharField(blank=True, maxlength=100)
102-
p_notes = models.TextField(blank=True)
103-
third_party = models.BooleanField(editable=False)
108+
p_notes = models.TextField("Additional notes", blank=True)
109+
selecttype = models.IntegerField("Unpublished Pending Patent Application", null=True, choices=SELECT_CHOICES)
110+
selectowned = models.IntegerField("Applies to all IPR owned by Submitter", null=True, blank=True, choices=SELECT_CHOICES)
111+
112+
# Licensing Declaration fieldset
113+
#licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option')
114+
licensing_option = models.IntegerField(null=True, blank=True, choices=LICENSE_CHOICES)
104115
lic_opt_a_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
105116
lic_opt_b_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
106117
lic_opt_c_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
107-
generic = models.BooleanField(editable=False)
108-
selectowned = models.IntegerField(null=True, blank=True, choices=SELECT_CHOICES)
118+
comments = models.TextField("Licensing Comments", blank=True)
119+
lic_checkbox = models.BooleanField("All terms and conditions has been disclosed")
120+
121+
third_party = models.BooleanField(editable=False)
122+
123+
# Other notes fieldset
124+
other_notes = models.TextField(blank=True)
125+
126+
# Generated fields, not part of the submission form
127+
status = models.IntegerField(null=True, blank=True)
109128
comply = models.BooleanField(editable=False)
110-
lic_checkbox = models.BooleanField()
129+
generic = models.BooleanField(editable=False)
130+
submitted_date = models.DateField(null=True, blank=True)
111131
update_notified_date = models.DateField(null=True, blank=True)
132+
112133
def __str__(self):
113134
return self.document_title
114135
def selecttypetext(self):
@@ -136,8 +157,8 @@ def get_submitter(self):
136157
return self.contact.filter(contact_type=3)[0]
137158
except:
138159
return None
139-
def get_absolute_url(self, item):
140-
return "http://merlot.tools.ietf.org:31415/ipr/ipr-%s" % ipr_id
160+
def get_absolute_url(self):
161+
return "/ipr/ipr-%s" % self.ipr_id
141162
class Meta:
142163
db_table = 'ipr_detail'
143164
class Admin:
@@ -150,16 +171,16 @@ class IprContact(models.Model):
150171
('3', 'Submitter Contact'),
151172
)
152173
contact_id = models.AutoField(primary_key=True)
153-
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, editable=False, related_name="contact")
154-
contact_type = models.IntegerField(editable=False, choices=TYPE_CHOICES)
155-
name = models.CharField(maxlength=255)
174+
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, edit_inline=True, related_name="contact")
175+
contact_type = models.IntegerField(choices=TYPE_CHOICES)
176+
name = models.CharField(maxlength=255, core=True)
156177
title = models.CharField(blank=True, maxlength=255)
157178
department = models.CharField(blank=True, maxlength=255)
158179
address1 = models.CharField(blank=True, maxlength=255)
159180
address2 = models.CharField(blank=True, maxlength=255)
160-
telephone = InternationalPhoneNumberField(maxlength=25)
181+
telephone = InternationalPhoneNumberField(maxlength=25, core=True)
161182
fax = InternationalPhoneNumberField(blank=True, maxlength=25)
162-
email = models.EmailField(maxlength=255)
183+
email = models.EmailField(maxlength=255, core=True)
163184
def __str__(self):
164185
return self.name
165186
class Meta:
@@ -170,8 +191,8 @@ class Admin:
170191

171192

172193
class IprDraft(models.Model):
173-
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', raw_id_admin=True)
174-
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, related_name='drafts')
194+
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', raw_id_admin=True, core=True)
195+
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, edit_inline=True, related_name='drafts')
175196
revision = models.CharField(maxlength=2)
176197
def __str__(self):
177198
return "%s applies to %s-%s" % ( self.ipr, self.document, self.revision )
@@ -193,8 +214,8 @@ class Admin:
193214
pass
194215

195216
class IprRfc(models.Model):
196-
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, related_name='rfcs')
197-
rfc_number = models.ForeignKey(Rfc, db_column='rfc_number', raw_id_admin=True)
217+
ipr = models.ForeignKey(IprDetail, edit_inline=True, related_name='rfcs')
218+
rfc_number = models.ForeignKey(Rfc, db_column='rfc_number', raw_id_admin=True, core=True)
198219
def __str__(self):
199220
return "%s applies to RFC%04d" % ( self.ipr, self.rfc_number )
200221
class Meta:

ietf/ipr/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ def __init__(self, *args, **kw):
132132
if contact in section_list:
133133
self.base_fields[contact] = ContactForm(prefix=contact[:4], *args, **kw)
134134
BaseIprForm.__init__(self, *args, **kw)
135+
# Special validation code
136+
def clean(self):
137+
# Required:
138+
# Submitter form filled in or 'same-as-ietf-contact' marked
139+
# Only one of rfc, draft, and other info fields filled in
140+
# RFC exists or draft exists and has right rev. or ...
141+
pass
135142

136143
if request.method == 'POST':
137144
form = IprForm(request.POST)

ietf/templates/ipr/style.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
input[type="checkbox"] { width: auto; }
2323
input[type="submit"] { width: auto; }
2424
textarea { width: 72ex; height: 5em; font-family: sans-serif; font-size: 11pt; font-weight: normal; }
25-
.required { color: red; float: right; padding-top: 1ex; }
25+
.required { color: red; float: right; padding-top: 0.7ex; font-size: 130%; }
2626
.errorlist { background: red; padding: 0 0 0 2px; border: 0px; margin: 0px; }
2727
</style>

0 commit comments

Comments
 (0)