Тимофей
so what is the answer?
I'm sorry I was busy, couldn't answer. the problem was that ubuntu already has a process running on port 80.
Katie
hi
Jahongir
Hi everyone. Is there official django channel on youtube?
Muflone
Hi everyone. Is there official django channel on youtube?
no, the official (written) tutorial is on the Django website
Denilson
How I can do a “Select Dropdown” with values from database, using only html and JS? I do something that works ok, but if a put the .html in another app, doesn’t work.
Denilson
Make query set, return value, catch it it the html
Like this? For me, works only in one app, but I want to put this .html in another app, but doesn't work <select name="paciente" id="paciente" required> <option value="" selected>Select on option</option> {% for paciente in object_list %} <option value="{{ paciente.id }}">{{ paciente.nome_paciente }}</option> {% endfor %} </select>
Shahzodbek
Careful
Are you sending object_list to your page in your view?
Denilson
Perhaps you past Django code here?
<script src="https://gist.github.com/DenilsonRBatista/1a0c34188f84244e9cbac29b994a7b76.js"></script> The dropdown select works from #app cadastropacientes but not in #app cadastropacientes2
KingFx
I have a react app that have a form The data of the form is send to my email adress via an API built whith DRF I want to deploy the So i have to deploy the react app and the django separately what is the best aproach
Caleb
I have a react app that have a form The data of the form is send to my email adress via an API built whith DRF I want to deploy the So i have to deploy the react app and the django separately what is the best aproach
If you are using the backend just for a form, it's better to use a simple backend like next.js or express, instead of hosting a separate system, but if you insist yes hosting them separately is a way to go, you could also serve them together, by connecting Djangos templating system to a vite react app
Tamerlan
https://youtu.be/FcVwDEcu6K0
Anonymous
Good evening all can anyone help me with django investment script here
Doragonsureiyā
Good evening all can anyone help me with django investment script here
No one can help you until you explain your difficulties.
Anonymous
No one can help you until you explain your difficulties.
I want to use it and learn, I have been trying to build it but I couldn't
Maxim
I want to use it and learn, I have been trying to build it but I couldn't
then the answer is no because this is not an explanation
Vlad
hello guys, can anyone explain me why does the following code raises an error in the first loop and does do that in third loop? convos = Convo.objects.filter(user=request.user).order_by("-activated_on") activated_convo = convos[0] # required to evaluate first element of queryset activated_convo.is_activated = True for c in convos: print(c.is_activated) # get an error break for c in convos: c.is_activated = True break for c in convos: print(c.is_activated) # doesn't return an error break because in both cases I'm evaluating the first element of quesryset and set the is_activated attribute to True
Muflone
oh correct
Muflone
what the error reports?
Vlad
what the error reports?
AttributeError: 'Convo' object has no attribute 'is_activated'
Vlad
that kind of bothers me because on stackoverflow the same question wasn't answered https://stackoverflow.com/questions/54396296/why-doesnt-saving-queryset-element-at-index-work-in-django
Muflone
the queryset objects are not mere lists, so I think it generates a new object whenever you loop over it you may check it by printing the convo ids
Muflone
I mean id(c)
Vlad
id is the id of object in db, it doesn't get affected by how django or python treats querysets
Muflone
no id() returns the python object id, not the model's id
Vlad
id(c) changes every time, but that's because the fresh memory is allocated in the heap after every program (view handler) execution
Vlad
if you try something like: a = {"a": 1} print(id(a)) the value will be also different from execution to execution
Muflone
if you try something like: a = {"a": 1} print(id(a)) the value will be also different from execution to execution
this is not important if you read again id(a) later in the same code, you'll get the same id
Muflone
until the variable goes out of scope
Muflone
so the queryset iterator is creating a new object, hence there's not is_activated set to the object
Vlad
oh, of course, that's it, thank you!
Muflone
you may give a try to consume the iterator immediately by using convos = list(convos) and later looping over the convos list I'm not sure but it could work, by giving you the same objects. too late to try here, gn
Vlad
by the way, id remains the same, but since queryset is lazy object I suppose it's changed internally during iteration and any changes not saved by .save method are gone
Vlad
I guess I need to read more about how iterators and lazy objects are working
Vlad
anyway @il_muflone thank you again for your help
AR4IBALD✞
Guys who can help me with Django channels I saw the documentation but I have a problem to optimise it with my project
AR4IBALD✞
Shaheen
I can't display uploaded image, anyone pls help me
Shaheen
log:Not Found: /media/image/Me.jpg
Naseem
Package that can be used for existing authentication and also social authentication??any suggestions
Masoud
Hello friends I had a model, now I added some records and commands python manage.py makemigrations python manage.py migrate I enter it in the terminal of my project, but my records are not added to my table. I even deleted the migrations folder with its junk files and rebuilt it from the beginning, but again, they are not added to my database, and it is the same as the previous table.
Toto Syrax
YouTube using django right? Is that only for just user authentication or other things? Is there anyway to clear this kinda doubts
x-yro
Hello guys, i have a question. How i can filter products in already filtered page? For example, when ur searching anything in ebay, let's say ipad, ur getting list of these product, and u can also filter them by price or anything.
x-yro
you can use Q
This is don't work for me because, at the beginning I need to filter the products by their names, and after receiving the page, filter by price, if I use Q, then I will need to prescribe all the filters at once
Jahongir
This is don't work for me because, at the beginning I need to filter the products by their names, and after receiving the page, filter by price, if I use Q, then I will need to prescribe all the filters at once
can you use two serializer? you'll filter products by name in the first serializer. then you'll filter by prices in the second serializer.
x-yro
can you use two serializer? you'll filter products by name in the first serializer. then you'll filter by prices in the second serializer.
im sorry but im not using drf or django api yet, is it possible to create this functionality by using normal django?
Jahongir
im sorry but im not using drf or django api yet, is it possible to create this functionality by using normal django?
example: def products_page(request, query): products = Product.objects.filter(name__icontains=query) kwargs = request.GET price_up = kwargs.get('price_up') price_down = kwargs.get('price_down') if price_up: products = products.filter(price__gte=price_up) if price_down: products.filter(price__lte=price_down) return render(request, 'products.html', {'products': products}) Do you understand what i am saying?
x-yro
x-yro
can you please tell me how to implement it?
Muflone
x-yro
Are you using get or post?
yes im using get method
Muflone
yes im using get method
It would be more simple using post, as you can send as many data you want
Muflone
Using get you should pass a unique string (via JS) with commas how many arguments you need?
x-yro
It would be more simple using post, as you can send as many data you want
just 3 and i have an another question. how can I enter the search parameters in the path as it was in re_path, something like search/?P<q>/, I had the idea to create a new class and switch the filtering by price there.