Skip to content

Commit

Permalink
#52 Added null attribute to optional fields, changed choices declarat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
jcaraballo17 committed Oct 29, 2020
1 parent 0770c32 commit 965c51d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/cvservices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ class ControlledVocabulary(models.Model):
CURRENT = 'Current'
ARCHIVED = 'Archived'

STATUS_CHOICES = (
STATUS_CHOICES = [
(CURRENT, 'Current'),
(ARCHIVED, 'Archived')
)
]

vocabulary_id = models.AutoField(primary_key=True)
term = models.CharField(max_length=255)
name = models.CharField(max_length=255)
definition = models.TextField()
category = models.CharField(max_length=255, blank=True)
provenance = models.TextField(blank=True)
provenance_uri = models.URLField(db_column='provenanceUri', blank=True)
category = models.CharField(max_length=255, blank=True, null=True)
provenance = models.TextField(blank=True, null=True)
provenance_uri = models.URLField(db_column='provenanceUri', blank=True, null=True)
note = models.TextField(blank=True, null=True)
vocabulary_status = models.CharField(max_length=255, db_column='status', choices=STATUS_CHOICES, default=STATUS_CHOICES[0][0])
vocabulary_status = models.CharField(max_length=255, db_column='status', choices=STATUS_CHOICES, default=CURRENT)
previous_version = models.OneToOneField('self', null=True, related_name='revised_version', on_delete=models.CASCADE)

def has_revision(self):
Expand Down Expand Up @@ -50,27 +50,27 @@ class ControlledVocabularyRequest(models.Model):
ACCEPTED = 'Accepted'
ARCHIVED = 'Archived'

STATUS_CHOICES = (
STATUS_CHOICES = [
(PENDING, 'Pending'),
(REJECTED, 'Rejected'),
(ACCEPTED, 'Accepted'),
(ARCHIVED, 'Archived'),
)
]

request_id = models.AutoField(max_length=255, db_column='requestId', primary_key=True)

term = models.CharField(max_length=255, help_text="Please enter a URI-friendly version of your term with no spaces, special characters, etc.")
name = models.CharField(max_length=255, help_text="Please enter the term as you would expect it to appear in a sentence.")
definition = models.TextField(help_text="Please enter a detailed definition of the term.", blank=True)
category = models.CharField(max_length=255, blank=True, help_text="You may suggest a category for the term. Refer to the vocabulary to see which categories have been used. You may also suggest a new category.")
provenance = models.TextField(blank=True, help_text="Enter a note about where the term came from. If you retrieved the definition of the term from a website or other source, note that here.")
provenance_uri = models.URLField(db_column='provenanceUri', blank=True, max_length=1024, help_text="If you retrieved the term from another formal vocabulary system, enter the URI of the term from the other system here.")
definition = models.TextField(help_text="Please enter a detailed definition of the term.", blank=True, null=True)
category = models.CharField(max_length=255, blank=True, null=True, help_text="You may suggest a category for the term. Refer to the vocabulary to see which categories have been used. You may also suggest a new category.")
provenance = models.TextField(blank=True, null=True, help_text="Enter a note about where the term came from. If you retrieved the definition of the term from a website or other source, note that here.")
provenance_uri = models.URLField(db_column='provenanceUri', blank=True, null=True, max_length=1024, help_text="If you retrieved the term from another formal vocabulary system, enter the URI of the term from the other system here.")
note = models.TextField(blank=True, null=True, help_text="Please enter any additional notes you may have about the term.")

status = models.CharField(max_length=255, db_column='status', choices=STATUS_CHOICES, default=STATUS_CHOICES[0][0])
status = models.CharField(max_length=255, db_column='status', choices=STATUS_CHOICES, default=PENDING)
date_submitted = models.DateField(db_column='dateSubmitted', default=timezone.now)
date_status_changed = models.DateField(db_column='dateStatusChanged', default=timezone.now)
request_notes = models.TextField(db_column='requestNotes', blank=True)
request_notes = models.TextField(db_column='requestNotes', blank=True, null=True)
submitter_name = models.CharField(max_length=255, db_column='submitterName', help_text="Enter your name.")
submitter_email = models.CharField(max_length=255, db_column='submitterEmail', help_text="Enter your email address.")
request_reason = models.TextField(db_column='requestReason', help_text="Please enter a brief description of the reason for your submission (e.g., Term does not exist yet, Term is needed for my data use case, etc.)")
Expand All @@ -87,20 +87,20 @@ class Unit(models.Model):
unit_id = models.AutoField(primary_key=True)
term = models.CharField(max_length=255, db_column='Term')
type = models.CharField(max_length=255, db_column='UnitsTypeCV')
abbreviation = models.CharField(max_length=255, blank=True, db_column='UnitsAbbreviation')
abbreviation = models.CharField(max_length=255, blank=True, null=True, db_column='UnitsAbbreviation')
name = models.CharField(max_length=255, db_column='UnitsName')
link = models.URLField(max_length=1024, blank=True, db_column='UnitsLink')
link = models.URLField(max_length=1024, blank=True, null=True, db_column='UnitsLink')

class Meta:
db_table = 'units'
ordering = ["type"]


class AbstractActionType(models.Model):
PRODUCES_RESULT_CHOICES = (
PRODUCES_RESULT_CHOICES = [
('Yes', 'Yes'),
('No', 'No')
)
]
produces_result = models.CharField(db_column='producesResult', max_length=5, choices=PRODUCES_RESULT_CHOICES, blank=True)

class Meta:
Expand Down

0 comments on commit 965c51d

Please sign in to comment.