Ferrum
how to find the top rated tutors? i have this serializer.py class RatingsSerializer(serializers.ModelSerializer): user = UserSerializer(required=False) rate = serializers.IntegerField() student_id = serializers.IntegerField(write_only=True) tutor_id = serializers.IntegerField(write_only=True) class Meta: model = Rating fields = '__all__' extra_kwargs = { 'rating': {'decimal_places': 1} } def save(self): data = self.validated_data rate = data.get('rate') student_id = data.get('student_id') tutor_id = data.get('tutor_id') tutor = User.objects.get(id=tutor_id) student = User.objects.get(id=student_id) if tutor.profile.rating.filter(user__email=student.email).exists(): rating = tutor.profile.rating.get(user__email=student.email) tutor.profile.rating.remove(rating) rate = Rating.objects.create(user=student, rate=rate) tutor.profile.rating.add(rate) return tutor rate = Rating.objects.create(user=student, rate=rate) tutor.profile.rating.add(rate) # tutor.profile.rating.save() return tutor and this in views.py def rate_tutor(request): data = request.data serializer = RatingsSerializer(data=data) if serializer.is_valid(raise_exception=True): serializer.save() return Response({f'you have rated this tutor {serializer.data.get("rate")} stars'}, status=status.HTTP_201_CREATED) return Response(status=status.HTTP_501_NOT_IMPLEMENTED)
Anonymous
Someone use roidmi b1 when programming?
Kims
How to get the origin of an HTTP request?
Thiago
has anyone used the chatterbot library?
Baku
15 years Django
Doragonsureiyā
has anyone used the chatterbot library?
Please don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello I need help on $z" Just ask about your problem directly! With a very high amount of people here the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Anonymous
What server should I use in production nginx or Apache what should be better
Виктор
Is easy way to study
Rohan
Caddy for newbie
Newbie + production don't go hand in hand
Виктор
Newbie + production don't go hand in hand
Caddy better then Nginx with bad nginx config
Виктор
Have better default setting
Rohan
Caddy better then Nginx with bad nginx config
Yes, you're better at running compared to Usain Bolt without legs.
Виктор
Yes, you're better at running compared to Usain Bolt without legs.
In my company we have super system admin to this question, he used nginx+apache2 in stack. Because in production we needs good security.
Cheap
Caddy better then Nginx with bad nginx config
what do you mean by bad nginx config?
Rohan
Cheap
A bad config 🤷‍♂
i asked if he meant nginx has bad default config as he pointed caddy has good default config
snc
what do you mean by bad nginx config?
maybe not properly configured web app service
Виктор
Nginx config for production is really difficult. Because is balancer.
snc
but default should not be a problem. :/
Виктор
so you should say it difficult and not bad
Yes, if u don't know many about nginx, in 80% u have bad config
snc
so you should say it difficult and not bad
more like not friendly to newbie
Cheap
Yes, if u don't know many about nginx, in 80% u have bad config
you are not getting point, you said nginx has bad config while u meant it is difficult.
Anonymous
How to install django in Windows 10
Anonymous
Can related_name be same for multiple fields in the same model? @rashmi_rox
Bheeshma
How to install django in Windows 10
Type exact words in Google
Subhajit
How to install django in Windows 10
Make virtual env install django
Виктор
👍
Install docker, docker run django
Anonymous
How to install django in Windows 10
I want video for installing django
Anonymous
Hey whatsup guys, I am currently working with django rest framework, postgres with docker, and am following a course. I have studied docker and understand most of its concepts, but just cannot wrap my head around the concept of services.. I just dont get them. I understand docker-compose and that it contains the config for running the app, but dont understand the whole idea of services
Виктор
If don't work in this, u not fully to understand
Виктор
Academic knowledge is not practical
Anonymous
I understand the whole point of microservices, but i do not understand how these services are linked to our containers... how they are linked, and what their exact link/correlation to containers is
Anonymous
when we run these services, do the containers run?
Mirco
How to install django in Windows 10
On official docs you can find installation tutorial
Anonymous
On official docs you can find installation tutorial
I have installed but error is coming
Mirco
I have installed but error is coming
If you don't share the error , it's hard to help ya
Anonymous
Doragonsureiyā
OK I will take screenshot and send you
Read the rules before any activity: @PythonRules
Sai
It will give you the error
Anonymous
Okay
Maxim
Hi all, please help me. How I could return response with file to download with html request body?
Maxim
Now I return render in order to update page in post request and want to return response either
Mirco
Hi all, please help me. How I could return response with file to download with html request body?
You need to change the Content Disposition header https://docs.djangoproject.com/en/3.0/howto/outputting-csv/
Mirco
Documentation uses CSV but you can use the file type u need
Maxim
Ok thanks. But in this example function returns only one response without update html like as render(request, '.html', {'file':file})
Maxim
I want to return such values either
Maxim
If I add such response to my render as third parameter, my page doesn't update
Maxim
Only file will be download
Jon snow
anyone her good at responsive webdevelopment
Jon snow
*here
Jon snow
i need a simple help
Doragonsureiyā
anyone her good at responsive webdevelopment
Your question is not related to Django. Please move to @PythonOfftopic group and ask there.
Bagas
Lost get_xxx_display when use values() in queryset 😥
Dinesh
Hi, I'm working on Django and Angular. I installed django framework. Do I have to add serializers.py and API.py files manually?
Dinesh
Yes, otherwise pay someone to do it 😛
Ok I thought these files will be added automatically to my application
Dinesh
Ok
Dinesh
Thx for swift help
Doragonsureiyā
Thx for swift help
You're welcome! 😊
Dinesh
If I add files manually do I have to update any settings file or any other place?
---
CKEDITOR working properly on localserver but after deployment on webserver its not working
Hello world
hey can any one know gulp
Doragonsureiyā
hey can any one know gulp
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python