Anonymous
https://pastebin.com/CsgzhJsT
George
https://pastebin.com/CsgzhJsT
You try to load the model Post but you cant actually do that. You have to load with a for
Anonymous
the output is : blog name posted on :
George
Also you dont use post_set which is your variable
George
For element in post_set <p>post_set.name</p> Endfor
Anders (izzno / gooood) 🇳🇴
wrong variable
Anders (izzno / gooood) 🇳🇴
This is in the default tutoriel
Anonymous
Read tuto
ok thanks
Anonymous
wrong variable
ok what is the correct variable?
Anders (izzno / gooood) 🇳🇴
You are passing it in the context
George
i will try this
It is pseudocode
Anders (izzno / gooood) 🇳🇴
But you dont have to do it like that, if you read the tuto you will se there are standards for this.
Anders (izzno / gooood) 🇳🇴
If you are familiar with python I'd reccomend the mozilla django utorial but its way more info and hard to keep up if you are new to python as well.
Anonymous
thanks for advice but why you don't just explain the problem i'm tired 3 days i'm trying solve the problem before question
Anders (izzno / gooood) 🇳🇴
Because there is not just one problem
Anders (izzno / gooood) 🇳🇴
Its the basic understanding, and you would learn this in one hour if you just followed the small default tut
Anders (izzno / gooood) 🇳🇴
and your variable is post_detail
Anders (izzno / gooood) 🇳🇴
that means post_detail.somethinginyourmodel
Anonymous
Anonymous
Its the basic understanding, and you would learn this in one hour if you just followed the small default tut
i followed the default tut but the problem when i need make something by myself also english not my native language 😊
Anders (izzno / gooood) 🇳🇴
I understand, have a look at: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django
Anders (izzno / gooood) 🇳🇴
This is a very thurough walkthrough and will give you a kickstart.
Anonymous
awesome thanks again
Anonymous
👍👍👍
Anders (izzno / gooood) 🇳🇴
I want to prepopulate a form with data from a user search on the same page, would you use javascript or a serverside module? I was thinking of writing a serverside python module for prepopulating the form...
Anonymous
While serving the form
Anders (izzno / gooood) 🇳🇴
I was thinking to create a "search" page where you can find the correct object, then create an object / or controllform from that.
Anders (izzno / gooood) 🇳🇴
While serving the form
oh, really. How ?
Anonymous
Well, I don't exactly remember
Anonymous
But, when creating a form in the view
Anonymous
You can always put data in it during initialisation I guess
Anonymous
And then serve it
Anders (izzno / gooood) 🇳🇴
yes, but i thought you ment populate the form after the page has loaded based on input in the search form without reloading the view.
Anders (izzno / gooood) 🇳🇴
:)
Anonymous
You'll have to use JS for that
Anders (izzno / gooood) 🇳🇴
mhm... A later version then ;)
Mirco
You can use initial_data to have data when Django creates the form
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
If you did thats what I am going to to based on a users choice of an object.
Mirco
You mean the initial=prefill right ?
Yep, I mean that when you go to the page where you see the form It will already have some field pre-populated
Anders (izzno / gooood) 🇳🇴
yep.
Mirco
Idk if it's what you're looking for
Anders (izzno / gooood) 🇳🇴
Idk ?
Rajjix
Unfortunately that proxy settings is meant for development purposes when i build my app with npm or yarn and serve it from an nginx server the feedback stops from my djangoapi server
Rajjix
Still trying to find a workaround
Anders (izzno / gooood) 🇳🇴
Idk if it's what you're looking for
ah, I was just asking if someone had another way :) Or if that would be considered "bad"...
Mirco
Still trying to find a workaround
Yep, it's for dev purposes On prod, I think the best way is to have your Django APIs served on domain like api.example.com Have a look here
Rajjix
This was pretty useful, thanks 🙏
Mirco
Yw 😀
Rajjix
After a bit of messing with my nginx conf somewhat related to what was suggested in that article i managed to link react server to my api through nginx reverse proxy, still acting a bit weird but i think i’ll manage to fix it from here 😍😍
Luis
Hi guys! I wrote an API REST using django-rest-framework
Luis
Now, when I send POST to my API endpoint the browser block it because CORS
Luis
How do I allow the origin in DJango ?
Luis
I googled about, and CORS requires Access-Control-Allow-Origin header... but, hoy I do in DJango ?
Luis
Ok, I found a package for this: https://github.com/ottoyiu/django-cors-headers
Adarsh
Can the extra field in formset_factory be controlled via views? I mean I want to increase or decrease the extra parameter of the formset_factory from views itself while processing something. Any help is much appreciated.
Anonymous
raise forms.ValidationError ....when creating user ...why?
Mirco
raise forms.ValidationError ....when creating user ...why?
Try to understand which field raises that ValidationError You can see form.errors
Manish
thanks everyone who helped me
Manish
your idea worked i put success_url=/dashboard/password_reset/complete and got working everything
Manish
@iFlare3G @LuchoUY @Rajjix
Mirco
@iFlare3G @LuchoUY @Rajjix
Happy 4 ya man imho it's very strange that Django does not handle that trailing slash We should have a look to its code
Manish
yeah
Manish
i just started working with django from 1-2 week
Anonymous
I mean it's done purposefully
Anonymous
If you're using regex better add it there
Manish
so i don't know what is it a bug or something else
Anonymous
Regular expressions