22:35 A better way to save users input does it this way: if request.method == 'POST': object = Weather.objects.create(city_name=request.POST['input_text']) # Give input tag an attribute name to access it object.save()
Great content! Can you please give an overview of how youd go about saving the responses from the api to the database? For example, for the purpose of listing the weather over a period of time while adding a new row for the daily weather. Itd be a huge help!!
thank you so much man! i created my first weather app... its working and displaying one city at a time.. that means there is some problen with for loop.. when u was able to display 3 cities in my case only melbourne was displayed.. but still it works..thats what matter 👍
I got the same issue because I was using the final version of index.html code while I was still at the initial phase. The problem was in this python line in jinja format -- {% for city_weather in weather_data %} to {% endfor %} -- in index.html. In starting, there is no "weather_data" variable (only city_weather), so you got nothing in the city_weather variable. To avoid this, I commented both these lines as, . But this even worsened the situation as then the whole block between these lines is disabled! And that's weird as it is the standard way of commenting the html code. Anyway, the solution is to remove both these lines from the html code until you get there in the tutorial.
I've done everything step by step and for some reason my image,description and icon isn't showing I have my api with me but i don't really know the problem for sure...you mind helping out?
All the videos are very helpful..Please add some more videos with developing a full website with django and REST please.Elaborate REST Framework more please
hi ! i faced a issue that if i deleted all the cities from db then also in the web one city is fixed and everytime i refreshed the browser the no of the same city increases with the same value. What is the solution ?
Love your videos. Would you consider a Django tutorial that demonstrates how to use external api data as a way of tracking performance? Similar to your Fortenight Flask tutorial, but also store the data in a db and show trends of a player that a user can interact with.
How did you get vs code to use intellisense from the bash on windows version of python? Do you have python and django installed on the windows side, then installed them on the bash side?
how to not accept same city? i accidently reload form and resubmit the form and found that it can show same city multiple times. what to do so it wont do it.
Hey Anthony, just wondering could you assist, I have a ValueError at / The City could not be created because the data didn't validate. error, I see that the code in the video is different from GitHub repo, I can post my repo if needs be , Thank you for assistance Big fan of your pythonic skills, Regards, Clive
At 7:28 there is a command "pipenv install requests", I was trying the command in cmd window, but it shows an error "'pipenv' is not recognized as an internal or external command, operable program or batch file." Can you help me with the issue?
@@prettyprinted No, I didn't back then, but later I have installed it, and the projects is running without any error by now. Thank you for weather app project, it helped me a lot for project development as a beginner. Thanx.
hello, I didn't understand why u passed input from Django forms ({{form.name}}) , as I don't know Django forms concept I am finding it little difficult to understand, could u please help me out ...
You can check if the city exists before trying to use it. Look at the JSON that comes back to determine the difference between the city being found and not found.
i got this error when i want to view template page on index url upto 5:24 on video This is error UnicodeDecodeError at / 'utf-8' codec can't decode byte 0xb0 in position 2464: invalid start byte
i have an issue while searching for a new city... it goes back to the main project Urls.py and looks for 'POST'. i want it to stay on the same page like youve shown right before making the forms.py file. but its not working. i dont know if its the button im using but i dont think so because the type is submit... so it may be the {{form.name}} and then name is not being passed through the files of the program correctly.
if i add POST to the urls then it keeps the same data on the page but reroutes to the same home page. no new data was added. Thus only admin pushed data is being displayed please help lol
@@prettyprinted how do you get the same size as the original input, I implemented the same way and added size into widgets but I still get the small box?
I am in 5:40 and while loading the templates there were some components missing from it like the search panel, the location name and the weather. All i can see is the heading and the 'Add City ' button. I will be really grateful if you can spare some time and look at my problem.
Please Can you Kindly update this app When it can record DATE,TIME,DAY,WIND,HUMIDITY, VISIBILITY, PRESSURE, TEMPERATURE and record the data automatically for six months or even a year and be able save into CSV or Json file for your personal projects, thank you??
@20:17 when i add the code for the 'for loop' all cities from the front-end disappear. if i remove the for loop Melbourne reappears? any help appreciated
Want to learn Django so you can build your own web apps? Join my Understanding Django course: courses.prettyprinted.com/p/understanding-django
Thank you! Very useful. I like this video format, developing small live app
Thanks for watching!
really!!!!!!!
sorry....wrong post....i meant really???...y u simply lying...tell the truth...
Terrific explanation and live demo. Thank you very much for this buddy!
You're welcome! Thanks for watching.
This deserves all thanks from the middle of my heart. Thanks a lot.
This is a great tutorial man, it's helping me to improve my skills.
Thanks Anthony. Your videos are very helpful for people like us.
Glad I could help.
Thank you, this helped me understand the basics of Django quickly
I'm glad the video helped you. Thanks for watching!
Its a best beginner practice application, thanks a lot for this tutorial... ☺️
You're welcome!
I needed to open an API for one Django project, and consume it from another Django project. This video helped a lot on designing the architecture
I'm glad i could help.
simple , crisp and clear
Thanks for watching!
How to get a weather template?
i love solid and clean tutorials .
22:35 A better way to save users input does it this way:
if request.method == 'POST':
object = Weather.objects.create(city_name=request.POST['input_text']) # Give input tag an attribute name to access it
object.save()
Great content!
Can you please give an overview of how youd go about saving the responses from the api to the database? For example, for the purpose of listing the weather over a period of time while adding a new row for the daily weather. Itd be a huge help!!
Another clean and attentive tutorial.Thanks for it.
kallu bhai, you are best
thank you so much man!
i created my first weather app...
its working and displaying one city at a time..
that means there is some problen with for loop..
when u was able to display 3 cities in my case only melbourne was displayed..
but still it works..thats what matter 👍
Thank you, Anthony!
You're welcome!
you are a really good teacher thank you
This was very informative and very helpful! Thanks for inspiring confidence in Django novices!
One of the best python tutorials I've seen....!!
Thanks for watching!
I found your TH-cam channel too late. however, I am excited to be one of your subscriber!
Thank you very much.
Great tutorial. Thank you very much :D
when i render the weather template, there is no "city name" column or las vegas weather. mind helping?
I got the same issue because I was using the final version of index.html code while I was still at the initial phase. The problem was in this python line in jinja format -- {% for city_weather in weather_data %} to {% endfor %} -- in index.html. In starting, there is no "weather_data" variable (only city_weather), so you got nothing in the city_weather variable. To avoid this, I commented both these lines as, . But this even worsened the situation as then the whole block between these lines is disabled! And that's weird as it is the standard way of commenting the html code. Anyway, the solution is to remove both these lines from the html code until you get there in the tutorial.
New subscriber here dude. Love how well you explain things. Would love to see more Django tutorials personally. Thank you!
Glad you liked the video! Thanks for watching.
How to get a weather template?
Dude, you're awesome, great tutorial
You're awesome for watching!
So grateful. Great great tutorial....and thanks Python and Django
Great tutorial. Thanks
Thanks for watching!
Very Thank you, I've learned so much, excuse me by my bad inglish, I am from Colombia
Thanks for watching!
God bless you people who help others
Thanks for watching!
Thank you, straight to the point.
Thanks for watching!
can you tell us from where u have taken html code weather.html coz without that we cannot create
I put the code in the link in the description.
Excellent tutorial, really useful. Well done!
Thanks for watching!
Thanks ! excellent, please keep uploading more videos on Django.
I will definitely continue to do so. Thanks for watching!
I've done everything step by step and for some reason my image,description and icon isn't showing I have my api with me but i don't really know the problem for sure...you mind helping out?
I got an idea on how to add student to the database just for my Capstone🤗🤗Thanks!
Thank you very much sir for your clear explanation.
You're welcome! Thank you for watching.
Thanks, great video!!
good video and project love from india
Thanks! It's a good job!
Thanks for watching!
thank you for making this useful video
All the videos are very helpful..Please add some more videos with developing a full website with django and REST please.Elaborate REST Framework more please
I definitely plan to do that in the future.
Just love it,thanks ......
You're welcome! Thanks for watching.
Thank you
Great vid man thanks
You're welcome. Thanks for watching.
thank you sir.
what if i dont want to store the cities in the database and i just want to get them from the user input.. how can i do that
hi ! i faced a issue that if i deleted all the cities from db then also in the web one city is fixed and everytime i refreshed the browser the no of the same city increases with the same value.
What is the solution ?
Hi Antony, what is the best and easiest way of integrating map into a django web application for locations purpose?
Great tutorial anthony but my data is not saving into the database i am using input type submit instead of button
Love your videos. Would you consider a Django tutorial that demonstrates how to use external api data as a way of tracking performance? Similar to your Fortenight Flask tutorial, but also store the data in a db and show trends of a player that a user can interact with.
That's a good idea. I'll consider something like that.
sir, I do same like you but in my "the_weather" folder weather.html file not found. i m using django 2.1.4 version so please help
Are you using a 'weather' directory inside of your template directory like I am?
Thank you!!
Thank you.
You're welcome!
Awesome video
Thanks for watching!
How did you get vs code to use intellisense from the bash on windows version of python? Do you have python and django installed on the windows side, then installed them on the bash side?
It worked automatically for me. I didn't install Python outside of Bash to get it to work.
Pretty Printed interesting, ill have to give it a shot then. Any recommended extentions you recommend to go with vs code for python?
I'm still using the base VS Code. I haven't tried any extensions yet.
Thanks a lot!
Can you please make some videos on how to build a full website with django?
Yeah I plan on making more complicated tutorials soon.
Thank you
Could you please share the link of second part of this project
Can you please help me to fix
'temperature': r['main']['temp'],
KeyError: 'main'
please help me
I get the same error
you added the wrong city name
Hello
Your code does not match with the GitHub code,
Giving key error at,
r = requests.get(url.format(city)).json()
is there any another way to fetch API key data without using json
nice work. l like it and l enjoyed it very much
Glad you did. Thanks for watching!
very useful video.
Thanks for watching!
i get TemplateDoesNotExist at / error anyone with a solution
Make sure the folder structure is the same. weather/templates/weather/weather.html
if I am making something similar, should I put in error handling? or just leave it blank
Greate Work... Thanks
You're welcome! Thanks for watching.
Nice video
Thanks!
Great toturial, unfortunately there is a bug. Each time the page is refreshed, the last city entered is duplicated. Anyone know what the reason is?
how to not accept same city? i accidently reload form and resubmit the form and found that it can show same city multiple times. what to do so it wont do it.
It would be much better if you put validations on the name of cities, in case if a user inserts another text instead of an existing city name
That's definitely an improvement. If I remake the video I'll definitely do that.
Hey Anthony, just wondering could you assist,
I have a ValueError at /
The City could not be created because the data didn't validate. error,
I see that the code in the video is different from GitHub repo,
I can post my repo if needs be ,
Thank you for assistance
Big fan of your pythonic skills,
Regards,
Clive
You can email me at anthony@prettyprinted.com with your code and I can take a look.
At 7:28 there is a command "pipenv install requests", I was trying the command in cmd window, but it shows an error "'pipenv' is not recognized as an internal or external command, operable program or batch file." Can you help me with the issue?
Did you install pipenv with pip first?
@@prettyprinted No, I didn't back then, but later I have installed it, and the projects is running without any error by now. Thank you for weather app project, it helped me a lot for project development as a beginner. Thanx.
oh was able to find the file at gitub link thanks again
hello, I didn't understand why u passed input from Django forms ({{form.name}}) , as I don't know Django forms concept I am finding it little difficult to understand, could u please help me out ...
You can use the form.name directly when you want to organize your form in a certain way. If you want Django to do it, just use {{ form.as_p }}
whats the soulition if city not found because it raises an error called 'main'
You can check if the city exists before trying to use it. Look at the JSON that comes back to determine the difference between the city being found and not found.
@@prettyprinted try changing the URL API to the one given from the video not from the website API. It worked for me
@@dickyadhitya5805 What is the URL needed?
From where did you pick the url mentioned in views py?
Bro im getting value error
Model class has not specified
is it really working....,,,,
why using firefox doesn't work?? there's no weather html created !! I am confused
Hi , i have value error, ModelForm has no model class specified. Here, form = CityForm(). Because of what it can be?
Inside of your class for the model form, do you have an attribute like this: model = City ?
Hi I'm having trouble in getting data i.e, the response data's are same for all cities (it returns only for London city) how to fix this
Make sure the URL is being updated with the city typed in the form.
this tutorial helps lot to understand how to consume web-service...I want to know how much time require to activate API key?
For me it was instantly
i got this error when i want to view template page on index url
upto 5:24 on video
This is error
UnicodeDecodeError at /
'utf-8' codec can't decode byte 0xb0 in position 2464: invalid start byte
Are you using Python 3?
City name temp this things not showing ?
i haven't weather icon, what i should do?
make sure you put the url correct on the template
i have an issue while searching for a new city... it goes back to the main project Urls.py and looks for 'POST'. i want it to stay on the same page like youve shown right before making the forms.py file. but its not working. i dont know if its the button im using but i dont think so because the type is submit... so it may be the {{form.name}} and then name is not being passed through the files of the program correctly.
if i add POST to the urls then it keeps the same data on the page but reroutes to the same home page. no new data was added. Thus only admin pushed data is being displayed please help lol
thanks man
Thanks for watching!
Bro, thank you!
You're welcome!
@@prettyprinted how do you get the same size as the original input, I implemented the same way and added size into widgets but I still get the small box?
I am in 5:40 and while loading the templates there were some components missing from it like the search panel, the location name and the weather. All i can see is the heading and the 'Add City ' button. I will be really grateful if you can spare some time and look at my problem.
same problem for me
@@Digital_illustrations Use the updated weather.html file in Github. This worked for me
Hi,
I can't access the api URL and i got below error. Please suggest me.
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL
The URL you're using in the request is invalid.
Awesome and quick. I have only 1 doubt i.e How did you connect BUTTON'S SUBMIT with FORM's save functionality?
It's handled automatically be HTML. If you put a submit button inside of form tags, then clicking it when submit the form.
@@prettyprintedThanks for the response. Your really doing a great job. I love you to see your videos on Django.
Hi could u explain why u add city in requests.get"url.format(city)).json
It adds the city to the URL. The city needs to be in the URL for the API to return weather data for that city.
What's the best way to send you a tutorial request for Django?
why am I getting this Error : "list indices must be integers or slices, not str" ? Thank you in advance!
In this app, that usually happens when no data is returned. You can add a check to make sure the data is there before you try to access it.
can the views be changed to CBV
asante sana(swahili 4 thanks)where can i download the .html template sir
Please Can you Kindly update this app When it can record DATE,TIME,DAY,WIND,HUMIDITY, VISIBILITY, PRESSURE, TEMPERATURE and record the data automatically for six months or even a year and be able save into CSV or Json file for your personal projects, thank you??
i have a error msg- type object 'City' has no attribute 'objectes'
it's 'objects'
@20:17 when i add the code for the 'for loop' all cities from the front-end disappear. if i remove the for loop Melbourne reappears? any help appreciated
Make sure you have results in the weather_data variable
hi can you help me. the key error keep saying that i have a problem on 'temperature' : r['main']['temp'],
KeyError: 'main'
Check out part 2 to this video. I talk about it there.
@@prettyprinted i've tried using sqlite3 db sqlite3 which you have mention in part2, but the same error still occur. How?
Can u show how to make a tourism app... I'm having some problems in building.. Thank you...