Re: Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
Cool. I'll leave it be an more on :) Thanks again for your time and patience! Brandon On Jun 20, 3:38 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote: > Its possible of course to collapse some of the views together, but that > would result in more complex logic in the views and probably not worth

Re: Need help encapsulating a form

2008-06-20 Thread Richard Dahl
Its possible of course to collapse some of the views together, but that would result in more complex logic in the views and probably not worth the trouble, I probably would not do it myself in this situation, although I have done simliar things with larger projects. It comes down to where do you

Re: Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
Ah, I see now. Here's my views.py file now: from django.shortcuts import render_to_response, get_object_or_404 from django.newforms import form_for_model from django.core.mail import send_mail from django.http import HttpResponseRedirect from lua.references.models import * from

Re: Need help encapsulating a form

2008-06-20 Thread Richard Dahl
OK I *think* I see what is wrong: You are returning the redirect from within the 'process_form' function, but not assigning it to anything or further processing it. SO, the process form returns a redirect, which is promptly and efficiently ignored, then returns a render_to_response from the view.

Re: Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
Hi Richard, Thanks for taking the tie to address my question. Here's my current views.py file. As you can see there's quite a bit of duplication. I guess what's throwing me for a loop is that I can abstract processing the form out, checking to see if the request is a post, etc, but the redirect

Re: Need help encapsulating a form

2008-06-20 Thread Richard Dahl
put all of the otherwise duplicative code into its own function within another module. then import that function into your views.py, i.e: at the top of views.py: from formprocessing.py import formprocessor then within formproccessor.py def processemail(email, reference_name): subject

Need help encapsulating a form

2008-06-20 Thread Brandon Taylor
Hi everyone, I have a feedback form which needs to be functional across 3 different actions within the same view... My actions are: references_list reference_detail thanks Here's my current form processing code: if request.method == 'POST': form =