From 6829830b5910a3b1f30e09a61f2ee531f48fae4a Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sun, 17 Jun 2007 15:53:39 +0000 Subject: [PATCH] Name changes for IprDetail model fields. - Legacy-Id: 477 --- ietf/ipr/models.py | 58 ++++++++++--------------------- ietf/ipr/view_new.py | 2 +- ietf/ipr/views.py | 14 ++++---- ietf/templates/ipr/details.html | 24 ++++++------- ietf/templates/ipr/list_item.html | 8 ++--- 5 files changed, 43 insertions(+), 63 deletions(-) diff --git a/ietf/ipr/models.py b/ietf/ipr/models.py index c6c5ca758..8e2dba4f5 100644 --- a/ietf/ipr/models.py +++ b/ietf/ipr/models.py @@ -23,12 +23,17 @@ SELECT_CHOICES = ( ("1", 'YES'), ("2", 'NO'), ) - +STATUS_CHOICES = ( + ( 0, "Waiting for approval" ), + ( 1, "Approved and Posted" ), + ( 2, "Rejected by Administrator" ), + ( 3, "Removed by Request" ), +) # not clear why this has both an ID and selecttype # Also not clear why a table for "YES" and "NO". class IprSelecttype(models.Model): type_id = models.AutoField(primary_key=True) - selecttype = models.IntegerField(unique=True) + is_pending = models.IntegerField(unique=True, db_column="selecttype") type_display = models.CharField(blank=True, maxlength=15) def __str__(self): return self.type_display @@ -50,14 +55,14 @@ class IprLicensing(models.Model): class IprDetail(models.Model): ipr_id = models.AutoField(primary_key=True) - document_title = models.CharField(blank=True, maxlength=255) + title = models.CharField(blank=True, db_column="document_title", maxlength=255) # Legacy information fieldset - old_ipr_url = models.CharField(blank=True, maxlength=255) - additional_old_title1 = models.CharField(blank=True, maxlength=255) - additional_old_url1 = models.CharField(blank=True, maxlength=255) - additional_old_title2 = models.CharField(blank=True, maxlength=255) - additional_old_url2 = models.CharField(blank=True, maxlength=255) + legacy_url_0 = models.CharField(blank=True, db_column="old_ipr_url", maxlength=255) + legacy_url_1 = models.CharField(blank=True, db_column="additional_old_url1", maxlength=255) + legacy_title_1 = models.CharField(blank=True, db_column="additional_old_title1", maxlength=255) + legacy_url_2 = models.CharField(blank=True, db_column="additional_old_url2", maxlength=255) + legacy_title_2 = models.CharField(blank=True, db_column="additional_old_title2", maxlength=255) # Patent holder fieldset legal_name = models.CharField("Legal Name", db_column="p_h_legal_name", maxlength=255) @@ -72,15 +77,15 @@ class IprDetail(models.Model): rfc_number = models.IntegerField(null=True, editable=False, blank=True) # always NULL id_document_tag = models.IntegerField(null=True, editable=False, blank=True) # always NULL other_designations = models.CharField(blank=True, maxlength=255) - discloser_identify = models.TextField("Specific document sections covered", blank=True, maxlength=255, db_column='disclouser_identify') + document_sections = models.TextField("Specific document sections covered", blank=True, maxlength=255, db_column='disclouser_identify') # Patent Information fieldset - p_applications = models.TextField("Patent Applications", maxlength=255) + patents = models.TextField("Patent Applications", db_column="p_applications", maxlength=255) date_applied = models.CharField(maxlength=255) country = models.CharField(maxlength=100) - p_notes = models.TextField("Additional notes", blank=True) - selecttype = models.IntegerField("Unpublished Pending Patent Application", blank=True, choices=SELECT_CHOICES) - selectowned = models.IntegerField("Applies to all IPR owned by Submitter", blank=True, choices=SELECT_CHOICES) + notes = models.TextField("Additional notes", db_column="p_notes", blank=True) + is_pending = models.IntegerField("Unpublished Pending Patent Application", blank=True, choices=SELECT_CHOICES, db_column="selecttype") + applies_to_all = models.IntegerField("Applies to all IPR owned by Submitter", blank=True, choices=SELECT_CHOICES, db_column="selectowned") # Licensing Declaration fieldset #licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option') @@ -101,37 +106,12 @@ class IprDetail(models.Model): generic = models.BooleanField() comply = models.BooleanField() - status = models.IntegerField(null=True, blank=True) + status = models.IntegerField(null=True, blank=True, choices=STATUS_CHOICES) submitted_date = models.DateField(blank=True) update_notified_date = models.DateField(null=True, blank=True) def __str__(self): return self.document_title - def selecttypetext(self): - if self.selecttype == "1": - return "YES" - else: - return "NO" - def selectownedtext(self): - if self.selectowned == "1": - return "YES" - else: - return "NO" -# def get_patent_holder_contact(self): -# try: -# return self.contact.filter(contact_type=1)[0] -# except: -# return None -# def get_ietf_contact(self): -# try: -# return self.contact.filter(contact_type=2)[0] -# except: -# return None -# def get_submitter(self): -# try: -# return self.contact.filter(contact_type=3)[0] -# except: -# return None def get_absolute_url(self): return "/ipr/ipr-%s" % self.ipr_id class Meta: diff --git a/ietf/ipr/view_new.py b/ietf/ipr/view_new.py index 2f004acee..ff9bc2465 100644 --- a/ietf/ipr/view_new.py +++ b/ietf/ipr/view_new.py @@ -17,7 +17,7 @@ from django.http import HttpResponseRedirect def ipr_detail_form_callback(field, **kwargs): if field.name == "licensing_option": return forms.IntegerField(widget=forms.RadioSelect(choices=models.LICENSE_CHOICES), required=True) - if field.name in ["selecttype", "selectowned"]: + if field.name in ["is_pending", "applies_to_all"]: return forms.IntegerField(widget=forms.RadioSelect(choices=((1, "YES"), (2, "NO"))), required=False) if field.name in ["rfc_number", "id_document_tag"]: log(field.name) diff --git a/ietf/ipr/views.py b/ietf/ipr/views.py index f2a3a9810..f39fbf6a4 100644 --- a/ietf/ipr/views.py +++ b/ietf/ipr/views.py @@ -60,17 +60,17 @@ def show(request, ipr_id=None): raise KeyError("Unexpected contact_type (%s) in ipr_contacts for ipr_id=%s" % (contact.contact_type, ipr.ipr_id)) # do escaping and line-breaking here instead of in the template, # so that we can use the template for the form display, too. - ipr.p_notes = linebreaks(escape(ipr.p_notes)) - ipr.discloser_identify = linebreaks(escape(ipr.discloser_identify)) + ipr.notes = linebreaks(escape(ipr.notes)) + ipr.document_sections = linebreaks(escape(ipr.document_sections)) ipr.comments = linebreaks(escape(ipr.comments)) ipr.other_notes = linebreaks(escape(ipr.other_notes)) if ipr.licensing_option: ipr.licensing_option = dict(LICENSE_CHOICES)[ipr.licensing_option] - if ipr.selecttype: - ipr.selecttype = dict(SELECT_CHOICES)[ipr.selecttype] - if ipr.selectowned: - ipr.selectowned = dict(SELECT_CHOICES)[ipr.selectowned] + if ipr.is_pending: + ipr.is_pending = dict(SELECT_CHOICES)[ipr.is_pending] + if ipr.applies_to_all: + ipr.applies_to_all = dict(SELECT_CHOICES)[ipr.applies_to_all] return render("ipr/details.html", {"ipr": ipr, "section_list": section_list}) def update(request, ipr_id=None): @@ -224,7 +224,7 @@ def form(request): # ---- Helper functions ------------------------------------------------------ def get_section_list(ipr): - if ipr.old_ipr_url: + if ipr.legacy_url_0: return section_table["legacy"] elif ipr.generic: #assert not ipr.third_party diff --git a/ietf/templates/ipr/details.html b/ietf/templates/ipr/details.html index c48d347ce..d457179be 100644 --- a/ietf/templates/ipr/details.html +++ b/ietf/templates/ipr/details.html @@ -32,7 +32,7 @@ Sections {% block legacy_sections %}I, II, and IV{% endblock %} of "The Patent Disclosure and Licensing Declaration Template for {{ section_list.disclosure_type }} IPR Disclosures" have been completed for this IPR disclosure. Additional information may be available in the original submission.
- See the content of the original IPR disclosure.
+ See the content of the original IPR disclosure.
{% endif %} {% if section_list.new_intro %} @@ -41,12 +41,12 @@ information are displayed.
{% endif %} {% if section_list.new_intro or section_list.legacy_intro %} - {% if ipr.additional_old_title1 %} - {{ ipr.additional_old_title1 }}
+ {% if ipr.legacy_title_1 %} + {{ ipr.legacy_title_1 }}
{% endif %} - {% if ipr.additional_old_title2 %} - {{ ipr.additional_old_title2 }}
+ {% if ipr.legacy_title_2 %} + {{ ipr.legacy_title_2 }}
{% endif %} {% for item in ipr.updates.all %} @@ -286,7 +286,7 @@ applications required to be disclosed by Section 6 of RFC 3979) - {% if ipr.p_applications or ipr.p_notes %} + {% if ipr.patents or ipr.notes %} @@ -294,18 +294,18 @@ please provide the following information: Patent, Serial, Publication, Registration, - or Application/File number(s): {{ ipr.p_applications }} + or Application/File number(s): {{ ipr.patents }} Date(s) granted or applied for: {{ ipr.date_applied }} Country: {{ ipr.country }} - Additional Notes: {{ ipr.p_notes }} + Additional Notes: {{ ipr.notes }} B. Does this disclosure relate to an unpublished pending patent application?: - {{ ipr.selecttype }} + {{ ipr.is_pending }} @@ -315,7 +315,7 @@ C. Does this disclosure apply to all IPR owned by the submitter?: - {{ ipr.selectowned }} + {{ ipr.applies_to_all }} {% else %} @@ -329,8 +329,8 @@ covered: - {% if ipr.discloser_identify %} - {{ ipr.discloser_identify }} + {% if ipr.document_sections %} + {{ ipr.document_sections }} {% else %} No information submitted {% endif %} diff --git a/ietf/templates/ipr/list_item.html b/ietf/templates/ipr/list_item.html index fe288214a..fd6783058 100644 --- a/ietf/templates/ipr/list_item.html +++ b/ietf/templates/ipr/list_item.html @@ -22,23 +22,23 @@ {% ifequal ipr.status 1 %} - {% if ipr.additional_old_title1 %} + {% if ipr.legacy_title_1 %} * - {{ ipr.additional_old_title1 }} + {{ ipr.legacy_title_1 }} {% endif %} - {% if ipr.additional_old_title2 %} + {% if ipr.legacy_title_2 %} * - {{ ipr.additional_old_title2 }} + {{ ipr.legacy_title_2 }} {% endif %}