Gil
Start with achieving this, only with html5 and template, later, backend Bootstrap carrousel doc Django template doc Or better,Start all with html5 and 2 images, all static code, then steep by steep
Anonymous
Start with achieving this, only with html5 and template, later, backend Bootstrap carrousel doc Django template doc Or better,Start all with html5 and 2 images, all static code, then steep by steep
Bro all this you are saying am over it I can archive it with static image but I want it to be done using model so that the admin can post images for updates
Gil
pass static location images to model, and loop for i in inside django template to generate each carrousel-item
Anonymous
pass static location images to model, and loop for i in inside django template to generate each carrousel-item
The imagefield itself cant take multiple image so this idea cant solved it have done that
Gil
each image, one obj, multiple obj into this model
Fabian
class ClientesViewSet(NestedViewSetMixin, viewsets.ModelViewSet): serializer_class = ClienteSerializer queryset = Cliente.objects.all() def list(self, request, *args, **kwargs): serializer = self.serializer_class(self.queryset, many=True) json = js.dumps(serializer.data) return Response(json)
Fabian
i basically just want to json encode the response
Fabian
from the listviewmixing
Pogos
Hi, please i need help. ) If i will create virtual env and download django 3, system says that he not have django 3, because you have python 2.7, but i have python 3.8.) How a i can change default start python settings
Pogos
Sorry for my english ))
Pogos
Can you please tell me how to do this?
Pogos
I figured it out
Pogos
Thank you
Current
also if system is not recognizing your python3 in system variables type python3 or pip3
Pogos
ok )
Abhi
I am looking for django developer to develop backend of E COMMERCE ERP backend design IT'S paid project. Developer must have experience in django 3-5 Year. Also portfolio of there work and GitHub
Anonymous
django.db.utils.operationalerror: fatal: ident authentication failed for user "postgres"
Anonymous
how to remove it
Omair
how to remove it
Setup the password for the user you have in your settings.py file
✙Yaroslav
Help someone who doesn t sleep. Children, such question. On the left there is a list of groups on the base page, when you click on one of them, the announcements concerning it are displayed. At this time, in the url address of the id group. Then, when choosing an ad, a detailed info about it opens, and in the urla already id of the group and id of the ad. Under the announcement, the list of commentaries, and the ones you left behind, can be deleted/corrected. Removal and correction I did, but the trouble is, That when you click on a comment that you want to correct, the shape of the correction opens under the url, Where just some-text/ id-comment and everything, and after correction I can t redirect to the announcement, Under which there was a list of commentaries and in the url there were two id, And so at the moment made a redirect that doesn t quite fit in logic. How do I take 3 id from the url and make a normal rediret?
Anonymous
hey
Chiranjeevi
https://github.com/justdjango/django-ecommerce
Chiranjeevi
https://github.com/bradtraversy/btre_project
Chiranjeevi
:)
Ярик
guys, help me pls i need to implement update_or_create method in folowing code: https://dpaste.org/iEP8 it should check if ContractItems object you add already exists and increase its quantity with its value
srikanth
hi guys i want to host my django rest server with static media and accessible database where I can add new files or delete can anyone suggest me platform for hosting my rest server for front end iam using Angular
srikanth
i heard that heroku database support will be paid one
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
which book is best to learn python as well as django faster?
George
!djangotut
Doragonsureiyā
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Jesus
I have created a basic API using Django REST Framework, with a header key "Authentication" and value "Token X". It works fine using Postman but when I try to use it with jQuery in a separate project, it gaves me this error: "has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource." Any ideas?
Jesus
Did you give the token in your request?
Yes, like this: https://pastebin.com/zqRF8i9H
Jesus
Why I dont need it in Postman?
Jesus
Access to XMLHttpRequest at 'http://0.0.0.0:8000/api/get-tasks' from origin 'chrome-extension://ilknfndkanjdgekllmhjmloheiiilnii' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
cj
https://pastebin.com/4GULB44A
what about the django code?
Jesus
https://pastebin.com/K7mT9L52
Jesus
I have fixed this issue using django-cors-headers library
Jesus
https://github.com/adamchainz/django-cors-headers#configuration
Jesus
I think this is the best solution
George
I have fixed this issue using django-cors-headers library
You just have to follow the docs instructions on csrftoken, it's in the django docs and you don't need to install anything
Martin
any one have a django ecommerse project tutorials or codes
cj
I think this is the best solution
I did the same things using a more simple jquery code and I didn't need to use the csrf token 🤷🏻‍♂️, also you're doing a GET, so you really shouldn't need the crsf_token for that
Jesus
I think you have to
I am using AuthenticationToken to access my API
George
mmmmm
Jesus
I did the same things using a more simple jquery code and I didn't need to use the csrf token 🤷🏻‍♂️, also you're doing a GET, so you really shouldn't need the crsf_token for that
yeah, I had the same thing with jQuery before but just because I was going crazy with this issue, i changed to plain javascript, will write it back to jQuery
cj
if you're making a GET request, you don't need csrf_token, something is wrong in you JS code
Jesus
if you're making a GET request, you don't need csrf_token, something is wrong in you JS code
Because I am making the GET request from a Chrome extension, I get this CORS error.
cj
Because I am making the GET request from a Chrome extension, I get this CORS error.
"from a Chrome extension" that changes things a looooooooooooot now
Jesus
yeah, I said it was from a separate project
cj
still, if you're using DRF, it shouldn't complain about the CORS thing 🤔
cj
DRF eliminates the CORS protection for the endpoints 🤔
George
I love it when in the docs it's included but not in vanilla but in JQuery https://gist.github.com/sirodoht/fb7a6e98d33fc460d4f1eadaff486e7b
cj
but, again, if you're using DRF, you don't need the csrf_token 🤷🏻‍♂️ neither if you're making a GET request
Jesus
still, if you're using DRF, it shouldn't complain about the CORS thing 🤔
https://stackoverflow.com/questions/20035101/why-doesn-t-postman-get-a-no-access-control-allow-origin-header-is-present-on?rq=1
Anonymous
Class slide(models.Model): Title = models.charfield(max_length=10) Class image(models.Model): Slideshow = models.imagefield(upload_....) slide = models.foreignkey('slide') View.py I only context the objects out For my template I want the image to work as carousels Please I need help to get object from the foreignkey in my template and 2. If you have another solution to this please suggest I dont want it done using static image
inchidi
You need the csrf token
seems like you guys confused between crsf and cors btw cc @c0x6A
George
:(
cj
still DRF allows you to make requests and no need to mess with CORS
inchidi
https://github.com/adamchainz/django-cors-headers#configuration
this is the correct solution for cors where djago will give extra header response data to let browser allow cors
inchidi
still DRF allows you to make requests and no need to mess with CORS
no, cors is browser thingy and as default drf didnt pass cors header, that package mentioned required to do that (or just pass cors header on the response manually)
inchidi
cors in nutshell is basically browser doing: if request.url != self.url: if self.url not in response.header['Access-Control-Allow-Origin']: raise CORSPolicyBlock()
George
TIL
Doragonsureiyā
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Anonymous
Let's play Django... Who's in?