SomeBody
https://monosnap.com/file/3UHbYtZbgaHQcFKQ3Yy0R6cqUcdOSt https://monosnap.com/file/NMVbwTxLbblc73kBPCGJ93GzAxQ5Rc hello, i have querySet with annotate fields(likes and count_comment). How I can serialize this fields?
SomeBody
You have already added count_comments in fields, you just miss likes
https://monosnap.com/file/YmowVaknfGJtwUr5yrDJH83YneHvTS :(
SomeBody
Ok, thx
Mirco
likes = serializers.IntegerField() count_comments = serializers.IntegerField()
Mirco
And DRF should not throw errors again about model fields
SomeBody
https://monosnap.com/file/FWobhTHbl3APtxMGwMEBL6GBPABMOT again...
Mirco
https://monosnap.com/file/FWobhTHbl3APtxMGwMEBL6GBPABMOT again...
Specify it in fields In your screenshot it isn't inside fields tuple The error is different 🙂
SomeBody
thx very much <3
Mirco
Is it working now ? 🙂
SomeBody
yes!!
Mirco
😎😎
SomeBody
mb you know how i can serializer django-imagekit fileds?)
Mirco
mb you know how i can serializer django-imagekit fileds?)
Check if the package provides some custom serializer fields I have too few info to help u
SomeBody
okey, thx u
Mirco
okey, thx u
They are files so in serializer you can return the media URL to them
SomeBody
They are files so in serializer you can return the media URL to them
i am beginner in DRF, i know how use default serialzers class, mb you can give advice me what i can read about this?
Alkaif
How can I add the dynamic value in django-paypal payment
AL
I'm trying to populate this dropdown list Check Merge Options with the orders which I get from calling this method find_merge_targets() (which is defined in the models.py inside the PrepOrder model) in the models.py But I'm not getting anything populated inside this dropdown, why is that? can anyone please take a look at my code and tell me where I'm getting it wrong?
AAYUSH
Can i get some help in Add to cart functionalities ????
Doragonsureiyā
Can i get some help in Add to cart functionalities ????
Not until you explain your difficulties.
Doragonsureiyā
I'm trying to populate this dropdown list Check Merge Options with the orders which I get from calling this method find_merge_targets() (which is defined in the models.py inside the PrepOrder model) in the models.py But I'm not getting anything populated inside this dropdown, why is that? can anyone please take a look at my code and tell me where I'm getting it wrong?
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain: - what you're doing - what you're expecting - what you're using - where you're running the script - what Python version you're using - what packages and their versions you're using - and the most important thing: show the code YOU wrote (read rule 5️⃣ for that) and more details, that way your chances to get help will increase
karakurt
I’m building e-commerce web app using django 4.0.2 and i want to build add to cart functionality on my e-commerce project… i am running python 3.10
I recommend you Antonio Mele's book Django 3 by example. There are 3 chapters about e-commerce shop (with cart functionality)
HamidReza Fekri
Hello have you ever use pyotp???
HamidReza Fekri
Hello have you ever use pyotp???
How to get value of this to send verification code
Rijil
It's a prebuilt ecommerce site built on django
Rijil
You can customise it for your use
Doragonsureiyā
How to get value of this to send verification code
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Dana
Hello! Could you help me solve this problem please? When I get data from database, fields displayed None
Dana
how i can solve it
Dana
bookcrossing.Author.None; bookcrossing.Condition.None
Doragonsureiyā
Hello! Could you help me solve this problem please? When I get data from database, fields displayed None
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain: - what you're doing - what you're expecting - what you're using - where you're running the script - what Python version you're using - what packages and their versions you're using - and the most important thing: show the code YOU wrote (read rule 5️⃣ for that) and more details, that way your chances to get help will increase
Dana
I crated Models then Forms; for example bookname = models.CharField(max_length=100) ; genre = models.ManyToManyField(Genre, verbose_name="жанры") , but when I try to display this genre on my html, with code class BooksView(Genre,View): def get(self, request): books = BookUpload.objects.all() return render(request, "bookcrossing/books.html", {"books":books}) bookname are displayed, but genre not ,
Dana
{% for book in books %} <div class="card_item" > <div class="card_img" > <img src="{{ book.image.url }}" alt="" width="180px" height="270px"> </div> <h1 class="card_title" >{{book.bookname}}</h1> <p class="card_subtitle"> {{book.author}}</p> <div class="card_footer" > <p class="card_price" >{{book.price}} ТГ</p> <p class="card_address" "><a href="books/{{book.slug}}">Read More</a></p> </div> <div class="like" > <img src="{% static 'css/like.svg' %}" alt=""> </div> </div> {% endfor %}
Dana
bookname, price are displayed, but m2m fields are not
Artyom
Artyom
Like this: print("Hello World")
Tuấn
Please, help me.
Tuấn
I try "CORS_ORIGIN_WHITELIST = ['xxx.com]" but still error
Tuấn
?
I added in settings "CORS_ORIGIN_WHITELIST = ['xxx.com']"
Tuấn
error "Origin checking failed - https://xxx.com does not match any trusted origins."
Bekhruz
error "Origin checking failed - https://xxx.com does not match any trusted origins."
have you included the CORS Middleware in your settings like this : 'corsheaders.middleware.CorsMiddleware'
Tuấn
MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ]
Dana
How to solve problem "Enter a list of values." in form? but my fields are not connected with m2m
Hrutuja
Hello everyone,please help me
Hrutuja
I'm making the Django app and need parsing some data from the UDP socket.what can help me handle UDP socket very easy, when I embed it to Django project, it doesn't run. how to embed it to Django?
Hrutuja
Please suggest any way or if have any tutorials
Nana
Check django oscar
Please where can I get it
Pedro
#Question Django: hello there is a structure: car brand->model range toyota: --Camry --corolla --cruiser Nissan: --beetle -- qashqai --tiana need form 2 field ModelChoiceField . The first selects the brand, the second displays only those models that match the selected brand. for example, when choosing "Toyota" in the first field, in the second one there should be a choice only from [Camry, corolla, Cruiser] (on auto.drom.ru - how it should work) I'm sure nothing complicated, but the second day I can not google the solution. Thanks
Matuo
Hi gusy, guys when i want update my user profile picture, and send image for my view in if form.is_valid():
Matuo
give me this error: expected str, bytes or os.PathLike object, not ImageFieldFile
Javlonbek Torajonov
Who know django model translation
Doragonsureiyā
Who know django model translation
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z!" Just ask directly! The better you are at explaining the problem, the more likely you are to get help. Asking smart questions
shiva
How to filter data in sqlalchemy
shiva
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 😊
shiva
I have to filter and delete that data from the table
Rohan
I have to filter and delete that data from the table
The docs are pretty clear on how to do that.
Doragonsureiyā
Tuấn
error "Origin checking failed - https://server.com does not match any trusted origins."
Prashant
Guys , I'm getting ajax not defined error in dependent select in script and views.py Can anyone pl tell how to solve the ajax not defined error
waran
after execution Source doesn't exist what's the problem .....?
waran
My html file not displaying that problem given the TEMPLATE DON'T EXIST
D
Place the template folder in root folder..and add [BASE_DIR, 'templates'] in settings.py
AK
Any good tutorials for learning django rest framework completely?