While executing a Celery Task : 'AsyncResult' object is not iterable

2020-04-21 Thread Dilipkumar Noone


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 [ 

Re: [Django] Error occured while saving a form created through model formset factory

2020-02-14 Thread Dilipkumar Noone
Hi Maninder,

This error seems because i used choice field which actually use names as 
values but django expects the id.

As Django automatically creates a ModelChoicefield for a Foreign Key which 
use the correct values,i modified the code as below in forms.py.

I have a requirement to populate only unique values for registered_model 
from the values returned from ModelRegister .

I modified the code as below and now i am able to get the unique values .


def unique_values():
return 
[("","---")]+list(ModelRegister.objects.values_list('model_name','model_name').order_by('model_name').distinct())

registered_model = forms.ChoiceField(required=False,choices=unique_values)


registered_model = 
forms.ModelChoiceField(queryset=ModelRegister.objects.values_list('model_name',flat=True).order_by('model_name').distinct())



Error is resolved now.



   But once i fill all the values in formset and submit the form. 
   
   Not able to redirect to List View. Even if i click on submit button it 
   stays on the same page.Anything needs to be taken care during POST request 
   to save the created model formsets in the database.in the
   - 
   
   
   - 
   
   *def create_model_gsp_request_form(request,id=None):
   print("Inside create_model_gsp_request_form")
   template_name = "ModelGSPRequest.html"
   heading_message = "ModelGSPRequest"
   
   if id:
   action = 'edit'
   model = get_object_or_404(ModelGSPRequest, pk=id)
   else:
   action = 'submit'
   model = ModelGSPRequest()
   
   message = ""
   
   if request.method == 'GET':
   print("Get request in create_model_gsp_request_form")
   # we don't want to display the already saved model instances
   #formset = 
ModelGSPRequestFormSet(queryset=ModelGSPRequest.objects.none(),instance=model)
   formset = ModelGSPRequestFormSet()
   #registered_model_details = serializers.serialize("json", 
ModelRegister.objects.all())
   #print("registered_model_details:", registered_model_details)
   elif request.method == 'POST':
   print("post request in create_model_gsp_request_form")
   formset = ModelGSPRequestFormSet(request.POST,request.FILES)
   if formset.is_valid():
   for form in formset:
   # only save if name is present
   #if form.cleaned_data.get('name'):
   
   new_form = form.save(commit=False)
   new_form.model_gsp_requester = request.user.username
   new_form.save()
   formset.save_m2m()
   #return redirect('ModelGSPRequestList')
   return HttpResponseRedirect('/gspapp/ModelGSPRequestList')
   return render(request, template_name, {
   'formset': formset,
   'heading': heading_message,
   #'registered_model_data': registered_model_details,
   'action':action
   })*
   
   - 
   
   
   

Regards,
N.Dilip Kumar.


On Monday, February 10, 2020 at 12:11:42 AM UTC+5:30, Dilipkumar Noone 
wrote:
>
>  I am a Django learner. 
>
> 1.I have a requirement to create the multiple forms in a single page for a 
> model. 
> 2.So i created the formset using modelformset_factory. 
> 3.I have 2 models.
> a)ModelRegister b)ModelGSPRequest. 4.ModelGSPRequest has a field named 
> registered_model which is a foreignKey to ModelRegister. 5.But after i 
> input all the fields for a modelformset and click on submit to save. I am 
> facing below error with the foreign key field.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d67053f-c0e1-4f68-b875-7886b62ea5fd%40googlegroups.com.


[Django] Error occured while saving a form created through model formset factory

2020-02-09 Thread Dilipkumar Noone
 I am a Django learner. 

1.I have a requirement to create the multiple forms in a single page for a 
model. 
2.So i created the formset using modelformset_factory. 
3.I have 2 models.
a)ModelRegister b)ModelGSPRequest. 4.ModelGSPRequest has a field named 
registered_model which is a foreignKey to ModelRegister. 5.But after i 
input all the fields for a modelformset and click on submit to save. I am 
facing below error with the foreign key field.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/84953e1b-a2e0-490e-a646-2fade661e6de%40googlegroups.com.


How to fill the form field with the data based on drop down selection of another form field using ajax request

2020-02-08 Thread Dilipkumar Noone
Dear group,

I am Django learner.

I have two models.

1. ModelRegister 
2. ModelGSP

ModelRegister returns model_name.
ModelGSP has a foreignkey to ModelRegister.

When we select a particular model from a ModelGSP model,i want to fill a 
field in ModelGSP with the data for a selected model when ajax request is 
made.

Input data and expected result shown in screen shot below.

*currently when i select any model from RegisteredModel, none of the data 
is populated in get_model_nos_for_modelname field.*

*Please correct me if i am doing any mistake and how to proceed further.*

[image: query.png]
Below is my code snippet :

Enter code here...

Models.py:
===
class ModelRegister(models.Model):
"""
This class is used to register the model.
"""
FLOAT_CHOICES = [[float(x), float(x)] for x in range(1, 21)]

model_name = models.CharField(max_length=128, verbose_name="ModelName")
model_no = models.CharField(max_length=128, verbose_name="ModelNo")
os_name = models.ForeignKey(OSName, on_delete=models.CASCADE, 
verbose_name="OSName",default=" ")
chipset_type = models.ForeignKey(ChipsetType,on_delete=models.CASCADE, 
verbose_name="chipsetType")

class Meta:
verbose_name_plural = "ModelRegisteredList"

def __str__(self):
return self.model_name


class ModelGSP(models.Model):
"""
This class is used to raise Model GSP request.
"""

registered_model = 
models.ForeignKey(ModelRegister,on_delete=models.CASCADE, 
verbose_name="ModelName")
model_nos_for_reg_model = models.ManyToManyField(ModelNumber)
model_gsp_requester = models.CharField("Model GSP Requester", 
max_length=128,default=" ")
integrator = models.CharField("Integrator", max_length=100,default=" ")

class Meta:
 verbose_name_plural = "ModelGSPRequests"

def __str__(self):
 return self.model_gsp_requester + self.integrator + str(self.pk)

class ModelRegisterForm(ModelForm):
"""
This class is used to register the model information.
"""

class Meta:
model = ModelRegister
exclude = ['model_leader']
#fields = '__all__'


@property
def helper(self):
helper = FormHelper()
helper.form_tag = 'model_register_form'
helper.layout = Layout(
Fieldset(
   'Registered Model Details',
#Row('model_leader' ),
Row('model_name','model_no'),
Row('os_name', 'os_version'),
Row('chipset_type','chipset_name')
)
)

return helper

class ModelGSPRequestForm(ModelForm):
"""
This class is used to define the form fields to raise the model GSP 
request.
"""
registered_model = forms.ChoiceField(required=False,choices=unique_values)
#model_nos_for_reg_model = 
forms.ModelMultipleChoiceField(required=False,queryset=)

class Meta:
model = ModelGSPRequest
exclude = ['model_gsp_requester']

#choices=[]
def __init__(self, *args, **kwargs):
super(ModelGSPRequestForm, self).__init__(*args, **kwargs)
#self.form_tag = False
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset("Add Model GSP Request",
  
Row('registered_model','model_nos_for_reg_model')
)
   )
self.fields['model_nos_for_reg_model'].queryset = 
ModelNumber.objects.none()

ajax.py:


def load_model_details(request):
print("load model details")
print("request method",request.method)

model_name_id = request.GET.get("model_name")
model_registered_instances = 
ModelRegister.objects.filter(model_name_id=model_name_id)

model_number = []

for model in model_registered_instances:
model_number = model_number.append(model.model_no)
print("Model Number:", model_number)


return render(request, 'model_info_options.html', 
{'model_registered_instances':model_registered_instances})

model_info_options.html:




-
{% for model in model_registered_instances %}
{{ model.model_no }}
{% endfor %}


ModelGSP.html:
=


{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block static %}
{% endblock static %}

{% block content %}

   {% csrf_token %}
   
   {% crispy form %}
  
  
   
{% if action == "add" %}
Add
{% else %}
Update
{% endif %}
   
   
  Cancel
   


{% endblock content %}

{% block scripts %}

$(document).ready(function(){
$("#id_registered_model").change(function () {

var url = $("#gspmodelinfoForm").attr("model-details-url");  # Get 
the url of the 'gspmodelinfoForm' view

var model_name_id = $(this).val(); //get the 

[Django] How to render a form 'n' number of times based on the dropdown selected integer in main Form

2019-12-14 Thread Dilipkumar Noone


1.I have the below requirement in django to implement.

a)I have a main form with a few fields [text input fields,choice fields ] 

b)Based on the user input on integer field from the dropdown box in a 
template, i need to display few more fields waiting for the user input. 
Ex:If user selected an integer :3 i need to display another form 3 times 
containing few fields [ text input fields,choice fields] in the same html 
django template.[Say it is SubForm1]

c) Again based on dropdown selection in subform1

i need to display few more fields waiting for the user input. Ex:If user 
selected an integer :4 i need to display another form 3 times containing 
few fields [ text input fields,choice fields] in the same html django 
template.[Say it is SubForm2]


How to accomplish this .Can some one please share if any tutorial or any 
similar post already done at any place 

Basically i dont know much javascript/jquery .


can we accomplish this only using django forms & templates with out using 
javascript or jquery?



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da38e49c-c49a-4236-acf1-f79e4dfb678a%40googlegroups.com.


[Django] How to traverse through query set in java script using django templates?

2019-12-06 Thread Dilipkumar Noone
Hi,

I  have a model named ApplyGSP in models.py.

*In my views.py:*

apply_gsp_model = ApplyGSP.objects.all()

context = {'form': form,'apply_gsp_model':apply_gsp_model, 'Message': message, 
'action': action}
if action == 'edit':
print("action is edit")
return render(request, 'EditApplyGSP.html', context)
else:
print("action is submit")
return render(request, 'ApplyGSP.html', context)


I want to traverse through the model instance in javascript using django 
template. 


can some one suggest how to traverse through django queryset and access the 
database fields inside java script.




 



Regards,

N.Dilip kumar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/789645b6-91f2-40ea-b4c0-44580fb2bdef%40googlegroups.com.


[Django] How to deploy django app having Chrome Driver dependency

2019-10-21 Thread Dilipkumar Noone
hi,

One of my Django application has chrome driver dependency to perform 
automation on some other website.

Initially during development phase, i kept the chrome driver in my local 
path.

Ex: C:\Python3.6.0\MyScripts\seleniumwebdriver\chromedriver.exe

As all users can't use the same path please confirm how to come out of this 
problem.

Regards,
N.Dilip kumar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/777e9439-0ba2-4e44-bed3-60b68ad09730%40googlegroups.com.


[Django] How to retrieve the saved password in raw format

2019-10-21 Thread Dilipkumar Noone
Dear Django group,

In one of my View i need UserName & Password details in raw format but 
Django uses *PBKDF2*  algorithm to 
store the password.

I would like to know how to retrieve the saved password from Authentication 
Form.

Using these Username and password details from my Django app , i need to 
use the same credentials to access another website to perform web 
automation on it using selenium chrome webdriver.

Please let us know how to get the password in raw format once user 
authenticated using below LoginForm and login_view.

*My forms.py:*
*===*

forms.py:
===

class LoginForm(AuthenticationForm):

remember_me = forms.BooleanField(required=True, initial=False)

def __init__(self, *args, **kwargs): 

super(LoginForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = '.'
self.helper.layout = Layout(
Field('username', placeholder="Enter Username", autofocus=""),
Field('password', placeholder="Enter Password"),
Field('remember_me'),
Submit('sign_in', 'Log in',
   css_class="btn btn-lg btn-primary btn-block"),
)

def apply_gsp_request_form(request, id=None):   

if id:
action = 'edit'
model = get_object_or_404(ApplyGSP, pk=id)
else:
action = 'submit'
model = ApplyGSP()

message = ""

if request.method == 'POST':
form = ApplyGSPForm(request.POST, instance=model)

if form.is_valid():
form.save()
username = request.user.username
print("password:", request.user.password)
   * # How to get password details ? If i get pwd here using 
request.user.password it is displaying 
in $$$ format.*
* # but i need in raw(clear text format)*
*applyselenium*(username,password*)* 
  
*def applyselenium():*
  ---
  --


My Views.py:
===
views.py:

def login_view(request):
logout(request)

username = password = ''
redirect_to = request.GET.get('next', '/gspapp/')
   
form = LoginForm()

if request.POST:
 
form = LoginForm(request.POST)

username = request.POST['username']
password = request.POST['password']

user = authenticate(request, username=username, password=password) 
   

if user is not None:
login(request, user)

remember_me = request.POST.get('remember_me', False)

if remember_me == "on":
ONE_MONTH = 30 * 24 * 60 * 60
expiry = getattr(settings, "KEEP_LOGGED_DURATION", 
ONE_MONTH)
request.session.set_expiry(expiry)
else:
request.session.set_expiry(0)

return HttpResponseRedirect(redirect_to)

context = {'form': form, 'page_title': page_title, 'loginpage_heading': 
loginpage_heading}
return render(request, 'login.html', context)




Regards
N.Dilip Kumar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11a515fc-8b06-4130-8a0d-5ab6c9a21497%40googlegroups.com.


[Django] How To Auto Fill all the Model form with thee data on button click based on user text input.

2019-10-13 Thread Dilipkumar Noone
Dear Django group,

I am beginner in Django.

I have a below requirement in Django Model Form while creating  a new 
record with the submission Form to perform .
 
1.In form processing i want to auto fill all the form fields based on user 
primary key text input.
2.User text input from step1 is the primary key of already created record 
in MySQL DB, which is created before while processing POST request when 
user filled the form
manually all the form fields and clicked on submit.

*Example:*

Assume the database has 10 records .Each record has some 12 fields.
To create new record(11th record) ,we initially click on button:"AddGSP" 
which opens a form waiting for user input.
11th record to be created has only one field value to be changed from 5th 
record.
Instead of manually typing all the fields i want to autofill all the 
formdata based on user textinput .

As the user does not want to fill all the details present in the form, i 
created a input text with "load" button.
If user enter:5 as text input and click on "load" button then the form 
should fill or (load) all the details same as 5th record from database 
and now the user need to modify only the required fields in the current 
form and click on submit creates a new record(say :11th).

Please let us know how to proceed further to load the form with the 
required data.?

Models.py:
=
class ApplyGSP(models.Model):
"""
This class is used to Apply the GoogleSecurityPatches when the user 
requested to apply the GSP
"""
user = models.CharField("User", max_length=100, default="")
model_name = models.CharField(max_length=100, blank=True)
model_no = models.CharField(max_length=100, blank=True)
os_ver = models.ForeignKey(OSVersion, on_delete=models.CASCADE, 
verbose_name="os Version")
chipset = models.ManyToManyField(Chipset)
patch_level_to_be_applied = models.CharField(max_length=200, blank=True)
rel_cycle = models.ForeignKey(ReleaseCycle, on_delete=models.CASCADE, 
verbose_name="Release Cycle")
requested_time = models.DateTimeField(default=timezone.now)
applied_gsp_count = models.IntegerField(null=True,default="")
applied_security_patch_level = models.TextField(default="")
from_sas_url = models.ForeignKey(SourceSASURL, 
on_delete=models.CASCADE, verbose_name="Source SAS URL")
to_sas_url = models.URLField()
def_src_manifest = models.ManyToManyField(DefaultSrcManifest)
# from_manifest = models.CharField(max_length=200)
# to_manifest = models.CharField(max_length=200)
from_sw_version = models.IntegerField(null=True)
to_sw_version = models.IntegerField(null=True)
description = models.CharField(max_length=200)

class Meta:
verbose_name_plural = "ApplyGSPPatches"

def __str__(self):
return self.user + str(self.pk)

My Forms.py:

class ApplyGSPForm(ModelForm):

helper = FormHelper()
class Meta:
model = ApplyGSP

fields = ['model_name', 'model_no', 'os_ver', 'chipset', 
'patch_level_to_be_applied', 'rel_cycle',
  'applied_gsp_count', 'from_sas_url', 'to_sas_url', 
'def_src_manifest', 'from_sw_version',
  'to_sw_version', 'description']

My Views.py:
--
def apply_gsp_request_form(request, id=None):
"""
:param request: Accept http request
:param id: Id of Requested User record
:return: http response
"""
print("Inside Apply Google Security Patch Form:", id)
print("request:", request.method)
print("request.GET:",request.GET)
load_input_value = request.GET.get('loaddata')
print("load input value:",load_input_value)

if id:
action = 'edit'
model = get_object_or_404(ApplyGSP, pk=id)
else:
action = 'submit'
model = ApplyGSP()

message = ""

if request.method == 'POST':
form = ApplyGSPForm(request.POST, instance=model)

if form.is_valid():
new_apply_gsp_request = form.save(commit=False)
new_apply_gsp_request.user = request.user.username
new_apply_gsp_request.save()
return HttpResponseRedirect('/gspapp/ApplyGSPList')

else:
print("when the request is GET ,call ApplyGSPForm ")
form = ApplyGSPForm(instance=model)

context = {'form': form, 'Message': message, 'action': action}
return render(request, 'ApplyGSP.html', context)
ApplyGSP.html:
--
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block static %}
{% endblock static %}

{% block content %}

 

Load



 
Load
 
 




{% csrf_token %}




{% crispy form %}

 

Re: [Django] Trying to open a form on button click getting Error:Failed lookup for key [%s] in %r during template rendering

2019-10-08 Thread Dilipkumar Noone
Hi,

This issue is fixed to me by instantiating the FormHelper() in forms.py.
I referred :
https://django-crispy-forms.readthedocs.io/en/latest/crispy_tag_forms.html



class ApplyGSPForm(ModelForm):
  
*helper = FormHelper()*
class Meta:
model = ApplyGSP

fields = ['model_name', 'model_no', 'os_ver', 'chipset', 
'patch_level_to_be_applied', 'rel_cycle',
  'applied_gsp_count', 'from_sas_url', 'to_sas_url', 
'def_src_manifest', 'from_sw_version',
  'to_sw_version', 'description']
exclude = ['user', 'requested_time', 'applied_security_patch_level']


Regards,
N.Dilip Kumar.

On Monday, October 7, 2019 at 9:07:38 PM UTC+5:30, Dilipkumar Noone wrote:
>
> Dear Django User Group,
>
> I am django beginner.
>
> Please clarify the below doubt.
>
> *Implement Scenerio:*
> 1.I am developing one django app which needs a form on button click on 
> html page.
> 2.on successful submission should display the object created in the list 
> on the same web page.
>
> Below is the current implementation.
>
> when click on "Apply GSP" button getting below error:
> exc 
>
> VariableDoesNotExist('Failed lookup for key [%s] in %r', ('helper', 
>  fields=(model_name;model_no;os_ver;chipset;patch_level_to_be_applied;rel_cycle;applied_gsp_count;from_sas_url;to_sas_url;def_src_manifest;from_sw_version;to_sw_version;description)>))
>
> get_response 
>
>  >
>
> request 
>
> 
>
>
> *Note:* I am using bootstrap4 model using datatarget attribute to render 
> the crispy form using django templates on button click. 
>
> Please suggest how to resolve this issue.
>
> models.py:
> ---
>
> class ApplyGSP(models.Model):
> """
> This class is used to Apply the GoogleSecurityPatches when the user 
> requested to apply the GSP
> """
> user = models.CharField("User", max_length=100, default="")
> model_name = models.CharField(max_length=100, blank=True)
> model_no = models.CharField(max_length=100, blank=True)
> os_ver = models.ForeignKey(OSVersion, on_delete=models.CASCADE, 
> verbose_name="os Version")
> chipset = models.ManyToManyField(Chipset)
> patch_level_to_be_applied = models.CharField(max_length=200, blank=True)
> rel_cycle = models.ForeignKey(ReleaseCycle, on_delete=models.CASCADE, 
> verbose_name="Release Cycle")
> requested_time = models.DateTimeField(default=timezone.now)
> applied_gsp_count = models.IntegerField(null=True)
> applied_security_patch_level = models.TextField(default="")
> from_sas_url = models.ForeignKey(SourceSASURL, on_delete=models.CASCADE, 
> verbose_name="Source SAS URL")
> to_sas_url = models.URLField()
> def_src_manifest = models.ManyToManyField(DefaultSrcManifest)
> # from_manifest = models.CharField(max_length=200)
> # to_manifest = models.CharField(max_length=200)
> from_sw_version = models.IntegerField(null=True)
> to_sw_version = models.IntegerField(null=True)
> description = models.CharField(max_length=200)
>
> class Meta:
> verbose_name_plural = "ApplyGSPPatches"
>
> def __str__(self):
> return self.user + str(self.pk)
>
>
> forms.py:
> --
>
> class ApplyGSPForm(ModelForm):
> """
> This class is used to define the form input fields to apply the 
> google security patches for each user request
> from common SAS board:7620
> """
>
> class Meta:
> model = ApplyGSP
>
> fields = ['model_name', 'model_no', 'os_ver', 'chipset', 
> 'patch_level_to_be_applied', 'rel_cycle',
>   'applied_gsp_count', 'from_sas_url', 'to_sas_url', 
> 'def_src_manifest', 'from_sw_version',
>   'to_sw_version', 'description']
> exclude = ['user', 'requested_time', 'applied_security_patch_level']
>
>
> ApplyGSP.html:
> ---
>
> 
> {% extends 'base.html' %}
> {% load crispy_forms_tags %}
>
> {% block static %}
> {% endblock static %}
>
> {% block content %}
> 
> 
> 
>  data-toggle="modal" data-target="#myApplyGSPModal">ApplyGSP
> 
> 
> 
> 
> 
> {% csrf_token %}
> 
>
> {% crispy form %}
> 
> {% if action == "submit" %}
> Submit
> {% else %}
>

[Django] Trying to open a form on button click getting Error:Failed lookup for key [%s] in %r during template rendering

2019-10-07 Thread Dilipkumar Noone
Dear Django User Group,

I am django beginner.

Please clarify the below doubt.

*Implement Scenerio:*
1.I am developing one django app which needs a form on button click on html 
page.
2.on successful submission should display the object created in the list on 
the same web page.

Below is the current implementation.

when click on "Apply GSP" button getting below error:
exc 

VariableDoesNotExist('Failed lookup for key [%s] in %r', ('helper', 
))

get_response 

>

request 




*Note:* I am using bootstrap4 model using datatarget attribute to render 
the crispy form using django templates on button click. 

Please suggest how to resolve this issue.

models.py:
---

class ApplyGSP(models.Model):
"""
This class is used to Apply the GoogleSecurityPatches when the user 
requested to apply the GSP
"""
user = models.CharField("User", max_length=100, default="")
model_name = models.CharField(max_length=100, blank=True)
model_no = models.CharField(max_length=100, blank=True)
os_ver = models.ForeignKey(OSVersion, on_delete=models.CASCADE, 
verbose_name="os Version")
chipset = models.ManyToManyField(Chipset)
patch_level_to_be_applied = models.CharField(max_length=200, blank=True)
rel_cycle = models.ForeignKey(ReleaseCycle, on_delete=models.CASCADE, 
verbose_name="Release Cycle")
requested_time = models.DateTimeField(default=timezone.now)
applied_gsp_count = models.IntegerField(null=True)
applied_security_patch_level = models.TextField(default="")
from_sas_url = models.ForeignKey(SourceSASURL, on_delete=models.CASCADE, 
verbose_name="Source SAS URL")
to_sas_url = models.URLField()
def_src_manifest = models.ManyToManyField(DefaultSrcManifest)
# from_manifest = models.CharField(max_length=200)
# to_manifest = models.CharField(max_length=200)
from_sw_version = models.IntegerField(null=True)
to_sw_version = models.IntegerField(null=True)
description = models.CharField(max_length=200)

class Meta:
verbose_name_plural = "ApplyGSPPatches"

def __str__(self):
return self.user + str(self.pk)


forms.py:
--

class ApplyGSPForm(ModelForm):
"""
This class is used to define the form input fields to apply the google 
security patches for each user request
from common SAS board:7620
"""

class Meta:
model = ApplyGSP

fields = ['model_name', 'model_no', 'os_ver', 'chipset', 
'patch_level_to_be_applied', 'rel_cycle',
  'applied_gsp_count', 'from_sas_url', 'to_sas_url', 
'def_src_manifest', 'from_sw_version',
  'to_sw_version', 'description']
exclude = ['user', 'requested_time', 'applied_security_patch_level']


ApplyGSP.html:
---


{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block static %}
{% endblock static %}

{% block content %}



ApplyGSP





{% csrf_token %}

   
{% crispy form %}

{% if action == "submit" %}
Submit
{% else %}
Update
{% endif %}


   Cancel





{% endblock content %}

{% block scripts %}
{% endblock scripts %}


Myviews.py:

@login_required(login_url='/gspapp/')
def apply_gsp_request_form(request, id=None):
"""
:param request: Accept http request
:param id: Id of Requested User record
:return: http response
"""
print("Inside Apply Google Security Patch Form:", id)
print("request:", request.method)

if id:
action = 'edit'
model = get_object_or_404(ApplyGSP, pk=id)
else:
action = 'submit'
model = ApplyGSP()

message = ""

if request.method == 'POST':
form = ApplyGSPForm(request.POST, instance=model)

if form.is_valid():
new_apply_gsp_request = form.save(commit=False)
new_apply_gsp_request.user = request.user
new_apply_gsp_request.save()
return HttpResponseRedirect('/gspapp/ApplyGSPList')

else:
print("when the request is GET inside ApplyGSPForm")
form = ApplyGSPForm(instance=model)

context = {'form': form, 'Message': message, 'action': action}
return render(request, 'ApplyGSP.html', context)


*My urls.py:* 

urlpatterns = [
re_path(r'^download/(?P\d+)/$', views.download_filtered_gsp_patches, 
name='GSPExtractFilter'),
path('ApplyGSPList/', login_required(views.ApplyGSPList.as_view(), 
login_url='/gspapp/login/'), name='ApplyGSPList'),
path('ApplyGSPList/requestForm/', views.apply_gsp_request_form, 
name='ApplyGSPRequestForm'),

Re: [Django] Any generalised or optimized way of handling multiple class based generic listviews in django ?

2019-10-07 Thread Dilipkumar Noone
Dear Pradep Sukhwani,

The Below QuerySetUnion functionality will work if you have multiple 
querysets from one model as per my understanding.

How to proceed if i have different number of querysets from multiple models.
 [ say 5 models in my django project ,each has one queryset and context 
data.  ]

This case how to proceed ?
 

Regards,
N.Dilip Kumar.

On Sunday, October 6, 2019 at 1:53:46 PM UTC+5:30, Dilipkumar Noone wrote:
>
> Dear Django Users,
>
> I am beginner in Django .
>
> I have multiple generic list views in my django application where each 
> list is handled under different navigation item of navigation bar .
>
> Still i need to handle few more list views using class based generic view.
>
> Is there any way to generalize or optimize in handling classbased 
> genericlistview which reduces the code size when we need to handle multiple
> lists in django application under each navigation item of navbar.?
>
> *Note*: Each navigation item(webpage) has a list  & above the list we 
> have a search form with filter button to search for a particular value.
>   Each list view handles get_query_set and get_context_data .  
> 
>   *get_query_set *displays to retrieve the list of objects for a 
> specific filter in a model when GET request occurs.
>
>   *get_context_data* used to display the list of  objects and 
> checks if request is GET and requested for a page in a list of pages listed 
> using pagination.
>   If key is a page continues the loop and it returns the context 
> with the list of objects for the requested page as a key.
>
> 
>
>
> ==
> List1:
>
> class GSPDCList(ListView):
>
>
> List2:
>
> class GSPECList(ListView):
>
> List3:
>  =:
>
> List4:
>  (ListView):
>
> *This concept i need to apply in my django app with multiple class based 
> generic views where each listview specific to diff model and filter 
> options.*
>
> *So please suggest and optimized way of handling this requirement 
> to reduce the code size.*
>
>
> Regards,
> N.Dilip Kumar.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0793db4b-7d31-4956-b573-385c09f74234%40googlegroups.com.


[Django] Any generalised or optimized way of handling multiple class based generic listviews in django ?

2019-10-06 Thread Dilipkumar Noone
Dear Django Users,

I am beginner in Django .

I have multiple generic list views in my django application where each list 
is handled under different navigation item of navigation bar .

Still i need to handle few more list views using class based generic view.

Is there any way to generalize or optimize in handling classbased 
genericlistview which reduces the code size when we need to handle multiple
lists in django application under each navigation item of navbar.?

*Note*: Each navigation item(webpage) has a list  & above the list we have 
a search form with filter button to search for a particular value.
  Each list view handles get_query_set and get_context_data .  

  *get_query_set *displays to retrieve the list of objects for a 
specific filter in a model when GET request occurs.

  *get_context_data* used to display the list of  objects and 
checks if request is GET and requested for a page in a list of pages listed 
using pagination.
  If key is a page continues the loop and it returns the context 
with the list of objects for the requested page as a key.



==
List1:

class GSPDCList(ListView):


List2:

class GSPECList(ListView):

List3:
 =:

List4:
 (ListView):

*This concept i need to apply in my django app with multiple class based 
generic views where each listview specific to diff model and filter 
options.*

*So please suggest and optimized way of handling this requirement 
to reduce the code size.*


Regards,
N.Dilip Kumar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7cdeceec-7720-44fb-833f-f30db7c00a12%40googlegroups.com.


Re: Request to provide the details of how to integrate django app with selenium chrome web driver

2019-10-02 Thread Dilipkumar Noone
Hi,

Can some one please share where to place a chrome driver [.exe] file in a
django project which launches a webpage to perform click operations using
selenium.

Please share any document or videos for the same,

Regards,
N.Dilip kumar.

On Wed, Oct 2, 2019 at 3:15 PM Dilipkumar Noone  wrote:

> Dear Deep L Sukhwani,
>
> The below statement clarifies my doubt.
>
> 
> Here, your Django app is running on a different process and you are
> triggering selenium job separately.
>
> 
>
> Thanks & Regards.
> N.Dilip Kumar.
>
> On Wed, Oct 2, 2019 at 10:23 AM Deep Sukhwani 
> wrote:
>
>> Still not clear on what is the automation task. From your original
>> questions:
>>
>> 1.Under one tab ,provide a button name "ApplyGSP"
>>> 2.click on "ApplyGSP" button should open a form ,which required below
>>> input from the user.
>>>
>>>*a)*model_no* b)*model_name *c)*os_version *d)*requested_time *e)*
>>> user *f)from_sas_url g) to_sas_url etc.*
>>>
>>> *3.*once the user submitted the FORM with all the fields from step2,
>>> your app should open a browser with the user specified URL from 
>>> f)*from_sas_url
>>> field* in step2.
>>> 4.Perform few click operations using selenium webdriver.
>>>
>>5.copy the list of records from f) to g)
>>
>> These indicate that you want to perform a particular task using selenium.
>>
>> What is the other task you are trying to run simultaneously for which you
>> want to run the selenium job using celery.delay()?
>>
>> My full understanding is:
>>
>>- You will develop a Django application that meets the
>>above requirements
>>- That Django application will certainly be in running state (only
>>then you will be able to perform visual automation on it)
>>- You will then run a selenium job on the above running Django
>>application.
>>- Here, your Django app is running on a different process and you are
>>triggering selenium job separately.
>>- If on the other hand, the only reason you want to run a Django app
>>is to do the selenium task and then shutdown the Django app altogether, 
>> you
>>can put the whole thing in a single bash script which essentially:
>>   - Starts your Django application using gunicorn or direct call to
>>   runserver or whichever way you want it to run
>>   - Checks that the Django application is up and running
>>   - Triggers the Selenium flow
>>   - If selenium flow returns exit 0 - gets out and shuts down the
>>   Django application
>>
>> Is the above correct expectation correct?
>>
>> --
>> Regards
>> Deep L Sukhwani
>>
>> ᐧ
>>
>> On Tue, 1 Oct 2019 at 23:08, Dilipkumar Noone  wrote:
>>
>>> Hi,
>>>
>>> If i use selenium webdriver regular way in my django app, will it not
>>> cause time consuming to perform the automation task on chrome webdriver ?
>>> So to save the time , can i launch browser and perform automation task
>>> using celery delay() method.
>>>
>>> Regards,
>>> N.Dilip Kumar.
>>>
>>> On Tuesday, October 1, 2019 at 4:13:51 AM UTC+5:30, Deep Sukhwani wrote:
>>>>
>>>> What exactly do you want to use celery for?
>>>>
>>>> Using selenium webdriver the regular way should suffice here.
>>>> Regarding copying from one field and pasting into another, you might be
>>>> able to work with .get_text() method in selenium to read text from one
>>>> field, store it in a variable and then .send_keys() to write that text into
>>>> another field.
>>>>
>>>> *Note: This is a good question for selenium community and you should
>>>> consider posting it there or on Stack overflow with selenium webdriver tag*
>>>>
>>>> On Mon, Sep 30, 2019, 21:29 Dilipkumar Noone  wrote:
>>>>
>>>>>
>>>>>
>>>>> On Monday, September 30, 2019 at 9:22:16 PM UTC+5:30, Dilipkumar Noone
>>>>> wrote:
>>>>>>
>>>>>> I am new to Django.
>>>>>>
>>>>>> I  have a requirement to develop a django application with the
>>&g

Re: Request to provide the details of how to integrate django app with selenium chrome web driver

2019-10-02 Thread Dilipkumar Noone
Dear Deep L Sukhwani,

The below statement clarifies my doubt.

Here, your Django app is running on a different process and you are
triggering selenium job separately.


Thanks & Regards.
N.Dilip Kumar.

On Wed, Oct 2, 2019 at 10:23 AM Deep Sukhwani 
wrote:

> Still not clear on what is the automation task. From your original
> questions:
>
> 1.Under one tab ,provide a button name "ApplyGSP"
>> 2.click on "ApplyGSP" button should open a form ,which required below
>> input from the user.
>>
>>*a)*model_no* b)*model_name *c)*os_version *d)*requested_time *e)*
>> user *f)from_sas_url g) to_sas_url etc.*
>>
>> *3.*once the user submitted the FORM with all the fields from step2,
>> your app should open a browser with the user specified URL from 
>> f)*from_sas_url
>> field* in step2.
>> 4.Perform few click operations using selenium webdriver.
>>
>5.copy the list of records from f) to g)
>
> These indicate that you want to perform a particular task using selenium.
>
> What is the other task you are trying to run simultaneously for which you
> want to run the selenium job using celery.delay()?
>
> My full understanding is:
>
>- You will develop a Django application that meets the
>above requirements
>- That Django application will certainly be in running state (only
>then you will be able to perform visual automation on it)
>- You will then run a selenium job on the above running Django
>application.
>- Here, your Django app is running on a different process and you are
>triggering selenium job separately.
>- If on the other hand, the only reason you want to run a Django app
>is to do the selenium task and then shutdown the Django app altogether, you
>can put the whole thing in a single bash script which essentially:
>   - Starts your Django application using gunicorn or direct call to
>   runserver or whichever way you want it to run
>   - Checks that the Django application is up and running
>   - Triggers the Selenium flow
>   - If selenium flow returns exit 0 - gets out and shuts down the
>   Django application
>
> Is the above correct expectation correct?
>
> --
> Regards
> Deep L Sukhwani
>
> ᐧ
>
> On Tue, 1 Oct 2019 at 23:08, Dilipkumar Noone  wrote:
>
>> Hi,
>>
>> If i use selenium webdriver regular way in my django app, will it not
>> cause time consuming to perform the automation task on chrome webdriver ?
>> So to save the time , can i launch browser and perform automation task
>> using celery delay() method.
>>
>> Regards,
>> N.Dilip Kumar.
>>
>> On Tuesday, October 1, 2019 at 4:13:51 AM UTC+5:30, Deep Sukhwani wrote:
>>>
>>> What exactly do you want to use celery for?
>>>
>>> Using selenium webdriver the regular way should suffice here.
>>> Regarding copying from one field and pasting into another, you might be
>>> able to work with .get_text() method in selenium to read text from one
>>> field, store it in a variable and then .send_keys() to write that text into
>>> another field.
>>>
>>> *Note: This is a good question for selenium community and you should
>>> consider posting it there or on Stack overflow with selenium webdriver tag*
>>>
>>> On Mon, Sep 30, 2019, 21:29 Dilipkumar Noone  wrote:
>>>
>>>>
>>>>
>>>> On Monday, September 30, 2019 at 9:22:16 PM UTC+5:30, Dilipkumar Noone
>>>> wrote:
>>>>>
>>>>> I am new to Django.
>>>>>
>>>>> I  have a requirement to develop a django application with the
>>>>> requirement as stated below:
>>>>>
>>>>> 1.Under one tab ,provide a button name "ApplyGSP"
>>>>> 2.click on "ApplyGSP" button should open a form ,which required below
>>>>> input from the user.
>>>>>
>>>>>*a)*model_no* b)*model_name *c)*os_version *d)*requested_time *e)*user
>>>>> *f)from_sas_url g) to_sas_url etc.*
>>>>>
>>>>> *3.*once the user submitted the FORM with all the fields from step2,
>>>>> your app should open a browser with the user specified URL from 
>>>>> f)*from_sas_url
>>>>> field* 

