Skip to content

Commit

Permalink
Merge pull request #51 from sheagcraig/patch-1
Browse files Browse the repository at this point in the history
Add machine info route using serial number
  • Loading branch information
grahamgilbert authored Feb 16, 2018
2 parents bce365f + 94aeee2 commit e0f737f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
url(r'^info/secret/(?P<secret_id>.+)/', secret_info, name='secret_info'),

#computerinfo
url(r'^info/(?P<computer_id>.+)/', computer_info, name='computer_info'),
url(r'^info/(?P<computer_id>[0-9]+)/', computer_info, name='computer_info'),
url(r'^info/(?P<serial>[A-Z0-9]{11,12}.+)/', computer_info, name='computer_info'),

#request
url(r'^request/(?P<secret_id>.+)/', request, name='request'),
Expand Down
7 changes: 5 additions & 2 deletions server/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ def index(request):

##view to see computer info
@login_required
def computer_info(request, computer_id):
def computer_info(request, computer_id=None, serial=None):
cleanup()
computer = get_object_or_404(Computer, pk=computer_id)
if computer_id:
computer = get_object_or_404(Computer, pk=computer_id)
else:
computer = get_object_or_404(Computer, serial=serial)
can_request = None
approved = None

Expand Down

0 comments on commit e0f737f

Please sign in to comment.