Skip to content

Commit

Permalink
Return full_address for RelayAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
say-yawn committed Aug 24, 2021
1 parent 7d05ba2 commit 8673e35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions emails/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ def make_relay_address(user_profile, num_tries=0, domain=DEFAULT_DOMAIN):
def domain_value(self):
return DOMAINS.get(self.get_domain_display())

@property
def full_address(self):
return '%s@%s' % (self.address, self.domain_value)


class DeletedAddress(models.Model):
address_hash = models.CharField(max_length=64, db_index=True)
Expand Down
3 changes: 2 additions & 1 deletion emails/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def _index_POST(request):
return JsonResponse({
'id': relay_address.id,
'address': address_string,
'domain': relay_addres.domain_value
'domain': relay_address.domain_value,
'full_address': relay_addres.full_address
}, status=201)

return redirect('profile')
Expand Down

0 comments on commit 8673e35

Please sign in to comment.