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 f

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-af

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 AboutMadtr

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 AboutMadtr

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 AboutMadtr

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 o

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-C

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

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

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 i

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 r