Skip to content

Commit

Permalink
WOOOO lookup object creation and save works, ran migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sara committed Jul 18, 2018
1 parent 126ae67 commit d59eab1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion garfield/garfield/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['tunnel.brooklynhacker.com']
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'c0355f22.ngrok.io', 'tunnel.brooklynhacker.com']


# Application definition
Expand All @@ -41,6 +41,7 @@
'contacts',
'sms',
'phone_numbers',
'lookup',
'sims',
'voice',
'deterrence',
Expand Down
1 change: 1 addition & 0 deletions garfield/lookup/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
@admin.register(Lookup)
class LookupAdmin(admin.ModelAdmin):
pass

9 changes: 8 additions & 1 deletion garfield/lookup/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def lookup_contact(request):
contact_information['num_calls'] = num_calls
contact_information['contact_contact_count'] = contact_contact_count
contact_information['contact_carrier'] = contact_carrier
create_lookup_entry(request, contact_number, contact)
except:
raise Contact.DoesNotExist
create_lookup_entry(request, contact_number, None)
raise Contact.DoesNotExist
return (contact_information)

class Error(Exception):
Expand All @@ -91,5 +93,10 @@ def is_valid_number(number:str):
except Exception as e:
raise e

def create_lookup_entry(request, contact_phone_number, related_contact):
from_number = request.GET.get('From')
lookup_entry = Lookup.objects.create(officer_phone_number=from_number, contact_phone_number=contact_phone_number, related_contact=related_contact)
lookup_entry.save()



0 comments on commit d59eab1

Please sign in to comment.