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/ae20fe7a-abda-4b6c-aa45-3bf1bba48c57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to