Pavel
hello everyone, I create DRF + vue cli app and I have a error like this
"Access to XMLHttpRequest at 'http://127.0.0.1:8000/' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."
MIDDLEWARE CorsMiddleware before CommonMiddleware
CORS_ORIGN_WHITELIST = [
'http://localhost:8080',
'http://127.0.0.1:8000',
]
Javi
Sajjad
hello
Pavel
Add origin 127.0.0.1:8080
it doesn't help, may be it is'n working:
class AnimalsAPIViews(APIView):
def post(self, request):
animal = AnimalsSerializer(data=request.data)
if animal.is_valid():
animal.save()
return Response(animal.data)
I will get POST request from vue cli but CORS...
5P34R
игорь/igor
Pavel
Okey, thanks
Pavel
It is already working, thank you
Владислав
Hi everybody. Advise a good editor, modern (not old ckeditor), file uploading (no filebrowser like in Tinymce), easily customizable and compatible with modeltranslations.
Tried: Editorjs, Ckeditor-5, Tinymce, Ckeditor, now trying quill-editor
kuzmich
kuzmich
Владислав
:) thanks.
𝑴𝒂𝒔𝒖𝒎𝒆 🦋
Hi,i have trouble adding the html template to the project,can someone help me?
Optimus
Hi , is there any package to upload multiple file in single object ?
eg- if i want to create an object and want to upload 3 files then 3 separate object should not create , i want a single object in that 3 file attached
Найденов
What's the problem?
Wanna_Phonila
Optimus
tar?
no not in compress format
Optimus
Optimus
Optimus
seems its file compression but will check this
Optimus
Thanks :)
shashikant
i have multiple images in my post model. i want to separate images from post model.if i create another image model and have foreign key relation with post,then while creating post api ,post api have to direct to upload image api.i need help how can i separate model without creating another api?
Optimus
shashikant
can you expalin it more,
Wanna_Phonila
seems its file compression but will check this
https://en.wikipedia.org/wiki/Tar_(computing)
tar creates archive of your files/directories, but not compress them itself. For compression used another programs/formats. If you just want union few files in one - that is task what tar resolves.
highnes
Hi im trying to set a forget password for django, how can a customize the reset password page, im getting the django admin page
highnes
Someone please help
Вин Король Саксов
highnes
https://codeshare.io/6pVxEY
highnes
Ive tried with this url settings still its same
Вин Король Саксов
If you are using your own view and template this shouldn't be happening
Вин Король Саксов
you want to customize admin reset password, or make your own?
highnes
I have set a custom view here
https://codeshare.io/6pVxOO
With urls
https://codeshare.io/nzDq01
.
Can someone please....tell me what is web framework and django... please please
highnes
But now password_reset/done doesn't redirect, it loads the same password_reset page
Jerome
Тимофей
Hey guys. I made a form on my site, help me how to set it up so that the answers are displayed in the admin panel or somewhere else, thanks 🙏
highnes
Вин Король Саксов
Set price depending on what they need
игорь/igor
But now password_reset/done doesn't redirect, it loads the same password_reset page
1. redirect() shouldn't have spaces between function name and parentheses, although it is not error, it is just a better style of writing code
2. pass url-names to redirect, not the actual paths
3. I guess redirect shouldn't be inside your for loop
4. The actual problem is in your urls, because you are using regex without understanding how it works. change every path to path(.....
without regular expressions and dont forget to add '/' at the end of first argument
Almaz
Hello, everyone!
https://dpaste.org/KABz
Please, who can help? I can't find what's wrong
игорь/igor
Almaz
Almaz
игорь/igor
I think you should associate your user to some group from admin part
Fer
I have django 3.2, PostgreSQL 13 and when I try to create/update a model in the database it says:
Blablabla.0001_initial... OK
But it doesnt create any table nor columns... Does anyone came across with this issue?
Fer
I've tried everything, nothing works
Fer
Like
--fake
zero
Deleting databases
Naming differently
...
Almaz
Almaz
I can't continue watch tutorial
Sai Kiran
Hi all, I using clean method in form.py to validate input data, however in logs I can say that input data is not reaching to view.py which says that validation is working. But when I watch tutorials, they are getting the raise errors in HTML page, but not for me
Sai Kiran
I am using form.ValidationError
Sai Kiran
Also I tried using Validationerror from django.core.exceptions
Sai Kiran
Not works, I mean I can see that error in HTML page
игорь/igor
игорь/igor
while being logged in?
Almaz
while being logged in?
No. The error is showed when i tried to go to login page, but not when I tried to log
Almaz
I couldn't logged in, because the page showed error instead of login form
Fer
Charly
Can anyone help me??
Be patient, also you'll need to provide mor information like debug logs details if you are using multiple databases and so on
Charly
Fer
Almaz
Which error?
The problem is already solved. But anyway thanks for attention
игорь/igor
Fer
Fer
😕😕
Anonymous
Hello. What causes any function in views to run twice? In any function I add print ('something') and it is printed twice in the terminal.
игорь/igor
Anonymous
all functions work like that. which code should I show you?
Maxim
Fer
Anonymous
any with this effect
def service_obj(request, service_pk):
service= get_object_or_404(Service, pk= service_pk)
print('yes')
context= {'service': service}
return render(request, 'carmol/service.html', context)