From 9a19b6db1a2c7e6ac3e6a0cc6611565107767ed6 Mon Sep 17 00:00:00 2001 From: Gian Date: Mon, 16 Dec 2019 23:33:30 +0800 Subject: [PATCH] Added data request landing page and disabled false logic branches --- .../registration/data_request_submit.html | 14 +++++++++++++ .../registration/verification_done.html | 5 +++-- geonode/datarequests/urls.py | 2 ++ geonode/datarequests/views/registration.py | 20 +++++++++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 geonode/datarequests/templates/datarequests/registration/data_request_submit.html diff --git a/geonode/datarequests/templates/datarequests/registration/data_request_submit.html b/geonode/datarequests/templates/datarequests/registration/data_request_submit.html new file mode 100644 index 00000000000..99895bd567c --- /dev/null +++ b/geonode/datarequests/templates/datarequests/registration/data_request_submit.html @@ -0,0 +1,14 @@ +{% extends "site_base.html" %} + +{% load url from future %} +{% load i18n %} + +{% block head_title %}{% trans "Data Request sent" %}{% endblock %} + +{% block body %} +

{% trans "Data Request sent" %}

+ +

{% 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 %}

+

{% blocktrans %}If you have further questions, contact us at {{ support_email }}, and we'll be glad to assist you.{% endblocktrans %}{% endblocktrans %}

+ +{% endblock %} diff --git a/geonode/datarequests/templates/datarequests/registration/verification_done.html b/geonode/datarequests/templates/datarequests/registration/verification_done.html index 958acf452be..eb994536a06 100644 --- a/geonode/datarequests/templates/datarequests/registration/verification_done.html +++ b/geonode/datarequests/templates/datarequests/registration/verification_done.html @@ -8,6 +8,7 @@ {% block body %}

{% trans "Email address confirmed" %}

-

{% 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 %}

-

{% blocktrans %}If you have further questions, contact us at {{ support_email }}, and we'll be glad to assist you.{% endblocktrans %}

+

{% blocktrans %}You have now created and confirmed your account. You may proceed with requesting for data by logging in and selecting Request New Data{% endblocktrans %}

+

{% blocktrans %}If you have further questions, contact us at {{ support_email }}, and we'll be glad to assist you.{% endblocktrans %}{% endblocktrans %}

+ {% endblock %} diff --git a/geonode/datarequests/urls.py b/geonode/datarequests/urls.py index e9495adce0c..8ac826f5426 100644 --- a/geonode/datarequests/urls.py +++ b/geonode/datarequests/urls.py @@ -55,6 +55,8 @@ url(r'^data/(?P\d+)/approve/$', 'data_request_approve', name="data_request_approve"), url(r'^data/(?P\d+)/reject/$', 'data_request_reject', name="data_request_reject"), url(r'^data/(?P\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\d+)/compute_request_size/$', 'data_request_compute_size', name="data_request_compute_size"), url(r'^data/(?P\d+)/tag_suc/$', 'data_request_tag_suc', name="data_request_tag_suc"), diff --git a/geonode/datarequests/views/registration.py b/geonode/datarequests/views/registration.py index 7dcde23c617..1db142d7665 100644 --- a/geonode/datarequests/views/registration.py +++ b/geonode/datarequests/views/registration.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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) @@ -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 @@ -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)