# Path: account/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User)
#     profile_picture = models.ImageField(upload_to=user_profile_picture, null=True, blank=True)
#     description = models.TextField(null=True, blank=True)
#     roll_number = models.CharField(max_length=16, null=True, blank=True)
#     type = models.CharField(max_length=16, null=True, blank=True)
#     mobile = models.CharField(max_length=16, null=True, blank=True)
#     is_alumni = models.BooleanField(default=False)
#     sex = models.CharField(max_length=10, choices=SEXES, null=True, blank=True)
#     _history_ = HistoricalRecords()
# 
#     def __str__(self):
#         return self.user.username
# 
# Path: core/utils.py
# DEGREES = [
#     ['BTECH', 'Bachelor of Technology'],
#     ['MTECH', 'Master of Technology'],
#     ['DD', 'B.Tech. + M.Tech. Dual Degree'],
#     ['MSC', 'Master of Science'],
#     ['PHD', 'Doctor of Philosophy'],
#     ['BDES', 'Bachelor of Design'],
#     ['MDES', 'Master of Design'],
#     ['MPHIL', 'Master of Philosophy'],
#     ['MMG', 'Master of Management'],
#     ['MSEx', 'M.S. (Exit Degree)'],
#     ['MtechEx', 'Master of Technology (Exit Degree)'],
#     ['MtechPhDDD', 'M.Tech. + Ph.D. Dual Degree'],
#     ['PC', 'Preparatory Course'],
#     ['VS', 'Visiting Student'],
#     ['MPhilEx', 'Master of Philosophy (Exit Degree)'],
#     ['MScEx', 'Master of Science (Exit Degree)'],
#     ['MScMTechDD', 'M.Sc. + M.Tech. Dual Degree'],
#     ['MScPhDDD', 'M.Sc. + Ph.D. Dual Degree'],
#     ['MPhilPhDDD', 'M.Phil. + Ph.D. Dual Degree'],
#     ['EMBA', 'Executive MBA'],
#     ['FYBS', 'Four Year BS'],
#     ['IMTECH', 'Integrated M.Tech.'],
#     ['MSCBR', 'Master of Science By Research'],
#     ['TYMSC', 'Two Year M.Sc.'],
#     ['FYIMSC', 'Five Year Integrated M.Sc.'],
#     ['DIIT', 'D.I.I.T.'],
#     ['DIITEx', 'D.I.T.T. (Exit Degree)'],
# ]
# 
# HOSTELS = [
#     ['1', 'Hostel 1'],
#     ['2', 'Hostel 2'],
#     ['3', 'Hostel 3'],
#     ['4', 'Hostel 4'],
#     ['5', 'Hostel 5'],
#     ['6', 'Hostel 6'],
#     ['7', 'Hostel 7'],
#     ['8', 'Hostel 8'],
#     ['9', 'Hostel 9'],
#     ['10', 'Hostel 10'],
#     ['11', 'Hostel 11'],
#     ['12', 'Hostel 12'],
#     ['13', 'Hostel 13'],
#     ['14', 'Hostel 14'],
#     ['15', 'Hostel 15'],
#     ['16', 'Hostel 16'],
#     ['tansa', 'Tansa'],
#     ['qip', 'QIP'],
# ]
# 
# SEXES = [
#     ('male', 'Male'),
#     ('female', 'Female'),
#     ('other', 'Other'),
# ]
# 
# SORTED_DISCIPLINES = sorted(DISCIPLINES, key=lambda x: x[1])
# 
# class TabNav(object):
#     def __init__(self, tab, name=None, template_name=None, base_url=None, is_default=False):
#         if not tab or not base_url:
#             raise ValueError('tab and base_url cannot be None')
#         self.tab = tab
#         if not name:
#             self.name = tab.title()
#         else:
#             self.name = name
#         if not template_name:
#             self.template_name = '%s.html' % tab
#         else:
#             self.template_name = template_name
#         self.is_default = is_default
#         self.base_url = base_url
#         self.is_active = False
# 
#     @property
#     def url(self):
#         if not self.is_default:
#             return reverse(self.base_url, args=[self.tab])
#         return reverse(self.base_url)
# 
#     @property
#     def tab_name(self):
#         if not self.is_default:
#             return self.tab
#         return ''


