Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add landing page for data request submitted. #2

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "site_base.html" %}

{% load url from future %}
{% load i18n %}

{% block head_title %}{% trans "Data Request sent" %}{% endblock %}

{% block body %}
<h2>{% trans "Data Request sent" %}</h2>

<p>{% blocktrans %}Your data request registration is now under evaluation. Once your request is evaluated, you will receive an email from us regarding its approval. {% endblocktrans %}</p>
<p>{% blocktrans %}If you have further questions, contact us at <strong>{{ support_email }}</strong>, and we'll be glad to assist you.{% endblocktrans %}{% endblocktrans %}</p>

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{% block body %}
<h2>{% trans "Email address confirmed" %}</h2>

<p>{% blocktrans %}Your data request registration is now under evaluation. Once your request is evaluated, you will receive an email from us regarding its approval. {% endblocktrans %}</p>
<p>{% blocktrans %}If you have further questions, contact us at <strong>{{ support_email }}</strong>, and we'll be glad to assist you.{% endblocktrans %}</p>
<p>{% blocktrans %}You have now created and confirmed your account. You may proceed with requesting for data by logging in and selecting <i>Request New Data</i>{% endblocktrans %}</p>
<p>{% blocktrans %}If you have further questions, contact us at <strong>{{ support_email }}</strong>, and we'll be glad to assist you.{% endblocktrans %}{% endblocktrans %}</p>

{% endblock %}
2 changes: 2 additions & 0 deletions geonode/datarequests/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
url(r'^data/(?P<pk>\d+)/approve/$', 'data_request_approve', name="data_request_approve"),
url(r'^data/(?P<pk>\d+)/reject/$', 'data_request_reject', name="data_request_reject"),
url(r'^data/(?P<pk>\d+)/cancel/$', 'data_request_cancel', name="data_request_cancel"),
# data request landing page
url(r'^data/request_success/$', 'data_request_success', name='data_request_success'),

url(r'^data/(?P<pk>\d+)/compute_request_size/$', 'data_request_compute_size', name="data_request_compute_size"),
url(r'^data/(?P<pk>\d+)/tag_suc/$', 'data_request_tag_suc', name="data_request_tag_suc"),
Expand Down
20 changes: 18 additions & 2 deletions geonode/datarequests/views/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def data_request_view(request):
data_request_obj.save()
data_request_obj.set_status("pending")
# user is not authenticated, users should no longer be able to access this
'''
else:
request_letter = create_letter_document(details_form.clean()['letter_file'], profile_request = profile_request_obj)
data_request_obj.request_letter = request_letter
Expand All @@ -288,6 +289,7 @@ def data_request_view(request):
profile_request_get = ProfileRequest.objects.get(id=profile_request_obj.id)
profile_request_get.data_request= data_request_obj
profile_request_get.save()
'''
data_request_obj.save()
if saved_layer:
data_request_obj.jurisdiction_shapefile = saved_layer
Expand All @@ -300,6 +302,7 @@ def data_request_view(request):
# an unauthenticated user or user done with registration but email not verified
if profile_request_obj and not request.user.is_authenticated():
# request_data.send_verification_email()
# this autoapprove the data request object, instead proceed to email send page
"""
if profile_request_get.status == "approved":
# autoapproves data request object if profile's status is approvied
Expand All @@ -324,9 +327,9 @@ def data_request_view(request):

elif request.user.is_authenticated():
messages.info(request, "Your request has been submitted")
out['success_url'] = reverse('home')
out['success_url'] = reverse('datarequests:data_request_success')

out['redirect_to'] = reverse('home')
out['redirect_to'] = reverse('datarequests:data_request_success')

data_request_obj.profile = request.user

Expand Down Expand Up @@ -384,6 +387,17 @@ def email_verification_send(request):
context
)

def data_request_success(request):

context = {
'support_email': settings.LIPAD_SUPPORT_MAIL,
}
return render(
request,
'datarequests/registration/data_request_submit.html',
context
)

def email_verification_confirm(request):
key = request.GET.get('key', None)
email = request.GET.get('email', None)
Expand Down Expand Up @@ -450,6 +464,7 @@ def email_verification_confirm(request):
else:
profile_request.set_status('approved')
# This should never trigger, as data_request can't be accessed
'''
if profile_request.data_request:
profile_request.data_request.profile = profile_request.profile

Expand All @@ -466,6 +481,7 @@ def email_verification_confirm(request):
profile_request.data_request.set_status('approved')
profile_request.data_request.send_approval_email(profile_request.data_request.profile.username)
pprint(request, "Request "+str(profile_request.data_request.pk)+" has been approved.")
'''
profile_request.send_approval_email()

pprint(email+" "+profile_request.status)
Expand Down