Re: How to Query account/profile information for multiple account and allowing user edit or update acount
Thanks for your response This is what i want to do, I want to create an app that have two different users that is teachers(one type of user) and student(another type of user) the problem is how to create them without using AUTH_USER_MODEL = 'myapp.MyUser' since it is for one kind of user only. I have created the model as shown in last post but how to query individual details in their respective profile is the problem. Any way out. thanks -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4e7d04d2-fe57-45cd-8287-ae4aa55e1ba4%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to Query account/profile information for multiple account and allowing user edit or update acount
On Monday, 30 September 2013 19:33:31 UTC+1, Okorie Emmanuel wrote: > I have two problems > > 1. How can i populate the account >information of each user, this >what i have done but only info on >user models populates, the info on extended >field does not show on my template > > # models.py >class Student(Models.model): > user = foreignkey(user) > sex= models.charfied() > .. > > class Teacher(Models.model): > user = foreignkey(user) > sex= models.charfied() > salary models.charfield() > .. > > > ># views.py > > @login_required(login_url='/ > login/') > def account(request, template_name="account.html"): > if not request.user.is_authenticated(): > return HttpResponseRedirect('/login/') > regis = property(lambda u: Candidate.objects.get(User=u)[0]) > context = {'regis': regis} > return render_to_response('account.html', context, > context_instance=RequestContext(request)) > > What is that property/lambda stuff supposed to be doing? You *seem* to be trying to define something that will get a Candidate from a user, but I don't understand why you're wrapping it in 'property', and then of course you don't ever call it or pass it a User. If you did call it, you'd no doubt get multiple errors, for example `get` only returns a single object so indexing it with [0] is bound to raise an exception. Also, you might want to explain the relationship between a Candidate and the Student/Teacher models you've shown above. -- DR. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/beedfe13-35a8-4def-a0e4-72dc478775fb%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to Query account/profile information for multiple account and allowing user edit or update acount
Please try, django-userena, or django-registration, both deal with userdetails. Thx Frank Am 30.09.13 20:33, schrieb Okorie Emmanuel: I have two problems 1. How can i populate the account information of each user, this what i have done but only info on user models populates, the info on extended field does not show on my template # models.py class Student(Models.model): user = foreignkey(user) sex= models.charfied() .. class Teacher(Models.model): user = foreignkey(user) sex= models.charfied() salary models.charfield() .. # views.py @login_required(login_url='/ login/') def account(request, template_name="account.html"): if not request.user.is_authenticated(): return HttpResponseRedirect('/login/') regis = property(lambda u: Candidate.objects.get(User=u)[0]) context = {'regis': regis} return render_to_response('account.html', context, context_instance=RequestContext(request)) #account.html {% extends "base.html" %} {% block wrapper %} welcome {{ user.username }} Email: {{ user.email }} Name: {{ regis.u.first_name }} Sex: {{ regis.sex }} surname: {{ regis.last_name }} Date of birth: {{ regis.dob }} Marital status: {{ regis.marital_status }} passport: {{ regis.passport }} {% endblock %} {{user.username}}, {{ user.email }} shows but the rest does not show 2. i Have the profile form to enable user edit their account anytime they want, but i can't figure the code around it any solution to this problem thanks -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/50bfe62a-556b-4b29-8ba9-50d58006c2c1%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5249C868.4020203%40produktlaunch.de. For more options, visit https://groups.google.com/groups/opt_out.
How to Query account/profile information for multiple account and allowing user edit or update acount
I have two problems 1. How can i populate the account information of each user, this what i have done but only info on user models populates, the info on extended field does not show on my template # models.py class Student(Models.model): user = foreignkey(user) sex= models.charfied() .. class Teacher(Models.model): user = foreignkey(user) sex= models.charfied() salary models.charfield() .. # views.py @login_required(login_url='/ login/') def account(request, template_name="account.html"): if not request.user.is_authenticated(): return HttpResponseRedirect('/login/') regis = property(lambda u: Candidate.objects.get(User=u)[0]) context = {'regis': regis} return render_to_response('account.html', context, context_instance=RequestContext(request)) #account.html {% extends "base.html" %} {% block wrapper %} welcome {{ user.username }} Email: {{ user.email }} Name: {{ regis.u.first_name }} Sex: {{ regis.sex }} surname: {{ regis.last_name }} Date of birth: {{ regis.dob }} Marital status: {{ regis.marital_status }} passport: {{ regis.passport }} {% endblock %} {{user.username}}, {{ user.email }} shows but the rest does not show 2. i Have the profile form to enable user edit their account anytime they want, but i can't figure the code around it any solution to this problem thanks -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/50bfe62a-556b-4b29-8ba9-50d58006c2c1%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.