Edit data from django-ajax-datatable

2021-10-17 Thread Eugene TUYIZERE
Dear Team,

I am using django-ajax-datatable and I have this:
[image: image.png]

The *Edit *button is added from server side as follow:
def customize_row(self, row, obj):
row['edit'] = """

Edit

"""

the table itself is rendered to html from:



$(document).ready(function() {
AjaxDatatableViewUtils.initialize_table(
$('#datatable_membership'),
"{% url 'ajax_datatable_membership' %}",
{
// extra_options (example)
processing: true,
autoWidth: false,
full_row_select: true,
scrollX: false
}, {
// extra_data

},
);

});



when you click the edit button there is an alert showing the ID of the
record.

Then, from the code above, what can I do such that when I click on the
*Edit* button the new window of the clicked ID is showing out so that I can
edit the record?


Thank you for the help

regards,
-- 
*Eugene*

-- 
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/CABxpZHsm%3DBM%3DL%2B5fX1a09Ew8O0nqyYGBh%2BeAFQuALBpgtPMqfA%40mail.gmail.com.


TypeError: dict object is not callable (inside Thread function)

2021-10-17 Thread Hima Bindu chowdary
Hi guys, 


I am getting an error in a program which is using threading to perform 
functions simultaneously, this process is a  job which is run once per 
hour, The data that comes in is from a view in sql.

The function that we call in target arg returns a dictionary and says 
"dict object is not callable".
Inside the function , we return a dictionary in the end.
My doubt is what should we return in this function ..if I dont return 
anything will it affect any other thread??

what my code looks like :
inside the jobs in django I call this function


def ticket_booking():  
  
query = " SELECT * FROM vw_ticket_list;"  

ttd = []
try:
result = query_to_dicts(query)
tickets = json.loads(to_json(result))
if tickets:
# Calling the vaccination push message (php).
for ticket in tickets:

# Getting Generic details used by all categories
full_name = tickets['full_name'] 
gender = tickets['gender']  
email =tickets[email]

if tickets['language_id'] == 1:  #book english movie 
tickets 
   
# Calling the function inside the Thread for a 
Syncronuz Call (Wait and Watch)
myThread = threading.Thread(target=book_english(email, 
full_name))
myThread.start()  
myThread.join()  

if tickets['language_id']  == 2:  # book italian movie 
tickets 
myThread = threading.Thread(target=book_italian( email, 
full_name, gender))
myThread.start()  # Starting the Thread
myThread.join() #Will return here if sth is returned

as you can see in code comments ..if book italian function returns sth , 
only then it can return here and I have 5 threads in total to excute 
simultaneously...book italian function is like :

def book_italian(email,fullname,gender):
try
###posts data to another server #
b=requests.post(some postdata)

 a =log.objects.create(log data from b in crct format)
 return a--->{"Message":"Log created successfully"}

a is type class dict and I tried to change it to many types still gives me 
same error
any suggestions or alternatives,workarounds are welcome, this job is not 
running when run in crontab.

Thanks in advance.




-- 
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/f854bcd9-4ba7-4e4f-b415-8967f253c19cn%40googlegroups.com.