Matvey
create view
I don't fully understand how this will help? For view it is necessary to create model if I am not mistaken.
Stephan - TelosCentral
Hi guys. Is there a way to filter out the dropdown box (foreign key relation) in a Django form? So basically, instead of having just a dropdown box, have a combination between a textBox and a dropdown box, but the dropdown box only shows the available options based on the text you type in the textBox? Hope my question makes sense.
Stephan - TelosCentral
Surely, there must be a widget or something for this, but I just cannot find anything on any forum.
Maxim
If I do it, I get some error
ok, there is some decision
Suren
So you can always have the hotel slug to know which hotel is 🙂
Well, I tried it as below: hotel = Hotels.objects.get(slug=self.kwargs['hotel_slug']) and got this error: DoesNotExist at /booking/hotel/1/ Hotels matching query does not exist.
Mirco
Well, I tried it as below: hotel = Hotels.objects.get(slug=self.kwargs['hotel_slug']) and got this error: DoesNotExist at /booking/hotel/1/ Hotels matching query does not exist.
If you can reach the page with the form by using that slug, the hotel exists Otherwise 404 means you don't have the hotel at all
Suren
If you can reach the page with the form by using that slug, the hotel exists Otherwise 404 means you don't have the hotel at all
thanks, found the problem. my template looked like - action="{% url 'hotel_booking' hotel.pk %}", when I changed it to hotel.slug it worked
Smile
Hello. Question about DRF. I have a field that is shown on if GET request, but I want to make it optional on POST and PUT. how to do it? i am using ModelSerializer
S
Can anyone guide me When we r calling api instead of primary key i need another attribute ? How to achieve this
Mirco
Can anyone guide me When we r calling api instead of primary key i need another attribute ? How to achieve this
Why don't you have to call it via pk ? I mean what you can do is to use UUID but you can call it via pk
Mirco
In pk we have emp id bt I don't need id, I need name
It depends on that field is unique or not
S
No it's not unique
S
I need to write custom serializer for that. Bt I don't know exactly how to write custom serializers
Mirco
No it's not unique
So it's not ok
Smile
S
use lookup_field in your view class
Can u plz let me know how to use look_up field
Smile
Can u plz let me know how to use look_up field
try like this https://stackoverflow.com/questions/61452449/how-to-change-lookup-field-in-model-viewset-to-other-unique-parameter-in-django
S
use lookup_field in your view class
I'm using class based apiview is it possible to use lookup_field
Ali
hi use a cart in django after deploy see this error : Object of type Decimal is not JSON serializable
Doragonsureiyā
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Milka
I am new starting django
Milka
Any suggestions for me?
Рашид
I apologize in advance for my wording. Hello. I have a camera table and a camera model table. the camera has a foreign key camera model. the camera api is written with tastypie, but the camera model is written in Piston due to some needs how to get data from the camera model for the camera?
Doragonsureiyā
Any suggestions for me?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Stephen
Hey members, which is the best way to deploy Django project to a website. Must it be hosted by some companies that charges monthly fees or can I just deploy it on my own.
Milka
Hey bootstrap is not showing correct theme
OneRepublic
Hi all, I'm using the dynamic-django-forms app (https://github.com/askvortsov1/dynamic-django-forms) to create a survey form for my project. I've one doubt. I am creating different templates using dynamic-django-forms and want to use them in different places. So for ex; For survey-1, I will use template-1 (form). For survey-2, I'll use template-2 (form) and so on. I want to link each survey instance with its unique form. How should I create the model and link the templates with the survey? I just want to give an option for the user to choose the template and then the template would create a form for him.
Doragonsureiyā
Hey bootstrap is not showing correct theme
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Milka
Because I am using bootstrap in django
Milka
You silly bot
Maxim
It's a django question
it's a bootstrap question
Milka
Django question
Maxim
You silly bot
don't insult the bot
V
How to calculate total amount of cart iteams
Nazim
How to calculate total amount of cart iteams
we don't know how you store them in your database. Need more information
rtg
Good morning! I don´t understand this error, because i created a directory 'applications' for apps, and y apps.py is ok 'applications.person' and in settings is ok 'applications.person... but django show this error:
rtg
File "/home/retegi/Documents/proyectos/django_rest_framework/env/lib/python3.10/site-packages/django/apps/config.py", line 212, in create raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Cannot import 'applications/person'. Check that 'applications.person.apps.PersonConfig.name' is correct.
rtg
I have removed the person app from the applications folder, putting 'person' as apps.py and 'perons' in settings.py. Then I put the app back into applications by putting 'applications.person' in apps.py and 'applications.person' in settings.py and now it recognizes it without problem. I would like to understand the reason. Why do you recognize it now and not before?
Никита
Hello, did anybody encounter problem, that daphne can’t serve uploading of large media file. Im getting 502 error in production. nginx error log’s says “upstream prematurely closed connection while reading response header from upstream”. I think it was caused because of daphne timeout. Actually I’ve tried to pass -t flag in my supervisor command with high value of seconds and it has no result. Also I increased timeouts in nginx. As for small media files, they are load successfully. What is the better way to solve it?
.
Because I am using bootstrap in django
To help you understand, here’s an analogy: bootstrap also runs on electricity, and that doesn’t make it an electricity question. Anyway, you could have been more specific on how you’re setting the Django app to load that theme that isn’t working, in case it really is a Django specific knowledge.
Milka
Tq*
Veridian
I can't revoke celery task with I'd How can I revoke celery tasks
Hello everyone I connected my two services using gRPC But sometimes when I want to send an gRPC request from the client to the server, I get this error: "status": UNAVAILABE "detail": "connection reset by peer" And when I send the request one more time, the connection is established. I don't know where the problem is. Thank you for helping me
Veridian
If I revoked the task it put the same task into "PROCESS" again.
Veridian
Command I run is : celery -A BOT worker -E --pool threads
Veridian
It was working fine with prefork but I need I/O
PR
Hello, what should we use instead of "raise InvalidTemplateLibrary" in version 4 of Django?
Dony Anggara
Hello there , How to make API https://localhost:8000/api/end-point/delete/id with Django ? I still not understand the basic of django restframework ?
Dony Anggara
Yup. You totally don't understand basics.
any documentation to learn from? I do make api for https://localhost:8000/api/patient and https://localhost:8000/api/patient/id with viewsets on django restframework, but I do not know how to make own url for different action , like I want to make url for delete by id but in its own url
Dony Anggara
Are you looking for Django REST Framework documentation? Here you have it: https://www.django-rest-framework.org/
I know , but I cannot find the solution of my problem there, I have not look all the documentation yet , I would like to ask here instead.
Hamad
Hi can some one tell me where could my error could be when my form input field is hidden but i can add or delete data from admin portal for the same model
Hamad
https://linkode.org/#E5yS6DZ5S5SwAUiW3WmFE1
Hamad
so the problem that i am facing is that the input box is not available in my front end. Thanks in advance
Sebastian
Hello. I have a question, how to do it or if there is a library for django that saves data in the cloud but when the device is disconnected it can store the cache but when it comes back and connects it uploads the data?
Riad
DateTimeField is not using my local timezone. How to utilize this setting for enabling current timezone in my models? https://docs.djangoproject.com/en/4.1/ref/utils/#module-django.utils.timezone
Riad
USE_TZ = True TIME_ZONE = 'the one u need' in django settings
but does it updates the timezone according to the visitor's tz?
Mirco
but does it updates the timezone according to the visitor's tz?
no, that's the default timezone Django will use
Riad
another issue, DurationField takes input as seconds, how can I input as total hours:mins:secs?
Mihail
what is the best way to get created django object from redirect response?
Mirco
nothing is there
So maybe is not possible
gaurav
hey can anyone solve my error
gaurav
in django
gaurav
Yes
oky happy share this error
Doragonsureiyā
hey can anyone solve my error
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z!" Just ask directly! The better you are at explaining the problem, the more likely you are to get help. Asking smart questions
Тимофей
Hello! What is this group about?
Maxim
Hello! What is this group about?
read the group description
Тимофей
Ok. Thanks