Some ipr/model.py field re-arranging to make the admin interface come out nicer
- Legacy-Id: 110
This commit is contained in:
parent
d6b328188f
commit
f1e70cbbe4
|
@ -414,8 +414,8 @@ class DocumentComment(models.Model):
|
||||||
version = models.CharField(blank=True, maxlength=3)
|
version = models.CharField(blank=True, maxlength=3)
|
||||||
comment_text = models.TextField(blank=True)
|
comment_text = models.TextField(blank=True)
|
||||||
created_by = models.ForeignKey(IESGLogin, db_column='created_by', null=True)
|
created_by = models.ForeignKey(IESGLogin, db_column='created_by', null=True)
|
||||||
result_state = models.ForeignKey(IDState, db_column='result_state', null=True, related_name=None)
|
result_state = models.ForeignKey(IDState, db_column='result_state', null=True, related_name="comments_leading_to_state")
|
||||||
origin_state = models.ForeignKey(IDState, db_column='origin_state', null=True, related_name=None)
|
origin_state = models.ForeignKey(IDState, db_column='origin_state', null=True, related_name="comments_coming_from_state")
|
||||||
ballot = models.IntegerField(null=True, choices=BALLOT_CHOICES)
|
ballot = models.IntegerField(null=True, choices=BALLOT_CHOICES)
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
if self.rfc_flag:
|
if self.rfc_flag:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from ietf.idtracker.models import Rfc
|
||||||
# New field classes
|
# New field classes
|
||||||
|
|
||||||
phone_re = re.compile(r'^\+?[0-9 ]*(\([0-9]+\))?[0-9 -]+$')
|
phone_re = re.compile(r'^\+?[0-9 ]*(\([0-9]+\))?[0-9 -]+$')
|
||||||
class InternationalPhoneNumberField(models.PhoneNumberField):
|
class InternationalPhoneNumberField(models.CharField):
|
||||||
error_message = 'Phone numbers may have a leading "+", and otherwise only contain numbers [0-9], dash, space, and parentheses. '
|
error_message = 'Phone numbers may have a leading "+", and otherwise only contain numbers [0-9], dash, space, and parentheses. '
|
||||||
def validate(self, field_data, all_data):
|
def validate(self, field_data, all_data):
|
||||||
if not phone_re.search(field_data):
|
if not phone_re.search(field_data):
|
||||||
|
@ -77,38 +77,59 @@ class IprLicensing(models.Model):
|
||||||
|
|
||||||
class IprDetail(models.Model):
|
class IprDetail(models.Model):
|
||||||
ipr_id = models.AutoField(primary_key=True)
|
ipr_id = models.AutoField(primary_key=True)
|
||||||
p_h_legal_name = models.CharField("Legal Name", maxlength=255)
|
|
||||||
document_title = models.CharField(blank=True, maxlength=255)
|
document_title = models.CharField(blank=True, maxlength=255)
|
||||||
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
|
# Legacy information fieldset
|
||||||
other_designations = models.CharField(blank=True, maxlength=255)
|
|
||||||
p_applications = models.TextField(blank=True, maxlength=255)
|
|
||||||
date_applied = models.CharField(blank=True, maxlength=255)
|
|
||||||
#selecttype = models.ForeignKey(IprSelecttype, to_field='selecttype', db_column='selecttype')
|
|
||||||
selecttype = models.IntegerField(null=True, choices=SELECT_CHOICES)
|
|
||||||
discloser_identify = models.TextField(blank=True, maxlength=255, db_column='disclouser_identify')
|
|
||||||
#licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option')
|
|
||||||
licensing_option = models.IntegerField(null=True, blank=True, choices=LICENSE_CHOICES)
|
|
||||||
other_notes = models.TextField(blank=True)
|
|
||||||
submitted_date = models.DateField(null=True, blank=True)
|
|
||||||
status = models.IntegerField(null=True, blank=True)
|
|
||||||
comments = models.TextField(blank=True)
|
|
||||||
old_ipr_url = models.CharField(blank=True, maxlength=255)
|
old_ipr_url = models.CharField(blank=True, maxlength=255)
|
||||||
additional_old_title1 = 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_url1 = models.CharField(blank=True, maxlength=255)
|
||||||
additional_old_title2 = models.CharField(blank=True, maxlength=255)
|
additional_old_title2 = models.CharField(blank=True, maxlength=255)
|
||||||
additional_old_url2 = models.CharField(blank=True, maxlength=255)
|
additional_old_url2 = models.CharField(blank=True, maxlength=255)
|
||||||
|
|
||||||
|
# Patent holder fieldset
|
||||||
|
p_h_legal_name = models.CharField("Legal Name", maxlength=255)
|
||||||
|
|
||||||
|
# Patent Holder Contact fieldset
|
||||||
|
# self.contacts.filter(contact_type=1)
|
||||||
|
|
||||||
|
# IETF Contact fieldset
|
||||||
|
# self.contacts.filter(contact_type=1)
|
||||||
|
|
||||||
|
# Related IETF Documents fieldset
|
||||||
|
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')
|
||||||
|
|
||||||
|
# Patent Information fieldset
|
||||||
|
p_applications = models.TextField("Patent Applications", blank=True, maxlength=255)
|
||||||
|
date_applied = models.CharField(blank=True, maxlength=255)
|
||||||
country = models.CharField(blank=True, maxlength=100)
|
country = models.CharField(blank=True, maxlength=100)
|
||||||
p_notes = models.TextField(blank=True)
|
p_notes = models.TextField("Additional notes", blank=True)
|
||||||
third_party = models.BooleanField(editable=False)
|
selecttype = models.IntegerField("Unpublished Pending Patent Application", null=True, choices=SELECT_CHOICES)
|
||||||
|
selectowned = models.IntegerField("Applies to all IPR owned by Submitter", null=True, blank=True, choices=SELECT_CHOICES)
|
||||||
|
|
||||||
|
# Licensing Declaration fieldset
|
||||||
|
#licensing_option = models.ForeignKey(IprLicensing, db_column='licensing_option')
|
||||||
|
licensing_option = models.IntegerField(null=True, blank=True, choices=LICENSE_CHOICES)
|
||||||
lic_opt_a_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
|
lic_opt_a_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
|
||||||
lic_opt_b_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
|
lic_opt_b_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
|
||||||
lic_opt_c_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
|
lic_opt_c_sub = models.IntegerField(editable=False, choices=STDONLY_CHOICES)
|
||||||
generic = models.BooleanField(editable=False)
|
comments = models.TextField("Licensing Comments", blank=True)
|
||||||
selectowned = models.IntegerField(null=True, blank=True, choices=SELECT_CHOICES)
|
lic_checkbox = models.BooleanField("All terms and conditions has been disclosed")
|
||||||
|
|
||||||
|
third_party = models.BooleanField(editable=False)
|
||||||
|
|
||||||
|
# Other notes fieldset
|
||||||
|
other_notes = models.TextField(blank=True)
|
||||||
|
|
||||||
|
# Generated fields, not part of the submission form
|
||||||
|
status = models.IntegerField(null=True, blank=True)
|
||||||
comply = models.BooleanField(editable=False)
|
comply = models.BooleanField(editable=False)
|
||||||
lic_checkbox = models.BooleanField()
|
generic = models.BooleanField(editable=False)
|
||||||
|
submitted_date = models.DateField(null=True, blank=True)
|
||||||
update_notified_date = models.DateField(null=True, blank=True)
|
update_notified_date = models.DateField(null=True, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.document_title
|
return self.document_title
|
||||||
def selecttypetext(self):
|
def selecttypetext(self):
|
||||||
|
@ -136,8 +157,8 @@ class IprDetail(models.Model):
|
||||||
return self.contact.filter(contact_type=3)[0]
|
return self.contact.filter(contact_type=3)[0]
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
def get_absolute_url(self, item):
|
def get_absolute_url(self):
|
||||||
return "http://merlot.tools.ietf.org:31415/ipr/ipr-%s" % ipr_id
|
return "/ipr/ipr-%s" % self.ipr_id
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'ipr_detail'
|
db_table = 'ipr_detail'
|
||||||
class Admin:
|
class Admin:
|
||||||
|
@ -150,16 +171,16 @@ class IprContact(models.Model):
|
||||||
('3', 'Submitter Contact'),
|
('3', 'Submitter Contact'),
|
||||||
)
|
)
|
||||||
contact_id = models.AutoField(primary_key=True)
|
contact_id = models.AutoField(primary_key=True)
|
||||||
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, editable=False, related_name="contact")
|
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, edit_inline=True, related_name="contact")
|
||||||
contact_type = models.IntegerField(editable=False, choices=TYPE_CHOICES)
|
contact_type = models.IntegerField(choices=TYPE_CHOICES)
|
||||||
name = models.CharField(maxlength=255)
|
name = models.CharField(maxlength=255, core=True)
|
||||||
title = models.CharField(blank=True, maxlength=255)
|
title = models.CharField(blank=True, maxlength=255)
|
||||||
department = models.CharField(blank=True, maxlength=255)
|
department = models.CharField(blank=True, maxlength=255)
|
||||||
address1 = models.CharField(blank=True, maxlength=255)
|
address1 = models.CharField(blank=True, maxlength=255)
|
||||||
address2 = models.CharField(blank=True, maxlength=255)
|
address2 = models.CharField(blank=True, maxlength=255)
|
||||||
telephone = InternationalPhoneNumberField(maxlength=25)
|
telephone = InternationalPhoneNumberField(maxlength=25, core=True)
|
||||||
fax = InternationalPhoneNumberField(blank=True, maxlength=25)
|
fax = InternationalPhoneNumberField(blank=True, maxlength=25)
|
||||||
email = models.EmailField(maxlength=255)
|
email = models.EmailField(maxlength=255, core=True)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -170,8 +191,8 @@ class IprContact(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class IprDraft(models.Model):
|
class IprDraft(models.Model):
|
||||||
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', raw_id_admin=True)
|
document = models.ForeignKey(InternetDraft, db_column='id_document_tag', raw_id_admin=True, core=True)
|
||||||
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, related_name='drafts')
|
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, edit_inline=True, related_name='drafts')
|
||||||
revision = models.CharField(maxlength=2)
|
revision = models.CharField(maxlength=2)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s applies to %s-%s" % ( self.ipr, self.document, self.revision )
|
return "%s applies to %s-%s" % ( self.ipr, self.document, self.revision )
|
||||||
|
@ -193,8 +214,8 @@ class IprNotification(models.Model):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class IprRfc(models.Model):
|
class IprRfc(models.Model):
|
||||||
ipr = models.ForeignKey(IprDetail, raw_id_admin=True, related_name='rfcs')
|
ipr = models.ForeignKey(IprDetail, edit_inline=True, related_name='rfcs')
|
||||||
rfc_number = models.ForeignKey(Rfc, db_column='rfc_number', raw_id_admin=True)
|
rfc_number = models.ForeignKey(Rfc, db_column='rfc_number', raw_id_admin=True, core=True)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s applies to RFC%04d" % ( self.ipr, self.rfc_number )
|
return "%s applies to RFC%04d" % ( self.ipr, self.rfc_number )
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -132,6 +132,13 @@ def new(request, type):
|
||||||
if contact in section_list:
|
if contact in section_list:
|
||||||
self.base_fields[contact] = ContactForm(prefix=contact[:4], *args, **kw)
|
self.base_fields[contact] = ContactForm(prefix=contact[:4], *args, **kw)
|
||||||
BaseIprForm.__init__(self, *args, **kw)
|
BaseIprForm.__init__(self, *args, **kw)
|
||||||
|
# Special validation code
|
||||||
|
def clean(self):
|
||||||
|
# Required:
|
||||||
|
# Submitter form filled in or 'same-as-ietf-contact' marked
|
||||||
|
# Only one of rfc, draft, and other info fields filled in
|
||||||
|
# RFC exists or draft exists and has right rev. or ...
|
||||||
|
pass
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = IprForm(request.POST)
|
form = IprForm(request.POST)
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
input[type="checkbox"] { width: auto; }
|
input[type="checkbox"] { width: auto; }
|
||||||
input[type="submit"] { width: auto; }
|
input[type="submit"] { width: auto; }
|
||||||
textarea { width: 72ex; height: 5em; font-family: sans-serif; font-size: 11pt; font-weight: normal; }
|
textarea { width: 72ex; height: 5em; font-family: sans-serif; font-size: 11pt; font-weight: normal; }
|
||||||
.required { color: red; float: right; padding-top: 1ex; }
|
.required { color: red; float: right; padding-top: 0.7ex; font-size: 130%; }
|
||||||
.errorlist { background: red; padding: 0 0 0 2px; border: 0px; margin: 0px; }
|
.errorlist { background: red; padding: 0 0 0 2px; border: 0px; margin: 0px; }
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue