django - How can i combine login to all the site with template inheritance? -
1. have base.html template describe site (the basic simple base.html) 2. have split_screen.html template extends base,html file , this:
{% extends "base.html" %} {% block content %} - part changes in base. <div id="top"> here come login form , under logo , top nav pannel </div> <div id="right"> here come static right nav pannel never change, there no need block </div> <div id="main"> {% block main%} main part, thing change every page in (all files) extend split_screen.html (every other page in site). {% endblock %} </div> {% endblock %}
ok, guess time question... so, looking , can't find (or maybe can't understand how implement) way use template inheritance , still have login backend view built (using email instead of username) implemented....i can't figure 1 out because every example read referring login page of own, need embedded in page (or don't i?).
can 1 please this?
ok, i've solved problem, didn't want user middleware , didn't use it, combining fe tutorials , tips, think got all.
- build main template (extends base.html) have amonge other things, form
- build mamber template inherit that.
- create simple index view (in main directory of site, nothing in return render main template build (for loaing main page when site uploads
- second view backend login, authentication proccess "/backend.py" , return user instance of user did success loging or none of not
- create custom login view request.post both emain , password fields (after checking in post - not bad resuilts , might , bouble posting , stuff that) user instance backend auth method , check if not none , if is_valid, if both go memeber page, if not go same page (will default, not have put @ end of view redirect render case (same level reques.post if.
well, basicly it, now, every request thrue this, no matter becouse extends main template build in beginning rest of site...
for seem work perfectly, if 1 has question or remarks happy hear them...10x
Comments
Post a Comment