How to create form to show user input and return results from DB

2020-01-03 Thread nmaxbe...@gmail.com
Hi,

I am creating a website that lists my states congressional districts based 
on the US census (i.e. 2000, 2010 and ultimately to update when the 2020 
survey is completed).  The entire exercise is to track how the 
representation could possibly change based on the US census.

So far, I have a mock-up for two user inputs: one for 2000 and one for 2010 
entering their zip codes on the homepage. The user is prompted to input 
their zip code (for each census year) in order to see their representative 
for 2000 and 2010 (basically pulling from a db to show the results) and the 
results show on the results page (new tab).

My confusion: 

   1. Should I combine the DB's to "respond" to the users input or keep 
   DB's (2000, 2010) separate?
   2. I understand how to create models and I understand how to create 
   views, but I am confused on creating the form (specifically "GET" vs "POST".
   3. Is POST what the user inputs? If so, how do I "search through the 
   existing DB"?
   4. I have reviewed the form docs within Django but still am lost.  
   Please help.

As you suspected, I am new to Django but want to "get over this hump".  I 
feel I am reaching too far and the answer is in front of my face.  My 
github is: https://github.com/NinaMaxberry/Cornerstone-Project. Once you 
visit, you will see, I've tried a lot of options.

Any help would be greatly appreciated.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f1995c7-6e6c-4147-b53b-10373c7b4b31%40googlegroups.com.


Re: How to create form to show user input and return results from DB

2020-01-04 Thread victor jack

Hi Nina , just read your write up 
For some form of clarification to your Confusion I’ll just answer the ones I 
can 

For the database , don’t make two different ones , one database with two tables 
2000 and 2010 will do just fine , just query then right. 

For the forms it is required to use POST cause it is more secure since you are 
POSTING form data ( which I feel is sensitive information)

I hope this helps , if I am free I might check out your github link 

>> On 4 Jan 2020, at 00:12, "nmaxbe...@gmail.com"  wrote:
> 
> Hi,
> 
> I am creating a website that lists my states congressional districts based on 
> the US census (i.e. 2000, 2010 and ultimately to update when the 2020 survey 
> is completed).  The entire exercise is to track how the representation could 
> possibly change based on the US census.
> 
> So far, I have a mock-up for two user inputs: one for 2000 and one for 2010 
> entering their zip codes on the homepage. The user is prompted to input their 
> zip code (for each census year) in order to see their representative for 2000 
> and 2010 (basically pulling from a db to show the results) and the results 
> show on the results page (new tab).
> 
> My confusion: 
> Should I combine the DB's to "respond" to the users input or keep DB's (2000, 
> 2010) separate?
> I understand how to create models and I understand how to create views, but I 
> am confused on creating the form (specifically "GET" vs "POST".
> Is POST what the user inputs? If so, how do I "search through the existing 
> DB"?
> I have reviewed the form docs within Django but still am lost.  Please help.
> As you suspected, I am new to Django but want to "get over this hump".  I 
> feel I am reaching too far and the answer is in front of my face.  My github 
> is: https://github.com/NinaMaxberry/Cornerstone-Project. Once you visit, you 
> will see, I've tried a lot of options.
> 
> Any help would be greatly appreciated.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5f1995c7-6e6c-4147-b53b-10373c7b4b31%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/751A25AC-EF77-4519-97D0-A55CC94FDCAD%40gmail.com.


Re: How to create form to show user input and return results from DB

2020-01-04 Thread Integr@te System
Hi friend,

# dont separate bc of the same type of field on one object. ( or find more
zipcode service provider for more options)

# with get/post method you shoud refer more docs, it just view/create
action.

# consider review source, a lot comment in your code base and few err
commands.
Think of zen.



On Sat, Jan 4, 2020, 06:11 nmaxbe...@gmail.com  wrote:

> Hi,
>
> I am creating a website that lists my states congressional districts based
> on the US census (i.e. 2000, 2010 and ultimately to update when the 2020
> survey is completed).  The entire exercise is to track how the
> representation could possibly change based on the US census.
>
> So far, I have a mock-up for two user inputs: one for 2000 and one for
> 2010 entering their zip codes on the homepage. The user is prompted to
> input their zip code (for each census year) in order to see their
> representative for 2000 and 2010 (basically pulling from a db to show the
> results) and the results show on the results page (new tab).
>
> My confusion:
>
>1. Should I combine the DB's to "respond" to the users input or keep
>DB's (2000, 2010) separate?
>2. I understand how to create models and I understand how to create
>views, but I am confused on creating the form (specifically "GET" vs 
> "POST".
>3. Is POST what the user inputs? If so, how do I "search through the
>existing DB"?
>4. I have reviewed the form docs within Django but still am lost.
>Please help.
>
> As you suspected, I am new to Django but want to "get over this hump".  I
> feel I am reaching too far and the answer is in front of my face.  My
> github is: https://github.com/NinaMaxberry/Cornerstone-Project. Once you
> visit, you will see, I've tried a lot of options.
>
> Any help would be greatly appreciated.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5f1995c7-6e6c-4147-b53b-10373c7b4b31%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP5HUWpdzGaBg4UEcOUfirLq%2BBYUYiDfe-W5rZ1_3JVZHauPgw%40mail.gmail.com.


Re: How to create form to show user input and return results from DB

2020-01-04 Thread Eduardo Cervantes
1. No. The data for 2000,2010 could be in one table
2.. you can create a view that accepts get and post. Get when the user
loads the page initially to fill it out  and Post when they submit it. This
should take them to a new page with the results or a refreshed view if you
are using a JavaScript library.
3. Yes. You need to pass the input of the form as a search parameter to the
post view code.
4.dont worry, this is a small hump and you get over it.

Btw - you should clean up your repo, it has a ton of stuff, ie your whole
virtual env with binaries and executables in it that should never really be
checked in. It could use a requirement.txt and a .gitignore file as well.

Cheers,
Eduardo
https://eddyizm.github.io/resume/


On Fri, Jan 3, 2020, 15:11 nmaxbe...@gmail.com  wrote:

> Hi,
>
> I am creating a website that lists my states congressional districts based
> on the US census (i.e. 2000, 2010 and ultimately to update when the 2020
> survey is completed).  The entire exercise is to track how the
> representation could possibly change based on the US census.
>
> So far, I have a mock-up for two user inputs: one for 2000 and one for
> 2010 entering their zip codes on the homepage. The user is prompted to
> input their zip code (for each census year) in order to see their
> representative for 2000 and 2010 (basically pulling from a db to show the
> results) and the results show on the results page (new tab).
>
> My confusion:
>
>1. Should I combine the DB's to "respond" to the users input or keep
>DB's (2000, 2010) separate?
>2. I understand how to create models and I understand how to create
>views, but I am confused on creating the form (specifically "GET" vs 
> "POST".
>3. Is POST what the user inputs? If so, how do I "search through the
>existing DB"?
>4. I have reviewed the form docs within Django but still am lost.
>Please help.
>
> As you suspected, I am new to Django but want to "get over this hump".  I
> feel I am reaching too far and the answer is in front of my face.  My
> github is: https://github.com/NinaMaxberry/Cornerstone-Project. Once you
> visit, you will see, I've tried a lot of options.
>
> Any help would be greatly appreciated.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5f1995c7-6e6c-4147-b53b-10373c7b4b31%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALZhWrcM--2KKOfTJQkSXXWRz%2BHvtnD2Rcu4vis4KM-xuBdjiA%40mail.gmail.com.