Please don't post questions like this (about using Django) to this list 
(its topic is about developing Django). Use the django-users or the #django 
IRC channel list for that. 

On Thursday, May 18, 2017 at 6:58:59 AM UTC-4, Man Single wrote:
>
> Two question: 
> First: There are multiple type user, for example: NormalUser, StaffUser, 
> EnterpriseUser, the model like this:
> class User(AbstractBaseUser):
>     # some auth related field here
>
>
> class NormalUser(User):
>     # extend , not abstract
>
>
> class StaffUser(User):
>
>
> class EnterpriseUser(User):
>
>
> class AdminUser(User):
>
> my solution:
> But EnterpriseUser, can create childuser, so enterprise_user have two 
> type. there is one way add one user_type field to User model, represent 
> what type the user is, or according the 
> user relationship determine what the user type is: normaluser, 
> enterpriseuser, enterprise_child_user, admin.
>
> Second: There are two user background manager page, one for staff to 
> manage order, enterprise. one for normaluser to manage themself order. So 
> there are two url path: /staff_bg/  /user_bg/
> But they are use the same base template, the only different is the header 
> tab is not same. For example:
>
> user_header.html
> {% extends "core/base.html" %}
> <header>
>     <ul>
>         <li>your orders</li>
>     </ul>
> </header>
>
> staff_header.html
> {% extends "core/base.html" %}
> <header>
>     <ul>
>         <li>enterprise</li>
>     </ul>
> </header>
>
> then:
> user_realted.html:
> {% extends "core/user_header.html" %}  # focus here
> {% block body %} 
> # something
> {% endblock %}
>
> then:
> staff_related.html
> {% extends "core/staff_header.html" %} # focus here
> {% block body %} 
> # something
> {% endblock %}
>
> my solution:
> create core/middle.html:
> {% extends the_template_name %}
>
> then 
> user_realted.html:
> {% extends "core/middle.html" %}  # focus here
> {% block body %} 
> # something
> {% endblock %}
>
> One way write custom template processor, base one request.path pass 
> different the_template_name( "cms/user_header.html" or 
> "core/staff_header.html" ) to middle.html, but I think it's dirty,
> and if code wrong, maybe normal user can see the staff tabs.
>
> another way: 
> pass different the_template_name to middle.html, in every view. of course, 
> it will change every view that already wrote.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/2d6737c0-d582-4509-b810-592b1e822291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to