Skip to content

Commit

Permalink
Merge pull request #2141 from akvo/#1990-show-api-key
Browse files Browse the repository at this point in the history
[#1990] Show api key
  • Loading branch information
KasperBrandt committed May 3, 2016
2 parents b618108 + 26cc17e commit cbce54d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions akvo/rsr/views/my_rsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404, render

from tastypie.models import ApiKey

from ..forms import (PasswordForm, ProfileForm, UserOrganisationForm, UserAvatarForm,
SelectOrgForm)
from ..filters import remove_empty_querydict_items
Expand Down Expand Up @@ -67,6 +69,8 @@ def my_details(request):

change_password_form = PasswordForm(request.user)

api_key = ApiKey.objects.get_or_create(user=request.user)[0].key

context = {
'organisation_count': organisation_count,
'country_count': country_count,
Expand All @@ -75,6 +79,7 @@ def my_details(request):
'organisationform': organisation_form,
'avatarform': avatar_form,
'change_password_form': change_password_form,
'api_key': api_key,
}

return render(request, 'myrsr/my_details.html', context)
Expand Down
9 changes: 8 additions & 1 deletion akvo/templates/myrsr/my_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ <h4>{% trans 'Change your password' %}</h4>
</div>
</div>
<div class="col-sm-6 col-xs-12" id="organisations">



</div>
<div class="col-sm-6 col-xs-12" id="api_key">
<h4 style="margin-top: 20px">API Key</h4>
<span class="small">{{ api_key }}</span>
<br><br>
{% trans "For more information on how to use the RSR API, visit the" %}
<a href="https://akvorsr.supporthero.io/container/show/api"> {% trans "support page." %}</a>
</div>


Expand Down

0 comments on commit cbce54d

Please sign in to comment.