Re: Form 'POST' to a database

2012-07-13 Thread JJ Zolper
Thank you so much for the clarification!

On Friday, July 13, 2012 5:24:18 PM UTC-4, Jani Tiainen wrote:
>
> You still need to call result.is_valid() since it actually runs actual 
> validation rules.
>
> Very basic form processing is usually done like this:
>
> so in case of GET you return empty form. in case of invalid POST you 
> return form with values and error messages.
>
> After successful POST you do redirect-after-post to avoid problems with 
> browser history back-button.
>
> def form_view(request):
> if request.method == 'POST':
> form = MyForm(request.POST)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect("/some/result/form")
> else:
> form = MyForm()
> return HttpResponse("form/form.html", { 'form': form })
>
> On Thu, Jul 12, 2012 at 4:44 AM, JJ Zolper  wrote:
>
>> I was able to make it work!
>>
>> from django.core.context_processors import csrf
>> from django.template import RequestContext
>> from django.http import HttpResponseRedirect
>> from django.http import HttpResponse
>> from django.shortcuts import render_to_response
>> from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm
>>
>> def about(request):
>> AboutMadtrakInstance = AboutMadtrak()
>> result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
>>  result.save()
>> return HttpResponse('It worked?!? Of course it did. I knew that.')
>>
>> def about_form(request):
>> return render_to_response('about_form.html', context_instance = 
>> RequestContext(request))
>>
>> I ended up looking at ModelForms and trying that since I was having 
>> issues.
>>
>> So does this method handle all validation and security issues for me?
>>
>> Or do I still need a "result.is_valid()" among other things?
>>
>>
>> On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>>>
>>> Hey,
>

>>> yeah, it basicly is. Just a very, very basic example (And sorry if i 
>>> could highlight this as code, i didnt find something in the format-menu :/ 
>>> ).
>>> Of course you should validate your input first. And if you just want to 
>>> edit a Model within a form, you should check on the ModelForm-Class 
>>> https://docs.**djangoproject.com/en/dev/**topics/forms/modelforms/
>>>
>>> def vote(request, poll_id):
>>> try:
>>> obj = YourModel.objects.get(pk=poll_**id)
>>> obj.attributea = request.POST['attributea']
>>> obj.attributeb = request.POST['attributeb']
>>> obj.save()
>>> return HttpResponse(validparamshere)
>>> except ObjectDoesNotExist:
>>> return HttpResponse(show_some_error)
>>>
>>>  
>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/JTdViX4I6HEJ.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/_yuwhnXo7ssJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-13 Thread Jani Tiainen
You still need to call result.is_valid() since it actually runs actual
validation rules.

Very basic form processing is usually done like this:

so in case of GET you return empty form. in case of invalid POST you return
form with values and error messages.

After successful POST you do redirect-after-post to avoid problems with
browser history back-button.

def form_view(request):
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect("/some/result/form")
else:
form = MyForm()
return HttpResponse("form/form.html", { 'form': form })

On Thu, Jul 12, 2012 at 4:44 AM, JJ Zolper  wrote:

> I was able to make it work!
>
> from django.core.context_processors import csrf
> from django.template import RequestContext
> from django.http import HttpResponseRedirect
> from django.http import HttpResponse
> from django.shortcuts import render_to_response
> from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm
>
> def about(request):
> AboutMadtrakInstance = AboutMadtrak()
> result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
> result.save()
> return HttpResponse('It worked?!? Of course it did. I knew that.')
>
> def about_form(request):
> return render_to_response('about_form.html', context_instance =
> RequestContext(request))
>
> I ended up looking at ModelForms and trying that since I was having issues.
>
> So does this method handle all validation and security issues for me?
>
> Or do I still need a "result.is_valid()" among other things?
>
>
> On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>>
>> Hey,

>>>
>> yeah, it basicly is. Just a very, very basic example (And sorry if i
>> could highlight this as code, i didnt find something in the format-menu :/
>> ).
>> Of course you should validate your input first. And if you just want to
>> edit a Model within a form, you should check on the ModelForm-Class
>> https://docs.**djangoproject.com/en/dev/**topics/forms/modelforms/
>>
>> def vote(request, poll_id):
>> try:
>> obj = YourModel.objects.get(pk=poll_**id)
>> obj.attributea = request.POST['attributea']
>> obj.attributeb = request.POST['attributeb']
>> obj.save()
>> return HttpResponse(validparamshere)
>> except ObjectDoesNotExist:
>> return HttpResponse(show_some_error)
>>
>>
  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/JTdViX4I6HEJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I was able to make it work!

from django.core.context_processors import csrf
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.shortcuts import render_to_response
from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm

def about(request):
AboutMadtrakInstance = AboutMadtrak()
result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
result.save()
return HttpResponse('It worked?!? Of course it did. I knew that.')

def about_form(request):
return render_to_response('about_form.html', context_instance = 
RequestContext(request))

I ended up looking at ModelForms and trying that since I was having issues.

So does this method handle all validation and security issues for me?

Or do I still need a "result.is_valid()" among other things?


On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>
> Hey,
>>>
>>
> yeah, it basicly is. Just a very, very basic example (And sorry if i could 
> highlight this as code, i didnt find something in the format-menu :/ ).
> Of course you should validate your input first. And if you just want to 
> edit a Model within a form, you should check on the ModelForm-Class 
> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>
> def vote(request, poll_id):
> try:
> obj = YourModel.objects.get(pk=poll_id)
> obj.attributea = request.POST['attributea']
> obj.attributeb = request.POST['attributeb']
> obj.save()
> return HttpResponse(validparamshere)
> except ObjectDoesNotExist:
> return HttpResponse(show_some_error)
>
>
On Wednesday, July 11, 2012 1:09:32 PM UTC-4, Dennis Lee Bieber wrote:
>
> On Wed, 11 Jul 2012 08:36:39 -0700 (PDT), JJ Zolper 
>  declaimed the following in 
> gmane.comp.python.django.user: 
>
>
> > So originally: 
> > 
> > selected_choice = p.choice_set.get(pk=request.POST['choice']) 
> > 
> If I understand this (I've not run the tutorial, and only browsed 
> the now-outdated print books), this statement is using the value from 
> the "choice" field of the submitted form as the primary key to retrieve 
> a record (model instance) from the database. 
>
> pseudo-SQL 
> select * from choice_set where pk = "request.POST['choice']" 
>
> > this requests the submitted choice from the POST data and 
> > 
> > The part that says: 
> > 
> > selected_choice.votes += 1 
> > selected_choice.save() 
> > 
> > Actually saves the choice to the database? 
> > 
> This then increments the votes field of the record (model 
> instance) 
> retrieved from the database, and then saves the record back. 
>
> p-SQL 
> update choice_set set 
> votes = votes + 1 
> where pk = selected_choice.pk 
>
> {I don't know if Django is smart enough to only update the changed 
> field, or if it updates the entire record} 
> -- 
> Wulfraed Dennis Lee Bieber AF6VN 
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/j_BacnSqm4QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I was able to make it work!

from django.core.context_processors import csrf
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.shortcuts import render_to_response
from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm

def about(request):
AboutMadtrakInstance = AboutMadtrak()
result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
result.save()
return HttpResponse('It worked?!? Of course it did. I knew that.')

def about_form(request):
return render_to_response('about_form.html', context_instance = 
RequestContext(request))

I ended up looking at ModelForms and trying that since I was having issues.

So does this method handle all validation and security issues for me?

Or do I still need a "result.is_valid()" among other things?


On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>
> Hey,
>>>
>>
> yeah, it basicly is. Just a very, very basic example (And sorry if i could 
> highlight this as code, i didnt find something in the format-menu :/ ).
> Of course you should validate your input first. And if you just want to 
> edit a Model within a form, you should check on the ModelForm-Class 
> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>
> def vote(request, poll_id):
> try:
> obj = YourModel.objects.get(pk=poll_id)
> obj.attributea = request.POST['attributea']
> obj.attributeb = request.POST['attributeb']
> obj.save()
> return HttpResponse(validparamshere)
> except ObjectDoesNotExist:
> return HttpResponse(show_some_error)
>
>
On Wednesday, July 11, 2012 2:50:21 PM UTC-4, Jani Tiainen wrote:
>
> Django makes always (at least currently) full record update (iow: there is 
> no dirty flag for fields).
>
> Example given is "poor" in the sense that it uses directly POST data. I 
> strongly would suggest leveraging modelforms when ever possible - it saves 
> time and nerves. You get all the validation and other goodies for free.
>
> On Wed, Jul 11, 2012 at 8:09 PM, Dennis Lee Bieber 
> wrote:
>
>> On Wed, 11 Jul 2012 08:36:39 -0700 (PDT), JJ Zolper
>>  declaimed the following in
>> gmane.comp.python.django.user:
>>
>>
>> > So originally:
>> >
>> > selected_choice = p.choice_set.get(pk=request.POST['choice'])
>> >
>> If I understand this (I've not run the tutorial, and only browsed
>> the now-outdated print books), this statement is using the value from
>> the "choice" field of the submitted form as the primary key to retrieve
>> a record (model instance) from the database.
>>
>> pseudo-SQL
>> select * from choice_set where pk = "request.POST['choice']"
>>
>> > this requests the submitted choice from the POST data and
>> >
>> > The part that says:
>> >
>> > selected_choice.votes += 1
>> > selected_choice.save()
>> >
>> > Actually saves the choice to the database?
>> >
>> This then increments the votes field of the record (model 
>> instance)
>> retrieved from the database, and then saves the record back.
>>
>> p-SQL
>> update choice_set set
>> votes = votes + 1
>> where pk = selected_choice.pk
>>
>> {I don't know if Django is smart enough to only update the changed
>> field, or if it updates the entire record}
>> --
>> Wulfraed Dennis Lee Bieber AF6VN
>> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> -- 
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/oskdpdjwHkgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I was able to make it work!