Re: Request to provide the details of how to integrate django app with selenium chrome web driver

2019-10-01 Thread Dilipkumar Noone
Hi,

If i use selenium webdriver regular way in my django app, will it not cause 
time consuming to perform the automation task on chrome webdriver ?
So to save the time , can i launch browser and perform automation task 
using celery delay() method.

Regards,
N.Dilip Kumar.

On Tuesday, October 1, 2019 at 4:13:51 AM UTC+5:30, Deep Sukhwani wrote:
>
> What exactly do you want to use celery for?
>
> Using selenium webdriver the regular way should suffice here.
> Regarding copying from one field and pasting into another, you might be 
> able to work with .get_text() method in selenium to read text from one 
> field, store it in a variable and then .send_keys() to write that text into 
> another field.
>
> *Note: This is a good question for selenium community and you should 
> consider posting it there or on Stack overflow with selenium webdriver tag*
>
> On Mon, Sep 30, 2019, 21:29 Dilipkumar Noone  > wrote:
>
>>
>>
>> On Monday, September 30, 2019 at 9:22:16 PM UTC+5:30, Dilipkumar Noone 
>> wrote:
>>>
>>> I am new to Django.
>>>
>>> I  have a requirement to develop a django application with the 
>>> requirement as stated below:
>>>
>>> 1.Under one tab ,provide a button name "ApplyGSP"
>>> 2.click on "ApplyGSP" button should open a form ,which required below 
>>> input from the user.
>>>
>>>*a)*model_no* b)*model_name *c)*os_version *d)*requested_time *e)*user 
>>> *f)from_sas_url g) to_sas_url etc.*
>>>
>>> *3.*once the user submitted the FORM with all the fields from step2, 
>>> your app should open a browser with the user specified URL from 
>>> f)*from_sas_url 
>>> field* in step2.
>>> 4.Perform few click operations using selenium webdriver.
>>>
>>5.copy the list of records from f) to g)
>>
>> Please provide your suggestion how to perform this task in a better way.
>>
>> can i use celery application and launch the browser and perform the click 
>> operations using selenium webdriver ?
>> Is there any better way please suggest me.
>>
>> Regards,
>> N.Dilip Kumar.   
>>
>>>
>>>
>>>  
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/87eaa9b9-eccb-4f7c-87b3-3a6a2d6ee8b7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/87eaa9b9-eccb-4f7c-87b3-3a6a2d6ee8b7%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3292dd2d-b5b7-4b65-8d67-8b3276e4f94f%40googlegroups.com.


