Binay Kumar
Django shopping cart with api ??????
Daniele
Talking about learning django. Do you guys and girls trust reviews when choosing an online course?
https://www.youtube.com/watch?v=n-FTlQ7Djqc&list=PL4cUxeGkcC9ib4HsrXEYpQnTOTZE1x0uc check this course out - it's free.
SNIR
can i choose the type of a field in django model ? like color, date, text, email,number ? (html type)
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
hi My models.py Contains datetime filed. And i save the datetime in utc format I want to retrieve the alla data from the model.. and i used the code and i got it.. at the same time. I want to convert all my datetime in to local date time.. How can i do this https://pastebin.com/6YmDKqg5
if i remember correctly there is Timezone awareness in Django you can simply use the built-in function to get the same you need to go through the django docs if that doesn't work via tzinfo the pythonic way u can get it
Anonymous
How to avoid duplicate data in media file...for example uploading a profile in user...the image store in different name in encrypted method
you need to have a bass64 img which will match the signature just giving a hint joint to add it in your build works so that it matches the media
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
something like this snippet... plz confirm if u added it than it will work if request.method=='POST': form = Model_Form_View(request.POST,request.FILES) if form.is_valid(): f_name = ModelMeta(fname = request.FILES['fname'].name) f_name.save() return HttpResponseRedirect('/m') else: form = Form()
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
it validates but on console i see GET request only for some reason
have u uploaded the app on git repo if yes can u share link and also the above thing... will check it out and comment there for case
Anonymous
will have the link delivered here in a few minutes
Anonymous
sure.. will check it out and let you know 👍
Anonymous
sure.. will check it out and let you know 👍
www.github.com/crash1604/Spotifylookalike
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
Rafael
ok thanks I will try it
Give me some feedback if it worked
Suraj Rajput
Can anyone please tell me :: context processors implementation in a project
techie
Can anyone please tell me :: context processors implementation in a project
Ya, its not difficult it is used when you want to show some context in all templates of your project.
techie
anyone did razorpay payment gateway integration?
Hey Did you find something how to do it???
Kd
Yes using api
techie
Yes using api
Can you please help me out with that
Anonymous
Any one know about pagseguro payment gateway?
Kd
Can you please help me out with that
https://medium.com/@dk521/integrating-razorpay-with-django-91302dcd9adb
techie
Did you do it from this blog?
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
Can you suggest any resource where i can understand this
https://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/
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
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'
jamal
Did u activate virtual env?
Ram Kumar Shukla
Thanks man, it worked😌
You're Welcome
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
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
if you're validating data with your serializer - then in reponse you can just return "serializer.data" with all your validated fields.
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
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 ?
if you want to save images from ImageField in model then static will not work. You need to create media folder
Anonymous
Your 1st question's answer is because Django looks for its own tags in templates and excute only that part.
Is there any way i can access the "name" variable outside that with syntax?
Дауран
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 ?
Дауран
Can you please explain bit more. What you mean to create category in models.py?
Yeah for example when I add an article or news in Django admin and there should be category like for articles and news separately ( I can choose for articles or news ) , are these correct decision ?
Дауран
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