Anonymous
sry how can i impliment full text search in django?
Anonymous
Help needed: In my Django app i upload a video and display it What i want to do: I want to reduce the file size of the video uploaded I could use ffmpeg, but will the subprocess command work in django app (Or) Is there any other way Thank you
Michael ✨
Hi, I have a query.
Michael ✨
I am making a shopping cart, I have a button that increases the quantity (one by one), but I want to have an "input" in my template, to make it easier for the user, my question is ...
Michael ✨
How can I get the value of said "input" and pass it to my class where is the function to calculate price by quantity.
Michael ✨
https://pastebin.com/mtK1MynZ
Michael ✨
These are my views
Michael ✨
This is my class
Michael ✨
https://pastebin.com/iUU67656
Michael ✨
And this is the part of the Buttons in my template
Michael ✨
https://pastebin.com/4Ym6ij5c
Michael ✨
I hope you can help me ✨
Heigler Rocha
Hi, I have a query.
Check your "Carrito" class, lines 14 and 21. There's a hard coded quantity by 1, you can change that for a dynamic value using 1 as default like: self.request.GET.get("quantity", 1) So, on your template you should have: <form method="get" action="{% url 'carrito:agregar_producto' value.producto_id %}"> <input name="quantity" value="0"> <button type="submit">Add quantity</button> </form> Or do something more fancy with js
Michael ✨
I will try, however I would like not to use much js to make my page faster
Heigler Rocha
Shouldn't I modify something in views?
No, that hotfix should work without touching the view, because you're passing the whole request to the Carritos class
Michael ✨
Ok, I guess for obvious reasons, I don't have to modify the "urls" file either, right?
Heigler Rocha
Yep
Ninad
How to import views from a module
Ninad
In django
Ninad
Anyone..
Doragonsureiyā
Anyone..
Maybe anyone is here, yes, but they are not obliged to read everyone's message here neither to reply to everyone's message, if someone wants to reply to your message, they will do that, just don't try to draw attention to your message writing "anyone?" every 5 minutes, that will lead you to be warned for SPAM/Flood, just be patient or use Google/DuckDuckGo to research about your question instead of wasting time here waiting for people to do your work. Have a nice day 😊
PrB
Hey guys. I'm a beginner in django. Can someone please direct me to a guide for writing tests in django. Also, I have been using mongodb as a database for my website. Has anyone done the same here and faced any problems with mongodb? The website currently has no active users so it will be a good time to change the database (if required). Thank you.
sunita sharma
I was trying to creat Dependent Dropdown list for ..country -> state -> city. I searched a lot but i only found content for .2 dropdown country -> cities .using ajax/jquery only ..Im not even able to modify it for country -> state -> city because i do not have knowledge of ajax/jquery .is there any way to do it without ajax/jquery
Christof
Is it possible to edit a photo
Michael ✨
unsupported operand type(s) for +: 'int' and 'str'
Michael ✨
https://pastebin.com/MKZbwVy3
Michael ✨
Oops, sorry, I could correct it already, thank you very much for your help whispers
V
How to filter a model by current year?
Aleksandr
If you use date time field you can filter by year. Like this: YourModel.objects.filter(some_date__year = 2021)
Dev__master
can anyone help me with how to develop send files api.
Mayur
How to make groups permission with custom user model, Can you please me
Boburbek
You staff the user
Mayur
Through the admin panel
I used Abstract user model to make Users
Mayur
I want to make multi type of uses
Mayur
Custom User showing not showing in group
Mayur
In admin
Boburbek
Not showing
Can you send me skreenshot
Mayur
Yes my laptop death 5 min plz
Boburbek
Ok
Neo
which is best authentication Oauth2 or simpleJWT for a e-commerce webapp?
Neo
Well with django u can use django-oauth-toolkit
do you suggest django-oauth-toolkit over djangorestframework-simplejwt ?
M
Not me, on djangorestframwrok documentation they suggests django-oauth-toolkit, but this is on you, on my APIs I use oauth-tookits and believe me is a good module for oauth2
M
Is there oauth2 for graphql?
IDK but u can check this example, maybe can help u https://gist.github.com/Alir3z4/d69788bb8938c7cba0da12e18b0017af
NIDESH
Any API for automatic DB backup?
Phani
Hello everyone, I am learning Django from a month and I am learning by doing a project .In that I want to take the announcement text (which can be any multimedia data) from the user and should render it in a html page . And when ever anyone request that page I should able to send . Please can anyone help me how can I implement that. 1Q) how can I route the link in urls file Dynamically ?
Doragonsureiyā
Any API for automatic DB backup?
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python
Harish
Any API for automatic DB backup?
You can build one Define a URL and use the python os command to do backups and return a json response If it was successful
Akash
What is difference between b/w update in Serializer Vs View. I am building a PUT request for my model and on Google I come across results where they suggest update method inside Serializer, whereas one existing codebase I am referring has PUT method inside View. Which is correct way ?
Rit
Anyone please help me to get tutorial to "save data from extended templates to django models(models or tables )"
Daniil
Guys, how can I set value to model field when I create it?
Mirco
API
Sopan
whats the best way to print all header/body details of request on the console? (django question)
Mirco
from pprint import pprint ... pprint(response)
No, loggers must be used instead of prints
kuzmich
No, loggers must be used instead of prints
depending on the needs i believe :)
Mirco
Every experienced developer will tell u what I'm saying 🙂
Sopan
Middleware with your logger
I tried logger.. but more work is involved.. it's not printing
Sopan
any readymade solution which I can add into middleware
Mirco
I tried logger.. but more work is involved.. it's not printing
One shot configuration and then easy way to log Django has an entire topic on it
kuzmich
One shot configuration and then easy way to log Django has an entire topic on it
I was telling you about one-time option, not a middleware
Daniil
Guys, how can I set value to model field when I create it?
Like class Example(models.Model): pass = models.IntegerField() self.pass(randint(1,20))
Mirco
I was telling you about one-time option, not a middleware
Middleware is the easiest way to put yourself between request and response so you can have everytime a log of request data , headers etc etc
Daniil
How to do it right?