Wan Fahmi
Hi Guys, It is a bad idea to keep all the main models in the project instead of an app?
Michael the wolf 🐺
Its better to make it portable so you can re use it anywhere
Anonymous
Hello everyone.. Please does anyone know how to use cloudinary to store media files for a django project on heroku?
Wan Fahmi
Thanks
mohammad
Thanks
Your welcome
mohammad
Oh okok...
😂😂
Anonymous
code for the model?
Where to paste code
⚜️
Showing error : <user: mike> token. User must be a user instance
User must be instance, For example: u = User.objects.create(name='mike', surname='Kylie') Profile.objects.create(user=u)
Doragonsureiyā
pip install django
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
Devu
I know that
Bt thn view function which is related to TaskSerializer get error tht no serializer called TaskSerializer
Mirco
Bt thn view function which is related to TaskSerializer get error tht no serializer called TaskSerializer
You just have to add a new field into ProjectSerializer and this new field takes TaskSerializer Everything u need is inside DRF documentation
Mirco
If you wanna more help, share the code via pastebin
Devu
https://pastebin.com/UkFswZi3
Mirco
https://pastebin.com/UkFswZi3
Study more Python and its standards first Second you can solve with the solution I told u if you wanna have tasks inside ProjectSerializer
Devu
Okay thnx
M
Need suggestions on current problem and the way i want to solve it. Problem statement: Need to run python script and show the progress on the webpage. basically a button will trigger script in backend and then results will be shown. My approach: Will receive the click event from button will trigger script in view function in background mode and then return back from view. my progress display will keep on polling to a backend table where inteneded script will put progress after each prefined step execution. so that i can display on front page. in case of failure of script also it will update table row with failed. Any other suggestion to improve my way of handling ? i heard celery task if anyone has example will be thankfull.
M
ty
Naveen
Hello everyone, I m learning django channels and now i m creating chat application(the modified version of official django channels example ). I am confused in to retrieve chat messages from DB. I find ajax is super easy but at same time it will slow the app. Any view, opinion or advice will be helpful.
julesc00
Hi people!
julesc00
Julio from Mexico
Naveen
You may try to use websockets, if the question of connection matters to you.
How i can reteive msges from db using websockets...any source or inspiration will be really good
Naveen
Logic of using django ORM is unrelated to websockets.
I agree with you but i know the ORM logical part. I just don't know where i put the ORM query and get the msg from db without refreshing the page. Can we get the data from db without refreshing the page using websocketss?
Андрей
you can get data by js and update your page with it
Alex
I agree with you but i know the ORM logical part. I just don't know where i put the ORM query and get the msg from db without refreshing the page. Can we get the data from db without refreshing the page using websocketss?
> Can we get the data from db without refreshing the page using websocketss? Websocket connection is persistent. Once you opened it, it will hang in background of a browser and wait for events. > where i put the ORM query You may place such code in the channel's handlers/consumers and use them as usual django views.
Alex
Tukhtamurod
To asynchronously fetch data from server
Alex
you can get data by js and update your page with it
Please, read the whole conversation before giving any advices. The topic starter already said that he tried to use ajax. But ajax isn't persistent - each time you make an ajax request browser will create a new connection. There is no keep alive option. At least explicit.
Naveen
Use ajax
I was planning to but i saw one answer of stackoverflow that ajax is good when user is not making frequent requests and its a bit slow for realtime chat application. That's why I asked for advice in this helpful community
Андрей
yep, my bad, sorry
Alex
I was planning to but i saw one answer of stackoverflow that ajax is good when user is not making frequent requests and its a bit slow for realtime chat application. That's why I asked for advice in this helpful community
> its a bit slow for realtime chat application Yes, it is. As I already said - you cannot create a connection once and reuse it. Each ajax request is independent.
Tukhtamurod
Only option is using web sockets then
Ghorz
My Ajax POST produce empty query set, below is the pastebin https://pastebin.com/iCsmhYv4
Issue resolved, I used a different post method. Other than request.post
Hikmet
Hello everyone. I need help: I created REST Api using django rest framework, and i need to implement dependent dropdown menu between two attributes of my Car's details model, between car brand and car model. I did not find any solution of how to implement it in django rest framework. Can anyone help me?
Mirco
give more context when u share a YT link or reply to a specific message
M
Okey thanks in advance :)
https://www.youtube.com/watch?v=hF0vz_NK4oc
Amit
How to use radio button fields in django????
Doragonsureiyā
How to use radio button fields in django????
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
Anonymous
Can I use email for authentication if I have extended user class from abstract user?
Anonymous
If I have used User(models.Model) in user class am I using built in user class or my custom user class is created
Hikmet
If I have used User(models.Model) in user class am I using built in user class or my custom user class is created
In this case you are using ur own custom class. The built in User object is inherited from django.contrib.auth.models library
Mirco
https://t.co/hYdsNmT7q0?amp=1 Django 3.2 Alpha release, new LTS is coming folks 😁
Anmol
Hey everyone. I am looking for ways to improve my code https://pastebin.com/Cf3K6egU If someone can help, it will really be appreciated
ROG 💻
def get_queryset(self): tmp_queryset = self.queryset q = self.request.GET.get('q') if q not in ['null',None,'']: tmp_queryset = tmp_queryset.filter(document__icontains=q) return tmp_queryset
ROG 💻
Hello everyone, how can I do in my function so that it only looks for the specific data? In this case, icontains searches for similar data, any other recommendations?
Shubham
What's best way to make a ecommerce rest api for beginners in django ?
DD
What's best way to make a ecommerce rest api for beginners in django ?
For beginners practice of rest api I suggest you to serialize the e commerce data and make a simple api
Prateek
Rss feed is escaping html tagss
AMIR HUSAIN
Hi every one I need to get the current user that is intracting with app how do i get this?
AMIR HUSAIN
request.user
You are right if I want to get user in view, but i want to override the save method of 'Comment' model so the author of article can not create comment on her/his article if I made a mistake in view. I write a method in comment model: class ArticleComment(AbstractComment): article = models.ForeignKey(Article, on_delete=models.CASCADE) # check user is article author def is_article_author(self, user): return self.article.author is user I know that I can use this method in view and handle this purpose, but my question is that: is there another way to have access to current user ?
Nitikesh
I need to create directory input field which accepts the uploading of directory and maintain directory tree structure on output template
Nitikesh
Anybody help me with this