Re: Best DRY practices for a view function that will be used by all other views.

2011-02-05 Thread Ken Chida
Yes, I think I have it figured out now. Sorry for asking such a newb question. If I understand correctly, all I need to do is change the form action to the login URL. Then, url.py will direct the request to my existing login view function. I bet you guys were all bashing your heads against t

Re: Best DRY practices for a view function that will be used by all other views.

2011-02-05 Thread Ken Chida
Hi James - I want to point out that I will not have a dedicated login URL, as the functionality will be available on each page (not just a link to the login page, but the actual form). Previously, I had a dedicated login URL and link to the login page, but my frontend guy made a slick jQuery d

Re: Best DRY practices for a view function that will be used by all other views.

2011-02-05 Thread Ken Chida
A global context processor would probably work, but is it kosher to put business logic in a context processor? To me it seems that the whole point of a context processor is to simply take a piece of data and extract/format information from it to form a context dictionary. -- You received this

Re: Best DRY practices for a view function that will be used by all other views.

2011-02-05 Thread Ken Chida
Because I will have the login form on each page, I will not have a separate login URL. That's why I'm having difficulties with organizing the business logic code (i.e. view). It's almost as if I need to have two view functions -- one for login and another for the current page -- for the URL for

Re: Best DRY practices for a view function that will be used by all other views.

2011-02-05 Thread Ken Chida
Hey - Thanks for replying. So I'm thinking that the method that I originally described would amount to only a few lines of code. A decorator would look nicer, but i'd have to remember to add it for future views, which is kinda annoying. Also, I wouldn't have a login URL because all pages will

Best DRY practices for a view function that will be used by all other views.

2011-02-05 Thread Ken Chida
I tried my best to search for an answer but my efforts yielded nothing. Allow me to give you a simple example to illustrate my problem. Let's pretend that I want to have a login form on every single page on my website. Obviously, the login form will have a corresponding view function. What