[Fixed]-Django child-parent template relation


You’ll have to add the AuthUser instance also to the followers view.

def followers(request, username):

    followers  = Followers.objects.filter(username=username)  
    userdetail  = AuthUser.objects.filter(username=username) 

    template = 'profil/em-profile-follower.html'
    context = RequestContext(request,{'followers': followers, 'userinfo': userdetail})
    return direct_to_template(template,context)

Now you’ll also have the userinfo in this template (and view)

I’m not sure how your model looks. But I assume that AuthUser has a ForeignKeyField(Follower).
If you give this field a related_name (like ‘followers’), you can do this:

userdetail = AuthUser.objects.filter(username=username)

and in your template you can then access your followers by doing:

Leave a comment