Python Forum
Displaying search results
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Displaying search results
#21
(Jun-16-2020, 07:40 AM)SheeppOSU Wrote:
(Jun-16-2020, 07:34 AM)card51shor Wrote: I mean thanks a lot for trying to help - but that's like 50 pages of information. I wouldn't even know where to start. Just looking at the contents is daunting to me.
You don't have to read it all. He said go to this section right here. You don't have to read through all of that, just read the first couple paragraphs. Surely you can read just that much. In fact, all the info you need is in just the first code block. You're kinda coming across as if you're not even trying to read through some of it. Documentation can be really useful. Either you find a video or read the docs, and the person in that video most likely read through the docs to get all the information. More often then not the docs will cover way more than what's covered in videos.

OK I studied the first block and it does help and make sense however it doesn't answer everything I need.

It's very frustrating because it seems like it comes really easy to you guys but it doesn't for me.

If there aren't clear instructions or syntax, then it's really confusing for me. I've noticed with Python it's really hard to find just information on how to do something.

For instance - here are the questions that I now have:

1) Where in this website is the form that we are getting the user values from?

2) what is .href? What is .caption?

3) How am I getting the data from a sql search inputted into this html page?


I'm just as confused as I was before.
Reply
#22
Dude, giving negative rating/reputation for this post is utterly ridiculous. Especially when your answer starts with
(Jun-16-2020, 06:54 AM)card51shor Wrote: OK that makes sense - thank you.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#23
(Jun-16-2020, 07:51 AM)card51shor Wrote: For instance - here are the questions that I now have:

1) Where in this website is the form that we are getting the user values from?

2) what is .href? What is .caption?

3) How am I getting the data from a sql search inputted into this html page?

Again, you seem to be missing some of the point. The template is only about presenting the data to the user. It seems to be a results page of sorts. Where the data comes from is not the concern of the template - the database query or whatever else should be done in your handler and that's also where you'll get the data from the form, like you're doing (remember: separation of concerns).

The page does make reference (in bold, no less!) to variables and expressions and links further down do tell you what the syntax means and how to use it (e.g. "{% ... %} for Statements"). Did you try going through that?
Reply
#24
(Jun-16-2020, 07:44 AM)ndc85430 Wrote:
(Jun-16-2020, 07:34 AM)card51shor Wrote: Is there any easier way you guys can think of? I have about 14 days to finish this and I can't start learning whole new languages like Jinga and doing long tutorials. This is already basically a tutorial that I'm doing to learn python!

If you're doing some kind of course, haven't you learnt the stuff you need? If you're really struggling, perhaps you should speak to your course leaders about it.

The modern way of dynamically creating web pages is to use templates and I've explained the reasons for that above. I'm not familiar with PHP or JS stacks, but I'd be very surprised if they didn't do things this way. I've built web apps for quite a while in different technologies (Python and on the JVM (Java, Scala, Kotlin, Clojure)) and the basic idea is the same.

No I'm just doing a project I found online for Python to teach myself. I already know javascript and php for web development. I'm just trying to challenge myself. I understand the concepts of reiterating through arrays and lists and all that so i understand the code when I see it - I'm just baffled by the sql + python syntax and the lack of information i can find.

All I need to know is the syntax and I can write the code I need to. I'm just getting very frustrated every night I try to use the little time I have to get this problem solved and it's just always another page of documentation that helps me a little bit but ultimately needs to be changed too much to fit my project and I can never find out how.

It's taken me 6 weeks to write the code I have which has a registration page and a login. Now I have the search working but I need it to print out the results and have a clickable link.

(Jun-16-2020, 07:56 AM)buran Wrote: Dude, giving negative rating/reputation for this post is utterly ridiculous. Especially when your answer starts with
(Jun-16-2020, 06:54 AM)card51shor Wrote: OK that makes sense - thank you.

everyone else is giving me bad ratings.

(Jun-16-2020, 07:56 AM)ndc85430 Wrote:
(Jun-16-2020, 07:51 AM)card51shor Wrote: For instance - here are the questions that I now have:

1) Where in this website is the form that we are getting the user values from?

2) what is .href? What is .caption?

3) How am I getting the data from a sql search inputted into this html page?

