How to create a login form with two more forms in it

97 views
Skip to first unread message

laurine ogutu

unread,
May 13, 2019, 7:34:13 AM5/13/19
to django...@googlegroups.com
Hi i have tried to create a login form where a teacher and student can login. Once the teacher clicks the teachers button, they can give their details. Once a student clicks the student button, they can give their details different from the teachers. I have a problem getting it done. Kindly help

MUHAMMAD AFZAL

unread,
May 13, 2019, 10:29:59 AM5/13/19
to django...@googlegroups.com
You could solve this problem in templates itself by placing form in different positions or using advanced frameworks like bootstrap of react.

And in views code, write it separately and Connect it through urls.

On May 13, 2019 5:03 PM, "laurine ogutu" <laurin...@gmail.com> wrote:
Hi i have tried to create a login form where a teacher and student can login. Once the teacher clicks the teachers button, they can give their details. Once a student clicks the student button, they can give their details different from the teachers. I have a problem getting it done. Kindly help

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPqJkvstQVci1GC%3D%3Dyq%2BxNi%3DjNgfc9YJdR4TbgXUg%2Bm3hzJQ1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

salimon jamiu olashile

unread,
May 13, 2019, 11:48:37 PM5/13/19
to django...@googlegroups.com
Hey, I think you can do this by adding conditionals to your template to handle the data sent from the view.
Regards 

On Mon, 13 May 2019 at 3:29 PM, MUHAMMAD AFZAL <afzala...@gmail.com> wrote:
You could solve this problem in templates itself by placing form in different positions or using advanced frameworks like bootstrap of react.

And in views code, write it separately and Connect it through urls.
On May 13, 2019 5:03 PM, "laurine ogutu" <laurin...@gmail.com> wrote:
Hi i have tried to create a login form where a teacher and student can login. Once the teacher clicks the teachers button, they can give their details. Once a student clicks the student button, they can give their details different from the teachers. I have a problem getting it done. Kindly help

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Najmath Ummer

unread,
May 14, 2019, 2:42:45 AM5/14/19
to django...@googlegroups.com
Hello,
You can use django-allauth for authentication and authorization (Login, Logout, Signup, Email verification etc)
then in settings.py add  LOGIN_REDIRECT_URL = 'yourapp:nameofurl'
then in the corresponding view you can write a function
def get_redirect_url(self):
if self.request.user.groups.filter(name='user').exists():
return reverse("users:home")
# return reverse("users:somethingelse")

you can add group to users from admin page
Thanks and Regards,

Najmath Ummer
Perleybrook Labs LLC


arun ashok

unread,
May 15, 2019, 7:54:24 AM5/15/19
to Django users
https://www.codementor.io/lakshminp/handling-multiple-forms-on-the-same-page-in-django-fv89t2s3j this will get you some idea about loading  multiple forms in a temlate.If  you want to hide the forms related to button click,add the forms in different div's,use java script to hide or display the form divs according to the buttons

laurine ogutu

unread,
May 23, 2019, 9:18:22 AM5/23/19
to django...@googlegroups.com
Thank you all

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages