Skip to content

Commit

Permalink
Default to empty string when key missing
Browse files Browse the repository at this point in the history
  • Loading branch information
baarkerlounger committed Oct 10, 2024
1 parent 65f3fca commit 6a0254f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.

This file was deleted.

8 changes: 4 additions & 4 deletions datahub/company_activity/models/great.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Great(models.Model):
attributed_to_type = models.CharField(max_length=MAX_LENGTH)
attributed_to_id = models.CharField(max_length=MAX_LENGTH)

url = models.CharField(max_length=MAX_LENGTH, default='')
url = models.CharField(max_length=MAX_LENGTH)
meta_action_name = models.CharField(max_length=MAX_LENGTH)
meta_template_id = models.CharField(max_length=MAX_LENGTH)
meta_email_address = models.CharField(max_length=MAX_LENGTH)
Expand All @@ -53,11 +53,11 @@ class Great(models.Model):
# This is a duplicate of opportunities but in the form of a '\n' delimited string
data_opportunity_urls = models.CharField(max_length=MAX_LENGTH)

actor_type = models.CharField(max_length=MAX_LENGTH, default='')
actor_type = models.CharField(max_length=MAX_LENGTH, null=True)
actor_id = models.IntegerField(null=True)
actor_dit_email_address = models.CharField(max_length=MAX_LENGTH, default='')
actor_dit_email_address = models.CharField(max_length=MAX_LENGTH, null=True)
actor_dit_is_blacklisted = models.BooleanField(null=True)
actor_dit_is_whitelisted = models.BooleanField(null=True)
actor_dit_blacklisted_reason = models.CharField(max_length=MAX_LENGTH, default='')
actor_dit_blacklisted_reason = models.CharField(max_length=MAX_LENGTH, null=True)

created_on = models.DateTimeField(auto_now_add=True)
2 changes: 1 addition & 1 deletion datahub/company_activity/tasks/ingest_great_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def json_to_model(self, jsn):
actor_blacklisted_reason = str(actor.get('dit:blackListedReason', '') or '')
values = {
'published': obj['published'],
'url': obj.get('url', ''),
'url': str(obj.get('url', '') or ''),

'attributed_to_type': attributed_to_type,
'attributed_to_id': attributed_to_id,
Expand Down

0 comments on commit 6a0254f

Please sign in to comment.