Django all-auth app, how to modify /account/profile page to display custom view -
after setting all-auth app, when user logs in, gets redirected to: accounts/profile/
page tells view doesn't exist.
i'm trying figure out kind of thing include there, , decided allow user change basic information.
i have users
app teacher
model, set follows:
class teacher(models.model): user = models.foreignkey(user, unique=true) rate = models.charfield(max_length=200) availability = models.booleanfield(default=false) verified = models.booleanfield(default=false)
i want accounts/profile/
page show form, containing information. user can edit these fields , edit firstname, lastname , email, belong different model - user
.
i can't seem started on this. when created detailed view profile page, error saying:
no pk or slug provided
i want django change current users info, not based on primary key in url. need custom view? i've looked @ [other solutions1 seem utilising private key parameter.
what need working view function, similar (not working):
def get_teacher_info(request): current_user = request.user teacher = get_object_or_404(teacher, username=current_user.username) return render(request, 'account/profile.html', { 'user':current_user, 'teacher': teacher, 'error_message': "the field blank", })
and in accounts/urls.py
i've added:
url(r"^profile/$", views.get_teacher_info, name="account_profile"),
but when make calls {% teacher.rate %}
in html template, get: invalid block tag on line 5: 'teacher.rate'. did forget register or load tag?
Comments
Post a Comment