Binay Kumar
Django shopping cart with api
??????
SNIR
can i choose the type of a field in django model ?
like color, date, text, email,number ? (html type)
Muflone
Muflone
You have to specify it in the form
SNIR
but how can it store it ?
like email or color ?
Muflone
CharField
SNIR
CharField can store everything ?
and how can i change the type on the form ?
Muflone
CharField stores characters, like an email address and a html color
SNIR
how can i change the type on the form ?
Muflone
In the form you check the data using validate function
Muflone
https://docs.djangoproject.com/en/3.1/topics/forms/
Anonymous
hello beautiful people.
i started a django backend project couple of days ago and the model forms on submit are sending a GET request instead of a POST even when it is specified as post and hence my models are not being sent data through forms.
any debugging methodology would be really appreciated
Anonymous
Anonymous
Anonymous
Anonymous
Anonymous
i have parts of this snippet in views.py file
Anonymous
it validates but on console i see GET request only for some reason
Anonymous
Anonymous
will have the link delivered here in a few minutes
Anonymous
sure.. will check it out and let you know 👍
Anonymous
Anonymous
thanks mate appreciate it
Anonymous
*update i m getting the post update now but the data is not stored in db
Anonymous
thanks i sorted the error out
Anonymous
💡😃glad. to hear tht mate
Binamra
Is there any method that I can compress image quality while uploading in Django?
Rafael
Is there any method that I can compress image quality while uploading in Django?
I'm assuming that you want to do it on a app model. Create this method on your class:
def save(self):
super().save()
img = Image.open(self.image.path)
if img.height > 854 or img.width > 480:
output_size = (854, 480)
img.thumbnail(output_size)
img.save(self.image.path)
Of course there's more efficient ways to do it. But for the sake of simplicity, and 'straight fowardness' that method would be a good start
Binamra
Suraj Rajput
Can anyone please tell me :: context processors implementation in a project
techie
techie
Kd
Yes using api
Suraj Rajput
Anonymous
Any one know about pagseguro payment gateway?
techie
Did you do it from this blog?
Anonymous
Suraj Rajput
Cpt.Zoba
how can i have geomap on my page?(like without apex or google charts can i pass from views something which could create a map for me?)I tried with google charts but it wont drill deep like continent country sates and event handling.
techie
https://youtu.be/QTgkGBjjVYM
.
Any suggestions nothing found helpful on stackoverflow,
Django fails to load/find logstash module when I install in the container it says requirement already satisfied...
When I pip freeze, it doesn't show up there...
Anonymous
👋
Andrej
Andrej
Virtual environment
Mus'ab
Hey,
I am getting this error although when I freeze I can see pillow there
But when I run, I get
Module NotFoudError : No module named 'PIL'
Binamra
jamal
Did u activate virtual env?
Ram Kumar Shukla
Mus'ab
Mus'ab
Ram Kumar Shukla
Anonymous
in django drf. i m sending data.
and its valid and saved.
but in return i want a formated json data.
currently it returns ids only.
is it possible in normal createApiView
Paul
Anonymous
its automatically d9ne
Anonymous
i have not written anything
Anonymous
its default apivie2
Anonymous
view
Anonymous
I have declared this variable "name" in my django template -
{% with name="Python" %}
<h1>{{name}}</h1>
{% endwith %}
When i go to this page in the browser it prints "Python"
as expected but when i try to access the variable "name" outside like this -
{% with name="Python" %}
{% endwith %}
<h1>{{name}}</h1>
It does not print "Python". I want to why it is not printing it. I want to access this variable outside. Is there any way i can do that?
Дауран
Guys I have a question , so I have to create a folder "media " for save pictures from profile picture or it's enough to create a static folder ?
Binamra
Ram Kumar Shukla
Anonymous
Дауран
Дауран
I have a question , so I want to create an app and I want to create 2 pages there ( news and articles ) , after that I want to add articles and news from Django admin but for that I should create " category " in models.py like for news and articles , am I right ?
Binamra
Binamra
Дауран
I just don't want to create an app again for news or articles
Дауран
Binamra
If you want to have category for articles and news model then it will be good to use one model with category and use many to many field if you want multiple category or Foreign Key field
Дауран