# Path: cronos/teilar/models.py
# class Departments(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     email = models.EmailField(null = True)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Teachers(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     email = models.EmailField(null = True)
#     department = models.ForeignKey(Departments)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class EclassLessons(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 500)
#     teacher = models.CharField(max_length = 500)
#     faculty = models.ForeignKey(EclassFaculties)
#     ltype = models.CharField(max_length = 100)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Websites(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     rss = models.URLField()
#     email = models.EmailField(null = True)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Blogs(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     rss = models.URLField()
#     email = models.EmailField(null = True)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name


from cronos.teilar.models import Departments, Teachers, EclassLessons, Websites, Blogs
from django.contrib.auth.models import User
from django.db import models

class UserProfile(models.Model):
    user = models.OneToOneField(User, primary_key = True, unique = True)
    dionysos_username = models.CharField(max_length = 15, unique = True)
    dionysos_password = models.CharField(max_length = 50)
    eclass_username = models.CharField(max_length = 30, null = True, blank = True)
    eclass_password = models.CharField(max_length = 50, null = True, blank = True)
    introduction_year = models.CharField(max_length = 5)
    registration_number = models.CharField(max_length = 8)
    school = models.ForeignKey(Departments)
    semester = models.CharField(max_length = 2)
    webmail_username = models.CharField(max_length = 30, null = True, blank = True)
    webmail_password = models.CharField(max_length = 50, null = True, blank = True)
    following_teachers = models.ManyToManyField(Teachers)
    following_websites = models.ManyToManyField(Websites)
    following_blogs = models.ManyToManyField(Blogs)
    following_eclass_lessons = models.ManyToManyField(EclassLessons)
    declaration = models.TextField(null = True, blank = True)
    grades = models.TextField(null = True, blank = True)

    def __unicode__(self):
        return self.user.username

class Files(models.Model):
    name = models.CharField(max_length = 255)

# Path: cronos/teilar/models.py
# class Departments(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     email = models.EmailField(null = True)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Teachers(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     email = models.EmailField(null = True)
#     department = models.ForeignKey(Departments)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class EclassLessons(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 500)
#     teacher = models.CharField(max_length = 500)
#     faculty = models.ForeignKey(EclassFaculties)
#     ltype = models.CharField(max_length = 100)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Websites(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     rss = models.URLField()
#     email = models.EmailField(null = True)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name
# 
# class Blogs(models.Model):
#     url = models.URLField(unique = True)
#     name = models.CharField(max_length = 255)
#     rss = models.URLField()
#     email = models.EmailField(null = True)
#     is_active = models.BooleanField(default = True)
# 
#     def __unicode__(self):
#         return self.name


# Path: cronos/accounts/models.py
from cronos.teilar.models import Departments, Teachers, EclassLessons, Websites, Blogs
from django.contrib.auth.models import User
from django.db import models


class UserProfile(models.Model):
    user = models.OneToOneField(User, primary_key = True, unique = True)
    dionysos_username = models.CharField(max_length = 15, unique = True)
    dionysos_password = models.CharField(max_length = 50)
    eclass_username = models.CharField(max_length = 30, null = True, blank = True)
    eclass_password = models.CharField(max_length = 50, null = True, blank = True)
    introduction_year = models.CharField(max_length = 5)
    registration_number = models.CharField(max_length = 8)
    school = models.ForeignKey(Departments)
    semester = models.CharField(max_length = 2)
    webmail_username = models.CharField(max_length = 30, null = True, blank = True)
    webmail_password = models.CharField(max_length = 50, null = True, blank = True)
    following_teachers = models.ManyToManyField(Teachers)
    following_websites = models.ManyToManyField(Websites)
    following_blogs = models.ManyToManyField(Blogs)
    following_eclass_lessons = models.ManyToManyField(EclassLessons)
    declaration = models.TextField(null = True, blank = True)
    grades = models.TextField(null = True, blank = True)

    def __unicode__(self):
        return self.user.username

class Files(models.Model):
    name = models.CharField(max_length = 255)

    department = models.ForeignKey(Departments)