from django.core.mail.message import make_msgid
from django.templatetags.static import static
from django.views.generic import TemplateView
from account.models import UserProfile
from core.utils import DEGREES, HOSTELS, SEXES, SORTED_DISCIPLINES, TabNav
    def get(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        if request.user.is_authenticated():
            context['base_template'] = 'sso/logged_in.html'
        else:
            context['base_template'] = 'sso/root.html'

        return self.render_to_response(context)


tabs_list = [
    ('basic', 'Basic', 'basic.html'),
    ('api', 'APIs', 'api.html'),
    ('widgets', 'Widgets', 'widget.html'),
    ('best-practices', 'Best Practices', 'practices.html'),
    ('libraries', 'Libraries', 'library.html'),
]


class DocView(TemplateView):
    template_name = 'sso/5-minutes-doc.html'
    tabs = [TabNav(tab[0], tab[1], tab[2], 'doc', tab[0] == 'basic') for tab in tabs_list]

    def get_context_data(self, **kwargs):
        context = super(DocView, self).get_context_data(**kwargs)
        context['login_js_url'] = static('widget/js/login.min.js')
        context['Message_ID'] = make_msgid()
        context['SORTED_DISCIPLINES'] = SORTED_DISCIPLINES
        context['DEGREES'] = DEGREES
        context['HOSTELS'] = HOSTELS

# Path: account/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User)
#     profile_picture = models.ImageField(upload_to=user_profile_picture, null=True, blank=True)
#     description = models.TextField(null=True, blank=True)
#     roll_number = models.CharField(max_length=16, null=True, blank=True)
#     type = models.CharField(max_length=16, null=True, blank=True)
#     mobile = models.CharField(max_length=16, null=True, blank=True)
#     is_alumni = models.BooleanField(default=False)
#     sex = models.CharField(max_length=10, choices=SEXES, null=True, blank=True)
#     _history_ = HistoricalRecords()
# 
#     def __str__(self):
#         return self.user.username
# 
# Path: core/utils.py
# DEGREES = [
#     ['BTECH', 'Bachelor of Technology'],
#     ['MTECH', 'Master of Technology'],
#     ['DD', 'B.Tech. + M.Tech. Dual Degree'],
#     ['MSC', 'Master of Science'],
#     ['PHD', 'Doctor of Philosophy'],
#     ['BDES', 'Bachelor of Design'],
#     ['MDES', 'Master of Design'],
#     ['MPHIL', 'Master of Philosophy'],
#     ['MMG', 'Master of Management'],
#     ['MSEx', 'M.S. (Exit Degree)'],
#     ['MtechEx', 'Master of Technology (Exit Degree)'],
#     ['MtechPhDDD', 'M.Tech. + Ph.D. Dual Degree'],
#     ['PC', 'Preparatory Course'],
#     ['VS', 'Visiting Student'],
#     ['MPhilEx', 'Master of Philosophy (Exit Degree)'],
#     ['MScEx', 'Master of Science (Exit Degree)'],
#     ['MScMTechDD', 'M.Sc. + M.Tech. Dual Degree'],
#     ['MScPhDDD', 'M.Sc. + Ph.D. Dual Degree'],
#     ['MPhilPhDDD', 'M.Phil. + Ph.D. Dual Degree'],
#     ['EMBA', 'Executive MBA'],
#     ['FYBS', 'Four Year BS'],
#     ['IMTECH', 'Integrated M.Tech.'],
#     ['MSCBR', 'Master of Science By Research'],
#     ['TYMSC', 'Two Year M.Sc.'],
#     ['FYIMSC', 'Five Year Integrated M.Sc.'],
#     ['DIIT', 'D.I.I.T.'],
#     ['DIITEx', 'D.I.T.T. (Exit Degree)'],
# ]
# 
# HOSTELS = [
#     ['1', 'Hostel 1'],
#     ['2', 'Hostel 2'],
#     ['3', 'Hostel 3'],
#     ['4', 'Hostel 4'],
#     ['5', 'Hostel 5'],
#     ['6', 'Hostel 6'],
#     ['7', 'Hostel 7'],
#     ['8', 'Hostel 8'],
#     ['9', 'Hostel 9'],
#     ['10', 'Hostel 10'],
#     ['11', 'Hostel 11'],
#     ['12', 'Hostel 12'],
#     ['13', 'Hostel 13'],
#     ['14', 'Hostel 14'],
#     ['15', 'Hostel 15'],
#     ['16', 'Hostel 16'],
#     ['tansa', 'Tansa'],
#     ['qip', 'QIP'],
# ]
# 
# SEXES = [
#     ('male', 'Male'),
#     ('female', 'Female'),
#     ('other', 'Other'),
# ]
# 
# SORTED_DISCIPLINES = sorted(DISCIPLINES, key=lambda x: x[1])
# 
# class TabNav(object):
#     def __init__(self, tab, name=None, template_name=None, base_url=None, is_default=False):
#         if not tab or not base_url:
#             raise ValueError('tab and base_url cannot be None')
#         self.tab = tab
#         if not name:
#             self.name = tab.title()
#         else:
#             self.name = name
#         if not template_name:
#             self.template_name = '%s.html' % tab
#         else:
#             self.template_name = template_name
#         self.is_default = is_default
#         self.base_url = base_url
#         self.is_active = False
# 
#     @property
#     def url(self):
#         if not self.is_default:
#             return reverse(self.base_url, args=[self.tab])
#         return reverse(self.base_url)
# 
#     @property
#     def tab_name(self):
#         if not self.is_default:
#             return self.tab
#         return ''


# Path: sso/views.py
from django.core.mail.message import make_msgid
from django.templatetags.static import static
from django.views.generic import TemplateView
from account.models import UserProfile
from core.utils import DEGREES, HOSTELS, SEXES, SORTED_DISCIPLINES, TabNav

    def get(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        if request.user.is_authenticated():
            context['base_template'] = 'sso/logged_in.html'
        else:
            context['base_template'] = 'sso/root.html'

        return self.render_to_response(context)


tabs_list = [
    ('basic', 'Basic', 'basic.html'),
    ('api', 'APIs', 'api.html'),
    ('widgets', 'Widgets', 'widget.html'),
    ('best-practices', 'Best Practices', 'practices.html'),
    ('libraries', 'Libraries', 'library.html'),
]


class DocView(TemplateView):
    template_name = 'sso/5-minutes-doc.html'
    tabs = [TabNav(tab[0], tab[1], tab[2], 'doc', tab[0] == 'basic') for tab in tabs_list]

    def get_context_data(self, **kwargs):
        context = super(DocView, self).get_context_data(**kwargs)
        context['login_js_url'] = static('widget/js/login.min.js')
        context['Message_ID'] = make_msgid()
        context['SORTED_DISCIPLINES'] = SORTED_DISCIPLINES
        context['DEGREES'] = DEGREES
        context['HOSTELS'] = HOSTELS

        context['SEXES'] = SEXES