Re: Request to provide the details of how to integrate django app with selenium chrome web driver

2019-09-30 Thread Dilipkumar Noone


On Monday, September 30, 2019 at 9:22:16 PM UTC+5:30, Dilipkumar Noone 
wrote:
>
> I am new to Django.
>
> I  have a requirement to develop a django application with the requirement 
> as stated below:
>
> 1.Under one tab ,provide a button name "ApplyGSP"
> 2.click on "ApplyGSP" button should open a form ,which required below 
> input from the user.
>
>*a)*model_no* b)*model_name *c)*os_version *d)*requested_time *e)*user 
> *f)from_sas_url 
> g) to_sas_url etc.*
>
> *3.*once the user submitted the FORM with all the fields from step2, your 
> app should open a browser with the user specified URL from f)*from_sas_url 
> field* in step2.
> 4.Perform few click operations using selenium webdriver.
>
   5.copy the list of records from f) to g)

Please provide your suggestion how to perform this task in a better way.

can i use celery application and launch the browser and perform the click 
operations using selenium webdriver ?
Is there any better way please suggest me.

Regards,
N.Dilip Kumar.   

>
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87eaa9b9-eccb-4f7c-87b3-3a6a2d6ee8b7%40googlegroups.com.


Request to provide the details of how to integrate django app with selenium chrome web driver

2019-09-30 Thread Dilipkumar Noone
I am new to Django.

I  have a requirement to develop a django application with the requirement 
as stated below:

1.Under one tab ,provide a button name "ApplyGSP"
2.click on "ApplyGSP" button should open a form ,which required below input 
from the user.

   *a)*model_no* b)*model_name *c)*os_version *d)*requested_time *e)*user 
*f)from_sas_url 
g) to_sas_url etc.*

*3.*once the user submitted the FORM with all the fields from step2, your 
app should open a browser with the user specified URL from f)*from_sas_url 
field* in step2.



 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/486e33ab-3a3d-467c-af57-4e3bed108aec%40googlegroups.com.


[Django][ Pandas] TypeError: crosstab() missing 1 required positional argument: 'columns'

2019-09-22 Thread Dilipkumar Noone
Hi,

I am new to django.

MyTask:
==
while handling asynchronous task in Django using celery i need to export 
some data to excel and need to create a pivotal table from it,
I am using "crosstab" in pandas.[ 
https://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.crosstab.html
 ]

*I have a data frame[df] like below:*
*df :*

# read the specific columns from an excel file.
require_cols = ['ID', 'Category', 'PatchLeve1', 'HQ Domain Owners', 
'LGSIDomainOwners', 'Ownershipstatus']

