Akash
Jquery
I am using jQuery to get data in autocomplete. Currently I am using variable by name of user_list that contains all person name from database and this user_list variable is is accessed using jQuery for autocomplete field. But the issue is I have to update this user_list every morning and as well as create a user list in case of Django server restart. So I am not sure what would be the best way to maintain this user_list.
Akash
Django server restart should not occur Use cache as I told u above so you can invalidate it periodically and have less big calls for users list
What do you mean by "Django server restart should not occur" ? What if I deploy a new build or restart server manually?
Akash
That's another case and in that case your cache will be cleared
how to handle that case ? How to Create new cache in case of server restart? I suppose some kind of function needs to be triggered at server start to query db and store data in cache
Doragonsureiyā
Alright. 👍 Thanks for guidance
You're welcome! 😊
Akash
how to handle that case ? How to Create new cache in case of server restart? I suppose some kind of function needs to be triggered at server start to query db and store data in cache
@pyflare but 1 point still remains the same. I do need some kind of trigger that execute function only at server start to query database for the first time. How to achieve that
Mirco
@pyflare but 1 point still remains the same. I do need some kind of trigger that execute function only at server start to query database for the first time. How to achieve that
Study that topic and you will understand that there's no magic Call the query and cache, if cache is not empty you won't make again the query
Anonymous
Hi. Can anyone give me, how to read excel file and how to store the data in database.
Anonymous
Kindly share
Doragonsureiyā
Hi. Can anyone give me, how to read excel file and how to store the data in database.
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box, write down the same words you asked here Step 4: Read the first results
Mirco
Hi. Can anyone give me, how to read excel file and how to store the data in database.
Python has its modules to do it Just read data and use ORM to save inside model
Anonymous
Thank you @micro
Doragonsureiyā
Thank you @micro
You're welcome! 😊
Anonymous
how to save multiple files in django database ? files are coming under a list like [1,2,3,...] like that
Doragonsureiyā
how to save multiple files in django database ? files are coming under a list like [1,2,3,...] like that
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box, write down the same words you asked here Step 4: Read the first results
âshîsh
Can we use jinja along with redirect ?
Mirco
Can we use jinja along with redirect ?
You have to set Jinja in settings
âshîsh
You have to set Jinja in settings
Can i have any guide link for that ?
Mirco
âshîsh
Thanks
Mirco
Doragonsureiyā
Thanks
You're welcome! 😊
Shreeram
I am deploying a django project with react as frontend on signle server and I served them using nginx. It was working fine with http but when I configured ssl certificate the code doesn't look to updated from react side. I am using gunicorn + nginx. I run site at http and call api using https It's also working fine But when we try to run https django site All api are calling using http And there is error of blocked mixed content
Anonymous
Is it possible to automate terminal in django?
Rahul
Is it possible to automate terminal in django?
You want to execute python script from django shell??
Rahul
https://django-extensions.readthedocs.io/en/latest/runscript.html
Rahul
May be this will help you
Anonymous
Thanks
Doragonsureiyā
Thanks i will check and update you
You're welcome! 😊
Anonymous
Can someone tell me good resources for studying Django??? Video tutorials would be better.
Doragonsureiyā
Can someone tell me good resources for studying Django??? Video tutorials would be better.
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Anonymous
codewithharry
Yeah I've heard of this and Corey Schafer
Anonymous
Yeah I've heard of this and Corey Schafer
I learned python from corey and python doc Nice explanations
Anonymous
I learned python from corey and python doc Nice explanations
I learnt python from Telusko and Flask from Corey
Anonymous
Hi aliens
I'm Naveen Reddy and today will learn Python🌚
Michael the wolf 🐺
I'm Naveen Reddy and today will learn Python🌚
I am michael and today i encourage you to look at the pinned messages for the necessary documentations.
Faisal
Error
Place
when i save a new data i got this answer :
Place
The tag “tagtest” was added successfully.
Place
but when i try to access to the data with my django-admin interface i got this error : Tag with ID “None” doesn’t exist. Perhaps it was deleted?
Anonymous
This is spam
Anonymous
#print(p_t.volunteer) Coupons.objects.create( unique_code=uc, registration_no=rc, payment_status=True ) coupon = Coupons.objects.filter(unique_code=uc) coupon.update(volunteer_id = p_t.volunteer)
Anonymous
why isnt my volunteer id saving here
Anonymous
although new object is created and uc rc amd payment status is successfully saved
Anonymous
i tried also doing it by putting volunteer id inside create but its not saving although its printing it correctly in the console
Anonymous
please help
Doragonsureiyā
🚫 ‎Ali Raza [1057616893] is already banned.
Sheshadri
why isnt my volunteer id saving here
try volunteer=p_t.volunteer or volunteer_id=p_t.volunteer.id
Sheshadri
and use update together for efficiency .. like coupon = Coupons.objects.filter(unique_code=uc).update(volunteer_id = p_t.volunteer.id)
Anonymous
Cannot assign "<User: SF9521746566>": "Coupons.volunteer_id" must be a "Volunteer" instance.
Anonymous
try volunteer=p_t.volunteer or volunteer_id=p_t.volunteer.id
showing this error after using second solution
Doragonsureiyā
🚫 ‎Ali Raza [1057616893] is already banned.
Sheshadri
and use update together for efficiency .. like coupon = Coupons.objects.filter(unique_code=uc).update(volunteer = p_t.volunteer)
Anonymous
this is my coupon models
Anonymous
and use update together for efficiency .. like coupon = Coupons.objects.filter(unique_code=uc).update(volunteer = p_t.volunteer)
so using this is showing Coupons() got an unexpected keyword argument 'volunteer'
Anonymous
this
Sheshadri
coupon = Coupons.objects.filter(unique_code=uc).update(volunteer_id = p_t.volunteer)
Sheshadri
remove to_field you are pointing to a different field in your model foreign_key
Sheshadri
and also better remove _id in your field name, django usually uses _id to add using id instead of instance