from django.core.context_processors import csrf
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.shortcuts import render_to_response
from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm

def about(request):
AboutMadtrakInstance = AboutMadtrak()
result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
result.save()
return HttpResponse('It worked?!? Of course it did. I knew that.')

def about_form(request):
return render_to_response('about_form.html', context_instance = 
RequestContext(request))

I ended up looking at ModelForms and trying that since I was having issues.

So does this method handle all validation and security issues for me?

Or do I still need a "result.is_valid()" among other things?


On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>
> Hey,
>>>
>>
> yeah, it basicly is. Just a very, very basic example (And sorry if i could 
> highlight this as code, i didnt find something in the format-menu :/ ).
> Of course you should validate your input first. And if you just want to 
> edit a Model within a form, you should check on the ModelForm-Class 
> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>
> def vote(request, poll_id):
> try:
> obj = YourModel.objects.get(pk=poll_id)
> obj.attributea = request.POST['attributea']
> obj.attributeb = request.POST['attributeb']
> obj.save()
> return HttpResponse(validparamshere)
> except ObjectDoesNotExist:
> return HttpResponse(show_some_error)
>
>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JTdViX4I6HEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread Jani Tiainen
Django makes always (at least currently) full record update (iow: there is
no dirty flag for fields).

Example given is "poor" in the sense that it uses directly POST data. I
strongly would suggest leveraging modelforms when ever possible - it saves
time and nerves. You get all the validation and other goodies for free.

On Wed, Jul 11, 2012 at 8:09 PM, Dennis Lee Bieber wrote:

> On Wed, 11 Jul 2012 08:36:39 -0700 (PDT), JJ Zolper
>  declaimed the following in
> gmane.comp.python.django.user:
>
>
> > So originally:
> >
> > selected_choice = p.choice_set.get(pk=request.POST['choice'])
> >
> If I understand this (I've not run the tutorial, and only browsed
> the now-outdated print books), this statement is using the value from
> the "choice" field of the submitted form as the primary key to retrieve
> a record (model instance) from the database.
>
> pseudo-SQL
> select * from choice_set where pk = "request.POST['choice']"
>
> > this requests the submitted choice from the POST data and
> >
> > The part that says:
> >
> > selected_choice.votes += 1
> > selected_choice.save()
> >
> > Actually saves the choice to the database?
> >
> This then increments the votes field of the record (model instance)
> retrieved from the database, and then saves the record back.
>
> p-SQL
> update choice_set set
> votes = votes + 1
> where pk = selected_choice.pk
>
> {I don't know if Django is smart enough to only update the changed
> field, or if it updates the entire record}
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread Andre Schemschat

>
> Hey,
>>
>
yeah, it basicly is. Just a very, very basic example (And sorry if i could 
highlight this as code, i didnt find something in the format-menu :/ ).
Of course you should validate your input first. And if you just want to 
edit a Model within a form, you should check on the ModelForm-Class 
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

def vote(request, poll_id):
try:
obj = YourModel.objects.get(pk=poll_id)
obj.attributea = request.POST['attributea']
obj.attributeb = request.POST['attributeb']
obj.save()
return HttpResponse(validparamshere)
except ObjectDoesNotExist:
return HttpResponse(show_some_error)


>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/uPRAe_zhfcgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
I guess on Part 4 is what I need...

So hmmm.

def vote(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
try:
selected_choice = p.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
# Redisplay the poll voting form.
return render_to_response('polls/detail.html', {
'poll': p,
'error_message': "You didn't select a choice.",
}, context_instance=RequestContext(request))
else:
selected_choice.votes += 1
selected_choice.save()
# Always return an HttpResponseRedirect after successfully dealing
# with POST data. This prevents data from being posted twice if a
# user hits the Back button.
return HttpResponseRedirect(reverse('polls.views.results', 
args=(p.id,)))

So originally:

selected_choice = p.choice_set.get(pk=request.POST['choice'])

this requests the submitted choice from the POST data and 

The part that says:

selected_choice.votes += 1
selected_choice.save()

Actually saves the choice to the database?

Is it just two lines? requesting the data form request.POST and then that 
variable.save() to store it in the database?

JJ

On Wednesday, July 11, 2012 12:31:44 AM UTC-4, Lee Hinde wrote:
>
>
> On Jul 10, 2012, at 8:48 PM, JJ Zolper wrote:
>
> I honestly just have a general question.
>
> If I have one database set in my settings file in settings.py and I try to 
> execute a simple HTML Form using 'POST' how do I get that data into my 
> PostgreSQL database?
>
> In my view do I have to interface with my model and thus the model takes 
> care of the rest?
>
> https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/
>
> This link seems to be down the right road I think?
>
> I'm sorry if this question does not make a lot of sense but I really am 
> trying to find some direction as to how once I have a view, model, urlconf, 
> and settings file with a database tied to it (i checked using the import 
> django.db connection/cursor test) how do I get the request.POST data sent 
> to my database?
>
> Thanks,
>
> JJ
>
> I recommend the tutorial. It walks you through the process, soup to nuts.
>
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WrL0VQrqMvQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-11 Thread JJ Zolper
That's great and everything except I've done all that already.

I've generated my URLconf, template, and model. Registered the model with 
the admin site. Created the table from the model in my postgresql database 
and set up the settings file and used syncdb to connect and make sure I 
have access and all that fun stuff.

Now, I'm trying to understand the idea behind when I have a Form if you 
know what that is and I use the 'POST' html request and I send that data 
through my views.py file and I want that to be sent to my model/database, 
how I'm supposed to actually process that.

Unless I'm supposed to tie my django app into the database python shell I 
don't think that link answers my question. This is the code. I'm trying to 
propagate data through from the template to the view to the model and 
hopefully at sometime soon my database.

Thanks,

JJ

On Wednesday, July 11, 2012 12:31:44 AM UTC-4, Lee Hinde wrote:
>
>
> On Jul 10, 2012, at 8:48 PM, JJ Zolper wrote:
>
> I honestly just have a general question.
>
> If I have one database set in my settings file in settings.py and I try to 
> execute a simple HTML Form using 'POST' how do I get that data into my 
> PostgreSQL database?
>
> In my view do I have to interface with my model and thus the model takes 
> care of the rest?
>
> https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/
>
> This link seems to be down the right road I think?
>
> I'm sorry if this question does not make a lot of sense but I really am 
> trying to find some direction as to how once I have a view, model, urlconf, 
> and settings file with a database tied to it (i checked using the import 
> django.db connection/cursor test) how do I get the request.POST data sent 
> to my database?
>
> Thanks,
>
> JJ
>
> I recommend the tutorial. It walks you through the process, soup to nuts.
>
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/P0NfWITc2rwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Form 'POST' to a database

2012-07-10 Thread Lee Hinde

On Jul 10, 2012, at 8:48 PM, JJ Zolper wrote:

> I honestly just have a general question.
> 
> If I have one database set in my settings file in settings.py and I try to 
> execute a simple HTML Form using 'POST' how do I get that data into my 
> PostgreSQL database?
> 
> In my view do I have to interface with my model and thus the model takes care 
> of the rest?
> 
> https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/
> 
> This link seems to be down the right road I think?
> 
> I'm sorry if this question does not make a lot of sense but I really am 
> trying to find some direction as to how once I have a view, model, urlconf, 
> and settings file with a database tied to it (i checked using the import 
> django.db connection/cursor test) how do I get the request.POST data sent to 
> my database?
> 
> Thanks,
> 
> JJ
> 
I recommend the tutorial. It walks you through the process, soup to nuts.

https://docs.djangoproject.com/en/dev/intro/tutorial01/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Form 'POST' to a database

2012-07-10 Thread JJ Zolper
I honestly just have a general question.

If I have one database set in my settings file in settings.py and I try to 
execute a simple HTML Form using 'POST' how do I get that data into my 
PostgreSQL database?

In my view do I have to interface with my model and thus the model takes 
care of the rest?

https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/

This link seems to be down the right road I think?

I'm sorry if this question does not make a lot of sense but I really am 
trying to find some direction as to how once I have a view, model, urlconf, 
and settings file with a database tied to it (i checked using the import 
django.db connection/cursor test) how do I get the request.POST data sent 
to my database?

Thanks,

JJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Sc5jmrK2g9oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.