# only read the specific columns from an excel file.
df = pd.read_excel(excel_name, use_cols=require_cols)


SerialNo RecordId Category SecurityPatchLevel Applicability Description 
GSP_ID HQDomainOwners LGSIDomainOwners OwnerShipStatus 
1 16 Google Security Patch 2019-02-01 O https://www.collab.com/en/20 
CVE_2019_201920 IT1 IT1   
2 17 Google Security Patch 2019-02-01 O https://www.collab.com/en/21 
CVE_2019_201921 Connectivity-GPS Connectivity-GPS   
3 18 Google Security Patch 2019-02-01 O https://www.collab.com/en/22 
CVE_2019_201922 Media-Framework MM   


===
while executing below statement, cross tab i am getting *TypeError: 
crosstab() missing 1 required positional argument: 'columns'*
===

*gsp_pivoted_table= pd.crosstab([df.Category,df.LGSIDomainOwners],margins=True)*

---

print("crosstab for LGSIDomainOwner and ownership status Count")
gsp_pending_notification = 
pd.crosstab([df.LGSIDomainOwners,df.OwnerShipStatus], margins=True)

return gsp_pivoted_table, gsp_pending_notification;


==



Please let us know how to proceed further.


Regards,
N.Dilip Kumar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df08beb7-379f-4a7e-89ca-d5255da18872%40googlegroups.com.


Clarification required django celery,celery and djangoceleryemail compatabilty versions to handle asynchronous tasks

2019-09-21 Thread Dilipkumar Noone
I am new to Django.

I am developing one django application which needs following packages to 
handle asynchronous tasks in the back ground.

1.djangocelery
2.djangocelery email.

App definitions in My settings.py file:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'djcelery',
'gspapp',
'djcelery_email',
#'django_celery_results',
]


But when i install these packages in my virtual environment, I encountered with 
the below errors:


1.I have django-celery - 3.3.1 and celery 4.3.0 initially.

2.when i execute the celery worker command :celery -A gspaat worker 
--loglevel=info

i got the below error:

==

ModuleNotFoundError: No module named 'kombu.asynchronous'

==

As per the message posted in below link,i uninstalled celery version and 
installed latest celery version 4.3.0 . 

https://stackoverflow.com/questions/50511905/cannot-start-celery-worker-kombu-asynchronous-timer


But unfortunately i am facing with below error.

=

ERROR: django-celery 3.3.1 has requirement celery<4.0,>=3.1.15, but you'll have 
celery 4.3.0 which is incompatible.

Due to above error, i installed celery version :3.1.25 using pip install 
celery==3.1.25 but i got the below error 


ERROR: django-celery-email 2.0.2 has requirement celery>=4.0, but you'll have 
celery 3.1.25 which is incompatible.

=



So, please share the compatible version of djcelery , celery and djcelery_email.


Regards,

N.Dilip Kumar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e148eda2-8e6c-4f7b-bc11-321c987eef34%40googlegroups.com.