|
1 | 1 | # Copyright The IETF Trust 2007, All Rights Reserved |
2 | 2 |
|
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 | | - |
174 | 3 | import datetime |
175 | 4 |
|
176 | 5 | from django.conf import settings |
177 | 6 | from django.core.urlresolvers import reverse |
| 7 | +from django.db import models |
178 | 8 |
|
| 9 | +from ietf.doc.models import DocAlias |
179 | 10 | from ietf.name.models import DocRelationshipName,IprDisclosureStateName,IprLicenseTypeName,IprEventTypeName |
180 | 11 | from ietf.person.models import Person |
181 | 12 | from ietf.message.models import Message |
|
0 commit comments