Again, you seem to be missing some of the point. The template is only about presenting the data to the user. It seems to be a results page of sorts. Where the data comes from is not the concern of the template - the database query or whatever else should be done in your handler and that's also where you'll get the data from the form, like you're doing (remember: separation of concerns).

The page does make reference (in bold, no less!) to variables and expressions and links further down do tell you what the syntax means and how to use it (e.g. "{% ... %} for Statements"). Did you try going through that?

I tried going through it and just got stuck and had more questions and didn't want to continue. I can try to read it again though tomorrow.

<ul id="navigation">
    {% for item in navigation %}
        <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
    {% endfor %}
    </ul>
so all i have to do is add this code to my html page and suddenly it will print out the results? How is it linked to my "b" variable in python?
Reply
#25
(Jun-16-2020, 07:58 AM)card51shor Wrote:
<ul id="navigation">
    {% for item in navigation %}
        <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
    {% endfor %}
    </ul>
so all i have to do is add this code to my html page and suddenly it will print out the results? How is it linked to my "b" variable in python?

Sigh, look again at the example in the Flask docs. As I said above, it shows you all the pieces and how they fit together. Why aren't you trying things out, seeing what problems you encounter and trying to work out what you can do about them?
Reply
#26
(Jun-16-2020, 07:58 AM)card51shor Wrote: everyone else is giving me bad ratings.
If you read the rep you can see why you're getting them. People think you're being lazy, not trying to write code yourself.
(Jun-16-2020, 07:58 AM)card51shor Wrote: it's just always another page of documentation that helps me a little bit but ultimately needs to be changed too much to fit my project and I can never find out how.
Code always changes from docs to being typed out into someone else's code for some purpose. The point of docs is to show you the basic concepts of how something works. Most of the time they do a good job at that. However they don't help if you can't interpret the code and apply it for yourself. Same thing in this case. "Template variables are defined by the context dictionary passed to the template." tells you how the variables are passed. this explains all kinds of operators you can use. This explains how you can access variables that have been passed into the template, it's the same concept as using a variable in any other language.
Reply
#27
(Jun-16-2020, 08:34 AM)ndc85430 Wrote: [quote='card51shor' pid='117982' dateline='1592294323']
<ul id="navigation">
    {% for item in navigation %}
        <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
    {% endfor %}
    </ul>
so all i have to do is add this code to my html page and suddenly it will print out the results? How is it linked to my "b" variable in python?

Sigh, look again at the example in the Flask docs. As I said above, it shows you all the pieces and how they fit together. Why aren't you trying things out, seeing what problems you encounter and trying to work out what you can do about them?
[/quote]

It doesn't show me how it all fits together. I looked. It's different than my code so it's confusing me.

I have tried things out. I already understand all this code - but what is the correct syntax for me to do my own? Is anyone printing a list to the html file in the examples? I can't find one that pertains to what I'm trying to do.

I already know what I'm trying to do I just don't know all the syntax of how to do it.

(Jun-16-2020, 08:37 AM)SheeppOSU Wrote: [quote="card51shor" pid="117982" dateline="1592294323"]everyone else is giving me bad ratings.
If you read the rep you can see why you're getting them. People think you're being lazy, not trying to write code yourself.
(Jun-16-2020, 07:58 AM)card51shor Wrote: it's just always another page of documentation that helps me a little bit but ultimately needs to be changed too much to fit my project and I can never find out how.
Code always changes from docs to being typed out into someone else's code for some purpose. The point of docs is to show you the basic concepts of how something works. Most of the time they do a good job at that. However they don't help if you can't interpret the code and apply it for yourself. Same thing in this case. "Template variables are defined by the context dictionary passed to the template." tells you how the variables are passed. this explains all kinds of operators you can use. This explains how you can access variables that have been passed into the template, it's the same concept as using a variable in any other language.
[/quote]

I'm sorry I just don't think anyone here is listening to me.

I don't need links to more information. I've already seen the information.

I DON'T UNDERSTAND HOW TO DO IT!

Isn't that what you guys are here for? Anyone can google and find a bunch of instructions...

but what do I do if I don't understand the instructions? Isn't that what you guys are here for?

Why do u guys keep calling me lazy? I'm here every night of June asking for help.

I'm never giving up. But saying "here's a link" doesn't really help me. It does for a bit - but then it just raises a bunch more questions as well.

Then I ask them and you guys yell at me more.

Not everyone retains information the same.

I Need some hands on help. Can anyone offer that? If not, that's fine - I don't expect anyone to take me on and help me.

But if you could - I would really appreciate it.

If you're going to link me to links I've already seen and been trying to duplicate - it just gets me more frustrated.

I'm sorry I guess I'm not as good as you guys.

(Jun-16-2020, 08:37 AM)SheeppOSU Wrote: [quote="card51shor" pid="117982" dateline="1592294323"]everyone else is giving me bad ratings.
If you read the rep you can see why you're getting them. People think you're being lazy, not trying to write code yourself.
(Jun-16-2020, 07:58 AM)card51shor Wrote: it's just always another page of documentation that helps me a little bit but ultimately needs to be changed too much to fit my project and I can never find out how.

I think you're lazy not trying to help people who need help on a python forum. You think linking to a site you found on google is help? Anyone can do that.
Reply
#28
Seriously @card51shor? You refuse to solve a problem when we give you such big clues. We link you to sites if necessary - you have to understand there always is a reason behind what someone posts.
You just keep shouting and arguing without trying anything at all, and you remain stubborn and refuse to listen. We always help you - you just aren't taking your time to read and understand the post correctly. The same thing happened in this thread of yours too.
I have to say, I'm surprised the thread hasn't been locked yet. You call people lazy, and yet you don't do anything on your own except asking people for the answer.
Quote:This forum is focused on education. It exists to help people learn Python. We don’t exist to solve others’ problems, although that tends to be a happy byproduct of education. You should keep this in mind when writing replies.
What's the use of becoming a programmer when you just ask people to solve your problems? We will help you, but we won't always solve the answers for you.
This is the homework section in the forum - we don't give answers here.
And also, just because everyone gives you bad rating doesn't mean u do the same to a moderator - they would have done it for a reason
Hope this changes your attitude and the perception towards the members in the forum who help you
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#29
(Jun-16-2020, 03:29 PM)card51shor Wrote:
(Jun-16-2020, 08:34 AM)ndc85430 Wrote: Sigh, look again at the example in the Flask docs. As I said above, it shows you all the pieces and how they fit together. Why aren't you trying things out, seeing what problems you encounter and trying to work out what you can do about them?

It doesn't show me how it all fits together.

That example shows you how to use a variable in a template and how to pass a value for that variable to render_template for it to be substituted in the right place. The code sample you copied above shows you how to loop over a variable and generate HTML for each of the items in it. Surely you can go one step further and think about how to put the two together?

Quote:I have tried things out.

Then show us what you've tried. We can't see your screen, so it's impossible to help you.
Reply
#30
(Jun-16-2020, 08:01 PM)ndc85430 Wrote:
(Jun-16-2020, 03:29 PM)card51shor Wrote: It doesn't show me how it all fits together.

That example shows you how to use a variable in a template and how to pass a value for that variable to render_template for it to be substituted in the right place. The code sample you copied above shows you how to loop over a variable and generate HTML for each of the items in it. Surely you can go one step further and think about how to put the two together?

Quote:I have tried things out.

Then show us what you've tried. We can't see your screen, so it's impossible to help you.

Thanks a lot. I really think you're trying to help me.

The other people are just trying to scold me and make me feel dumb - which I already know I'm dumber than you guys that's why I'm here asking for help. Linking me to a site doesn't really help me I keep saying it.

U don't have to show me the answer - u can tell me on here. Showing me an example doesn't help me - I'm sorry it just doesn't help me. I tried. I look at code for hours. Then I try to apply it to my code and I'm stuck.

But once I get going then I start figuring stuff out.

When I hit the wall and I'm constantly told to keep looking at other code - it just makes it worse. I'm sorry. I'm trying.

And I can't show you the things I did since I changed the code to what I have now.

I assure you I've looked at pages and pages of code and read everything there is to say.

It's not clear.

Quote:That example shows you how to use a variable in a template and how to pass a value for that variable to render_template for it to be substituted in the right place. The code sample you copied above shows you how to loop over a variable and generate HTML for each of the items in it. Surely you can go one step further and think about how to put the two together?


OK so I guess i'll just study this website. If that's all I've got.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020