Hi!

I think you've found the wrong mailing list for this post. This mailing
list is for discussing the development of Django itself, not for support
using Django. This means the discussions of bugs and features in Django
itself, rather than in your code using it. People on this list are unlikely
to answer your support query with their limited time and energy.

For support, please follow the "Getting Help" page:
https://docs.djangoproject.com/en/3.0/faq/help/ . This will help you find
people who are willing to support you, and to ask your question in a way
that makes it easy for them to answer.

Thanks for your understanding and all the best,

Adam

On Wed, 22 Apr 2020 at 04:42, Dilipkumar Noone <n.dil...@gmail.com> wrote:

> I am Using Celery to perform a task in the background on form submission.
> As soon as form is submitted during POST request, I have created a task to
> execute in the back ground using delay method. This task processes some
> click operations on some other web using selenium web driver and return two
> python lists after task execution. Based on list content I want to display
> pop up message.
>
> When I execute the task using celery and run the Django web development
> server on form submit , I am getting error message: 'AsyncResult' object is
> not iterableā€.
>
> Please suggest how to resolve this issue and proceed further.
>
> Here is my code snippet: sample List content which obtained through
> selenium operations on web page is as shown below:
>
>
> board_not_used_list = ['16123','14960']
> board_mgr_permissions_not_present_list = [ '23456','45678']
>
>
> views.py:
>     --------
>     def conclude_key_issue_form(request, id=None):
>         if id:
>             action = 'edit'
>             model = get_object_or_404(ConcludeKeyIssues, pk=id)
>
>         else:
>             action = 'submit'
>             model = ConcludeKeyIssues()
>
>         message = ""
>
>
>         if request.method == 'POST':
>
>             form = ConcludeKeyIssuesForm(request.POST, instance=model)
>
>             selected_model_name = request.POST.get('registered_model')
>
>
>             if form.is_valid():
>
>                 new_key_issue_request = form.save(commit=False)
>                 new_key_issue_request.integrator_id = request.user.username
>
>                 integrator_username = new_key_issue_request.integrator_id
>                 integrator_password = form.cleaned_data['integrator_pwd']
>
>                 new_key_issue_request.integrator_pwd = integrator_password
>
>                 new_key_issue_request.save()
>                 form.save_m2m()
>
>                 created_pk = new_key_issue_request.pk
>
>                 if id is None:
>                     board_not_used_list,
>                            board_mgr_permissions_not_present_list=
>               task_check_board_availability_and_permissions.delay(created_pk)
>
>             if board_not_used_list and
> board_mgr_permissions_not_present_list:
>                 alert_flag = True
>                 alert_message = "SAS Board ID's:{} in Not Used state."
>                 context = {'form': form, 'registered_model_data': 
> registered_models,
>                            'alert': alert_flag, 'alert_message': 
> json.dumps(alert_message)}
>                 return render(request, 'ConcludeKeyIssue.html', context)
>
>             elif not board_not_used_list and 
> board_mgr_permissions_not_present_list:
>                 alert_flag = True
>                 alert_message = "You don't have Board Manager Permissions"
>                 context = {'form': form, 'registered_model_data': 
> registered_models,
>                            'alert': alert_flag, 'alert_message': 
> json.dumps(alert_message)}
>                 return render(request, 'ConcludeKeyIssue.html', context)
>
>             return HttpResponseRedirect('/swatapp/ConcludeKeyIssueList')
> else:
>     print("Fill Conclude Key Issues")
>     form = ConcludeKeyIssuesForm(instance=model)
>
>     context = {'form': form,'Message': message, 'action': action}
>
>     return render(request, 'ConcludeKeyIssue.html', context)
> Tasks.py:--------@app.task(name="task_check_board_availability_and_permissions")def
>  task_check_board_availability_and_permissions(created_pk):
>     print("From tasks.py conclude_key_issue_through_selenium")
>
>     print("Conclude Key Issue Through Selenium")
>
>     latest_record_pk = created_pk
>
>     # Get the instances of ConcludeKeyIssues
>     conclude_key_issue_obj_list = ConcludeKeyIssues.objects.all()
>
>     # Get the latest created record details
>     get_created_record_details = 
> ConcludeKeyIssues.objects.get(pk=latest_record_pk)
>
>     # Get the id or location value of selected from SAS URL
>     sas_board_ids = get_created_record_details.sas_ids
>
>     # Get SAS Board IDs in list
>     sas_board_ids_list = sas_board_ids.split(",")
>
>
>     # Input username and password
>     username = get_created_record_details.integrator_id
>     password = get_created_record_details.integrator_pwd
>
>     board_not_used_list, board_mgr_permissions_not_present_list = \
>         
> check_board_availability_and_permissions_for_all_requested_sas(sas_board_ids_list,
>  username,
>                                                                        
> password)
>
>
>     return board_not_used_list, board_mgr_permissions_not_present_list
>
>
>
> settings.py:------------
> INSTALLED_APPS = [
>     'django.contrib.admin',
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.messages',
>     'django.contrib.staticfiles',
>     'crispy_forms',
>     'swatapp',
>     'django_celery_results',]
> CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
> CELERY_RESULT_BACKEND = 'django-db'
>
>
> 1.Please suggest how to resolve this error and proceed further.
>
> 2.How to retrieve the 2 lists [ 
> board_not_used_list,board_mgr_permissions_not_present_list] using celery 
> result.
>
>
> Regards,
>
> N.Dilip kumar.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/414bb8f2-fa83-423a-9fd8-0b451a5f6ff4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/414bb8f2-fa83-423a-9fd8-0b451a5f6ff4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM24M3m9tT81B-Ez%2BQk%2BW7_LnxrD%2B8pzmvu8qqnRkW7iDQ%40mail.gmail.com.

Reply via email to