Alex
I can't see range there
>PRODUCT_QUANTITY_CHOICES
Harry gorilla
Harry gorilla
I would be happy if that selection was replaced with a text field. Users are supposed to feed any number they want. That selection way makes it limited
Harry gorilla
use forms.IntegerField()
Without any parameters inside it?
Alex
Without any parameters inside it?
parameter min_value=0 ,Since quantity can't be negative
Harry gorilla
parameter min_value=0 ,Since quantity can't be negative
Thanks, actually min_value should be 1 right?
Ivan
does anyone know how to get a session variable from __init__ inside a forms.ModelForm class?
Ivan
get_form_kwargs
is it available also for ModelForm? (Pdb) self.get_form_kwargs *** AttributeError: 'ApiKeyForm' object has no attribute 'get_form_kwargs' (Pdb) self.__base__ *** AttributeError: 'ApiKeyForm' object has no attribute '__base__' (Pdb) self.__class__ <class 'app.forms.ApiKeyForm'> (Pdb) self.__class__.__base__ <class 'django.forms.models.ModelForm'>
Ivan
for instance, I am using django 3.2.12
Harry gorilla
parameter min_value=0 ,Since quantity can't be negative
How can i make the value start with 1, currently, it starts with an empty space
Harry gorilla
Harry gorilla
initial=1
Is it possible to make currency look neat, eg, after three zeros, put a comma, example $10,000
AL
when I write this field in the model order_item = models.OneToOneField('PrepOrderItems', on_delete=models.CASCADE) does that mean that I'm fetching the PK of that table PrepOrderItems and putting it in this variable/column order_item? If yes, and that means that whenever I write the table/model name as the first parameter in the OneToOneField that will be retrieving the primary key of that second table always?
Kavi
Is it possible to deploy Django app in google cloud functions?
Kavi
We can deploy using compute engine,app engine,cloud run..but I need to make use of only cloud functions to deploy Django app
Angel
Is there a way to sent a redirect (to remote server) with a custom header… like Auhtorization?
Ravi
Anyone please tell me what is the best way to learn Django and resources??
https://docs.djangoproject.com/en/4.0/intro/tutorial01/
Daniel
Hello anyone can help me to realize two step login in admin panel. 1 form is email and password; after this email code sended to user email; 2 form is code from email and OTP code from GA I can pay for helping me🙏
Prashant
Hi guys , i want to know how to do the code for category and sub- category , there are 5 columns ... Category id , category name , root category , parent category and technology(T , S , A ,V ) If tech = T ,root category =1 , parent category = 0 , then category details will come in category coloumn , i have done that . Now if category id = parent category id , then the sub category of that category id will come in sub category coloumn.
Prashant
Can someone pls tell how I can do
Richie RH
#ask, which is the most comparable in the scope of cms technology like wordpress but in django / python in general ?
Adhil latheef
In django orm.....how to write an exclude...it exclude objects only satisfy two conditions...??? Example: only exclude If field1=a and field2=b
𝒮𝒽𝒶𝓏
Anyone who can help me to find sources to practice writing unit test cases in python
Егор
Anyone who used django-oscar here, do you know how to disable payments app from oscar? The idea is to allow users to get an order number from the website and pay for it with our telegram bot. I know oscar provides “hidden_features” but when I add “payments” there it’s still viewable on the website
Doragonsureiyā
Hello anyone can help me to realize two step login in admin panel. 1 form is email and password; after this email code sended to user email; 2 form is code from email and OTP code from GA I can pay for helping me🙏
Rule 🔟: Job-related offers are only allowed in the offtopic group. To not be considered spam, Job offers must include: • Skillset/techstack • Contact information • Brief job description • Pay figure • And can only be posted in @PythonOfftopic.
Brutus
i want to store multiple selected checkboxes value in jsonfeld in django model. any help ??
Brutus
There is jsonfield in django models
yeah, i know but not able to store in it
Aydın
hi I have a url address as follows; home/heartbeat/ This url is receiving a request from another device (I can't interfere with the device) as follows home/heartbeat/mac=d8-80-39-e7-dc-27&card=1654637187&protocol=- here is how i should handle get request starting with mac in django url. Should I apply regex? I can receive the get request manually with a question mark (?mac=d8-80-39-e7-dc-27....), but the device sends the request without a question mark. What path should I follow? Thank you
Ruchit
Treat mac=d8-80-39-e7-dc-27 as a slug and catch it in your view.
Ruchit
Rest "&" will be your normal get request dict
Anonymous
Why is value_list ('id', flat=True) returning a query set?
Maxim
Why is value_list ('id', flat=True) returning a query set?
because nobody wants to get a memory overflow QuerySet behaves like a list, but does not take up the memory that a list would take up
Maxim
google lazy evaluation
No one
Hello İ wanna to begin learning Django. İ don't know anything about Django. Who can recommend a good tutorial for me?
Doragonsureiyā
Hello İ wanna to begin learning Django. İ don't know anything about Django. Who can recommend a good tutorial for me?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Rutherford
I'm trying to serve my django app using gunicorn. I start gunicorn using the command gunicorn --bind 127.0.0.1:8000 config.wsgi:application --log-level debug. However when i visit http://127.0.0.1:8000, there's no response. Heres the dubug log https://pastebin.com/bpRyaxjD Please help
Michael the wolf 🐺
you trying to access port 800 ? missing extra 0
Rutherford
Any logs?
https://pastebin.com/bpRyaxjD
Егор
Set —workers option to configure amount of workers
Neo
How would you implement something like a OneOf validation in a serializer? Similar to using Union in something like pydantic
D
Guys, has anyone come across this error? [Errno 2] No such file or directory: 'wkhtmltopdf' Everything works locally. But on the server I get an error... wkhtmltopdf added to requirements.txt. Who knows how to fix this?
D
make sure its installed and in your path
Can you be a little more specific?
Neo
Make sure wkhtmltopdf is installed in your remote server. Make sure it's available in path so it can be called if not call it using absolute path
D
Make sure wkhtmltopdf is installed in your remote server. Make sure it's available in path so it can be called if not call it using absolute path
My devops said that all is ok. the place - /usr/bin/wkhtmltopdf But when I wrote this to settings Like WKHTMLTOPDF_CMD = '/usr/bin/wkhtmltopdf’, I also had problems
Neo
What problems
D
[Errno 2] No such file or directory: '/usr/bin/wkhtmltopdf'
Neo
Then it's not there
Neo
If you installed via pip it won't be in usr/bin i reckon
D
Then it's not there
Is this the only option? Or maybe there are some other pitfalls?
D
Via pip, and also in startup.sh script,- apt install -y wkhtmltopdf
Neo
Via pip, and also in startup.sh script,- apt install -y wkhtmltopdf
Well there's no way to know if that installation worked
Neo
As for pip i believe that it would only be available in path if the venv is activated. I am assuming you have a venv in your production environment
Neo
Hm, thanks, I'll keep looking for options.
what are the contents of startup.sh
Neo
Although i think you should move to @pythonofftopic
D
what are the contents of startup.sh
a startup file named startup.sh in my project’s root folder
Neo
a startup file named startup.sh in my project’s root folder
Yes i was asking about the contents of the file also this is no longer in the scope of django if you wish to continue discussing this you should join me in the offtopic group
Isha
Docker how to run pip requirements.txt only if there was a change?
Isha
after build i add new package in requirements.txt
Doragonsureiyā
Docker how to run pip requirements.txt only if there was a change?
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python