Friday, September 24, 2010

Re: Universal form

@Tim Sawyer: i also thought about that at the first time (PHP
influence :D) but my goal is trying to limit the html code as much as
possible, so i didnt try it after all
@Shawn Milochik: i can do that with the context processors now, but
the problem is i have to send the context_instance in every functions.
Is there any way to walk around it ?
On Sat, Sep 25, 2010 at 2:01 AM, Tim Sawyer <list.django@calidris.co.uk> wrote:
>
> How about having a HTML form in your global template that submits to a
> url, and passes a next parameter?  You don't need to use a Django form,
> and you have one view (in this example at /accounts/login/) that does the
> login then http redirects back to the original url.
>
> Something like (this is off the top of my head, there will probably be
> typos!):
>
> <form action="/accounts/login/">
> <table>
> <th>Username:</th><td><input type="text" name="username"></td>
> <th>Password:</th><td><input type="password" name="password"></td>
> <th></th><td>
> <script type="text/javascript">
>  document.write('<input type="hidden" name="next" value="' + document.URL
> + '">');
> </script>
> <input type="submit" value="Login"></td>
> </table>
> </form>
>
> If you feel like it, you could do the submit using AJAX so the user never
> leaves the page.
>
> Hope that gives you some clues,
>
> Tim.
>
> > Hello all,
> >
> > I have a login form that should appear in every pages of the site. How can
> > i
> > create it from the views file ? Since every form is triggered by calling a
> > function in the views file, do i have to create the form in every
> > function?
> >
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment