Anonymous
https://pastebin.com/CsgzhJsT
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
Anonymous
Anders (izzno / gooood) ๐ณ๐ด
wrong variable
George
Anders (izzno / gooood) ๐ณ๐ด
This is in the default tutoriel
George
Anonymous
Anonymous
Anders (izzno / gooood) ๐ณ๐ด
You are passing it in the context
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.
Anonymous
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
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
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) ๐ณ๐ด
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.
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
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 😍😍
Mirco
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
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
Anonymous
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
Anonymous
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
Mirco
Manish
Anonymous
Regular expressions