class Patient(models.Model): _id = models.CharField(null=False, unique=True, primary_key=True, max_length=11) birth_date = models.DateField(null=True) first_name = models.CharField(null=False, max_length=255) last_name = models.CharField(null=False, max_length=255) email = models.EmailField(blank=True, null=True, validators=[ EmailValidator, ]) phone = models.CharField(max_length=255, null=True) address = models.CharField(max_length=255, null=True) lat = models.CharField(max_length=255, null=True) long = models.CharField(max_length=255, null=True) collects = models.JSONField(null=True, blank=True, editable=False, default=[]) registration_date = models.DateTimeField(default=timezone.now) registered_by = models.EmailField(blank=True, null=True, validators=[ EmailValidator, ])
class User(models.Model): name = models.CharField(blank=False, max_length=200) email = models.EmailField(blank=False) insti_email = models.EmailField(blank=True, max_length=100) password_hash = models.CharField(blank=False, max_length=300) profile = models.EmbeddedField(blank=True, model_container=Profile) mesibo_details = models.EmbeddedField(blank=True, model_container=MesiboUser) def __str__(self): return self.name
class Setting(models.Model): paypalEmail = models.EmailField() siteEmail = models.EmailField() mobile = models.TextField() skype = models.TextField() siteName = models.TextField() address = models.TextField() iconFile = models.ImageField(default=DEFAUT_IMAGE, upload_to='Admin/Setting/Icon/') logoFile = models.ImageField(default=DEFAUT_IMAGE, upload_to='Admin/Setting/Logo/') date = models.DateTimeField(auto_now_add=True)
class vtrueUser(AbstractBaseUser): # MADN=models.CharField(max_length=50, primary_key=True) # _id=models.CharField(max_length=100,null=True,blank=True) MaDN = models.CharField(max_length=100, null=True, blank=True) TenDN = models.CharField(max_length=100, null=True, blank=True) ngaydangky = models.DateField(auto_now_add=True, null=True, blank=True) DiaChiDangkyKD = models.CharField(max_length=200, null=True, blank=True) DienThoaiDN = models.CharField(max_length=15, null=True, blank=True) Fax = models.CharField(max_length=20, null=True, blank=True) NganhNgheKDChinh = models.CharField(max_length=255, null=True, blank=True) ThoigiandangkyKD = models.CharField(max_length=100, null=True, blank=True) DaiDienCMND = models.CharField(max_length=20, null=True, blank=True) TenNguoiDaiDien = models.CharField(max_length=50, null=True, blank=True) ChucDanh = models.CharField(max_length=128, null=True, blank=True) EmailNguoiDaiDien = models.EmailField(max_length=128, null=True, blank=True) DienThoaiNguoiDaiDien = models.CharField(max_length=20, null=True, blank=True) TenHoSoDinhKem = models.CharField(max_length=150, null=True, blank=True) TrangThaiDuyet = models.IntegerField(null=True, blank=True) NoiCapCMND = models.CharField(max_length=100, blank=True, null=True) NgayCapCMND = models.DateField(blank=True, null=True) DiaChiGiaoDich = models.CharField(max_length=200, blank=True, null=True) requeststatus = models.IntegerField(blank=True, null=True) matinhthanh = models.CharField(max_length=100, blank=True, null=True) quanhuyen = models.CharField(max_length=200, blank=True, null=True) TenTK = models.EmailField(max_length=128, unique=True, primary_key=True) is_staff = models.BooleanField(default=False, null=True, blank=True) is_active = models.BooleanField(default=False, null=True, blank=True) MaCapBac = models.IntegerField(null=True, blank=True) ThoiGian = models.DateTimeField(null=True, blank=True) SessionTime = models.CharField(max_length=255, null=True, blank=True) usertype = models.CharField(max_length=255, null=True, blank=True) tensohuu = models.CharField(max_length=200, null=True, blank=True) congty_phongban = models.CharField(max_length=200, null=True, blank=True) firstLogin = models.DateTimeField(null=True, blank=True) is_superuser = models.BooleanField(default=False, null=True, blank=True) objects = UserManager() USERNAME_FIELD = 'TenTK' REQUIRED_FIELDS = [ 'TenDN', 'DiaChiDangkyKD', 'matinhthanh', 'TenNguoiDaiDien', 'DienThoaiNguoiDaiDien', 'is_staff', 'is_active' ] def has_perm(self, perm, obj=None): return self.is_superuser def has_module_perms(self, app_label): return self.is_superuser
class EmailAccounts(models.Model): e_id = models.ForeignKey(Account, on_delete=models.CASCADE) e_provider = models.CharField(max_length=50) e_email = models.EmailField() e_password = models.CharField(max_length=200) addon = models.DateTimeField(default=datetime.now()) addpassword = models.BooleanField(default=False)
class Faculty(models.Model): faculty_id = models.CharField(max_length=7, null=False) faculty_name = models.CharField(max_length=30, null=True) designation = models.CharField(max_length=30, null=True) department = models.CharField(max_length=2, choices=DEPT_LIST, null=False, default='CE') image = models.FileField(upload_to='', blank=True, default='NoImage.png') # qualifications = models.ArrayField(model_container=Qualification, null=True) phone = PhoneNumberField( blank=False, null=False, ) email = models.EmailField(blank=True, null=True) website = models.URLField(max_length=200, null=True) office = models.CharField(max_length=30, null=True) biography = models.TextField(null=True) specializations = models.ArrayField(model_container=Topic, model_form_class=TopicForm, null=True) teaching_interests = models.ArrayField(model_container=Topic, null=True) faculty_type = models.CharField(max_length=10, null=True) class Meta: verbose_name_plural = "faculties"
class UserDetail(models.Model): class params: db = 'default' UserId = models.CharField(max_length=50,default='',blank=True) FirstName = models.CharField(max_length=50,default='',blank=True) LastName = models.CharField(max_length=50,default='',blank=True) Phone = models.CharField(max_length=10,default='',blank=True) Age = models.IntegerField(blank=True) Password = models.CharField(max_length=100,default='',blank=True) Email = models.EmailField(blank=True) SecurityQuestion = models.CharField(max_length=150,default='',blank=True) SecurityAnswer = models.CharField(max_length=500,default='',blank=True) profilePic = models.ImageField(upload_to='media', default='media/user.png') Score = models.IntegerField(default=0) # Categories = models.ListCharField( # base_field = models.CharField(max_length=50, blank=True), # max_length = (100*100) # ) # Categories = models.ArrayField(model_container=Tags,model_form_class=None) MALE = 'M' FEMALE = 'F' OTHER = 'O' GENDER_CHOICES = [ (MALE, 'Male'), (FEMALE, 'Female'), (OTHER, 'Other') ] Gender = models.CharField(max_length=1,default='',choices=GENDER_CHOICES) def __str__(self): return self.UserId
class CustomUserWithoutIsActiveField(AbstractBaseUser): username = models.CharField(max_length=150, unique=True) email = models.EmailField(unique=True) objects = UserManager() USERNAME_FIELD = 'username'
class DataPatinet(models.Model): # no primary key is chosen so the databse will chose for us. By default it # 'id'. first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50, default='NA') patient_id = models.CharField(max_length=50) email = models.EmailField(default='') phone = models.CharField(max_length=12, null=True) age = models.IntegerField(null=True) image = models.ImageField(default='default.png', upload_to='retina_images') # comments = models.CharField(max_length=150) def __str__(self): return f"Created Patient with ID: {self.patient_id}" def save(self): super().save() img = Image.open(self.image.path) if img.height > 300 or img.width > 300: output_size = (300, 300) img.thumbnail(output_size) img.save(self.image.path)
class CustomUser(AbstractBaseUser, PermissionsMixin): """ Custom user model. Set username field to 'email'. Set required fields 'first_name'. Overwrite objects with our custom user manager. """ email = models.EmailField(unique=True) first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100, blank=True) occupation = models.CharField(max_length=100, blank=True) company = models.CharField(max_length=100, blank=True) profile_title = models.CharField(max_length=100, blank=True, default='What I\'m doing') profile_description = models.TextField(blank=True) date_joined = models.DateTimeField(default=timezone.now) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] objects = CustomUserManager() def __str__(self): return self.email
class Author(models.Model): name = models.CharField(max_length=200) email = models.EmailField() avatar = models.ImageField(upload_to='authors', storage=gridfs_storage) def __str__(self): return self.name
class User(AbstractUser): username = None first_name = models.CharField(max_length=120) last_name = models.CharField(max_length=120) email = models.EmailField( verbose_name='email address', max_length=255, unique=True, ) is_lecture = models.BooleanField(default=False) is_student = models.BooleanField(default=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] objects = UserManager() def get_absolute_url(self): return reverse("users:view", kwargs={"pk": self.pk}) # return f"/users/{self.id}" def get_full_name(self): return self.first_name.__str__()+" "+self.last_name.__str__() def get_api_uri(self, request=None): return api_reverse('api-users:student-rud', kwargs={'pk': self.pk}, request=request)
class User(AbstractUser): username = None email = models.EmailField('email address', unique=True) phone_regex = RegexValidator( regex=r'^\+?1?\d{9,15}$', message= "Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed." ) phone = models.CharField(validators=[phone_regex], max_length=17, blank=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] objects = UserManager() def parks(self): return Park.objects.filter(user=self).order_by('start') def full_name(self): return self.first_name + ' ' + self.last_name def __str__(self): return self.email
class Users(models.Model): uid = models.CharField(max_length=10, primary_key=True) is_doctor = models.BooleanField(max_length=10) is_pharmacist = models.BooleanField(max_length=10) is_patient = models.BooleanField(max_length=10) name = models.EmailField(blank=True) password = models.CharField(max_length=128)
class User(models.Model): group_choice = (('g1', '학생'), ('g2', '직장인'), ('g3', '일반인')) group = models.CharField(max_length=3, choices=group_choice, default="g1") name = models.CharField(max_length=15) education = models.JSONField() grader_choice = (("gr1", "1학년"), ("gr2", "2학년"), ("gr3", "3학년"), ("gr4", "4학년")) grader = models.CharField(max_length=4, choices=grader_choice, default="gr1") states_chocie = (("s1", "재학"), ("s2", "휴학"), ("s3", "졸업")) states = models.CharField(max_length=3, choices=states_chocie, default="s1") birthday = models.CharField(max_length=12) telephone = models.CharField(max_length=15) email = models.EmailField() address = models.TextField() self_image = models.CharField(max_length=10) date = models.DateField(auto_now_add=True) user_id = models.PositiveIntegerField(unique=True, primary_key=True) objects = models.DjongoManager() def __str__(self): return str(self.user_id)
class Account(AbstractBaseUser): _id = models.ObjectIdField() email = models.EmailField(verbose_name="email", max_length=60, unique=True) # all required fields when build user model username = models.CharField(max_length=30, unique=True) date_joined = models.DateTimeField(verbose_name='date joined', auto_now_add=True) last_login = models.DateTimeField(verbose_name='last login', auto_now=True) is_admin = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) # set it to the field you want to use for login USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] objects = MyAccountManager() def __str__(self): return self.email # For checking permissions. to keep it simple all admin have ALL permissons def has_perm(self, perm, obj=None): return self.is_admin # Does this user have permission to view this app? (ALWAYS YES FOR SIMPLICITY) def has_module_perms(self, app_label): return True
class UserProfile(models.Model): _id = models.ObjectIdField() user = models.ForeignKey(User, on_delete=models.CASCADE) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) email_address = models.EmailField(max_length=254) phone_number = models.CharField(max_length=10) alternate_phone = models.CharField(max_length=254) kyc_verified = models.BooleanField() accounts_linked = models.ArrayReferenceField(to=Accounts, blank=True) profile_pic = models.ImageField(upload_to=get_file_path, default='', blank=True, null=True) user_joined_date = models.CharField(max_length=50) transactions_linked = models.ArrayReferenceField(to=Transactions, on_delete=models.CASCADE, blank=True) tickets_linked = models.ArrayReferenceField(to=Ticket, on_delete=models.CASCADE, blank=True) cards_linked = models.ArrayReferenceField(to=Card, on_delete=models.CASCADE, blank=True) wallets_linked = models.ArrayReferenceField(to=Wallet, on_delete=models.CASCADE, blank=True) def __str__(self): return str(self.user.id)
class User(AbstractBaseUser, PermissionsMixin): """Database model for users in the system""" username = models.CharField(max_length=255, unique=True) email = models.EmailField(max_length=255, unique=True) is_verified = models.BooleanField(default=False) is_online = models.BooleanField(default=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) is_staff = models.BooleanField(default=False) subscription = models.ForeignKey(Subscription, on_delete=models.SET_NULL, null=True) objects = UserManager() USERNAME_FIELD = 'username' REQUIRED_FIELDS = ['email'] def __str__(self): """Return string representation of the user's username""" return self.username def tokens(self): """ Genreate Access and Refresh Token for current user """ user_token = RefreshToken.for_user(self) return { 'refresh': str(user_token), 'access': str(user_token.access_token), }
class Account(AbstractBaseUser, PermissionsMixin): username = models.CharField(verbose_name="Username", max_length=30, null=False) email = models.EmailField(verbose_name="Email Address", max_length=30, unique=True) phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'.Up to 15 digits " "allowed.") number = models.CharField(verbose_name="Phone Number", validators=[phone_regex], max_length=17) date_joined = models.DateTimeField(verbose_name="Join Date", auto_now_add=True) last_login = models.DateTimeField(verbose_name="Last Login Date", auto_now=True) password = models.CharField(verbose_name="Password", max_length=100, null=False) is_admin = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) hide_email = models.BooleanField(default=True) objects = MyAccountManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] def __str__(self): return self.username def has_perms(self, perm_list, obj=None): return self.is_admin def has_module_perms(self, app_label): return self.is_superuser
class User(AbstractBaseUser, PermissionsMixin, TimestampedModel): username = models.CharField(db_index=True, max_length=255, unique=True) email = models.EmailField(db_index=True, unique=True) is_active = models.BooleanField(default=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] objects = UserManager() def __str__(self): return self.email @property def token(self): return self._generate_jwt_token() def get_full_name(self): return self.username def get_short_name(self): return self.username def _generate_jwt_token(self): dt = datetime.now() + timedelta(days=STC_TOKEN_EXPIRY_DATE) token = jwt.encode({ 'id': self.pk, 'exp': int(dt.strftime('%s')) }, settings.SECRET_KEY, algorithm='HS256') return token.decode('utf-8')
class Account(AbstractBaseUser, PermissionsMixin): name = models.CharField(verbose_name="Name", max_length=100, null=False) email = models.EmailField(verbose_name="Email", max_length=100, unique=True) password = models.CharField(verbose_name="Password", max_length=100, null=False) date_joined = models.DateTimeField(verbose_name="Join Date", auto_now_add=True) last_login = models.DateTimeField(verbose_name="Last Login Date", auto_now=True) is_admin = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) objects = MyAccountManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['name'] def __str__(self): return self.name def has_perms(self, perm_list, obj=None): return self.is_admin def has_module_perms(self, app_label): return self.is_superuser
class ReferenceAuthor(models.Model): name = models.CharField(max_length=200) email = models.EmailField() # _id = models.ObjectIdField() def __str__(self): return self.name
class Student(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) eid = models.CharField(max_length=20) phone = models.CharField(max_length=12) email = models.EmailField(max_length=100) linkedIn = models.CharField(max_length=100, blank=True) resume_link = models.URLField(max_length=100, blank=True) intentions = models.DictField(default={}) interests = models.DictField(default={}) time_commitment = models.CharField(max_length=100) international = models.BooleanField(default=False) fin_aid = models.BooleanField(default=False) transportation = models2.BooleanField(default=False) flexible_hours = models2.BooleanField(default=False) work_remotely = models2.BooleanField(default=False) other_availability = models.TextField(max_length=500, blank=True) school = models.DictField(default={}) program = models.DictField(default={}) experience = models.DictField(default={}) tech_skills = models.DictField(default={}) prof_skills = models.DictField(default={}) other_skills = models.TextField(max_length=500, blank=True) cohort = models.CharField(max_length=100) unique_id = models.CharField(max_length=100, unique=True, null=True) created_at = models.DateTimeField(auto_now_add=True) hear = models.CharField(max_length=100)
class Users(models.Model): name = models.CharField(max_length=100) email = models.EmailField(max_length=100) password = models.CharField(max_length=100) def __str__(self): return self.name
class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, unique=True) username = models.CharField(blank=True, null=True, max_length=50) email = models.EmailField(('email address'), unique=True) first_name = models.CharField(blank=False, max_length=50) last_name = models.CharField(blank=False, max_length=50) clout = models.IntegerField(default=0) courses = models.ArrayReferenceField(to='posts.Course', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') posts = models.ArrayReferenceField(to='posts.Post', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') comments = models.ArrayReferenceField(to='posts.Comment', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') isTutor = models.BooleanField(default=False) # Overwriting default username field in Django's AbstractUser class. Allows for unique check for email and prevents usernames from being required. USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username', 'first_name', 'last_name'] def __str__(self): return "{} {}".format(self.first_name, self.last_name)
class TimelineComment(models.Model): _id = models.ObjectIdField() post_id = models.CharField(max_length=24) user_email = models.EmailField() likes = models.ListField(default=[], blank=True) content = models.TextField(max_length=256) Timestamp = models.DateTimeField(auto_now=True)
class GenericModel(models.Model): big_int = models.BigIntegerField() bool = models.BooleanField() char = models.CharField(max_length=20) comma_int = models.CommaSeparatedIntegerField() date = models.DateField() date_time = models.DateTimeField() decimal = models.DecimalField(max_digits=10, decimal_places=5) email = models.EmailField() float = models.FloatField() integer = models.IntegerField() null_bool = models.NullBooleanField() pos_int = models.PositiveIntegerField() pos_small_int = models.PositiveSmallIntegerField() slug = models.SlugField() small_int = models.SmallIntegerField() text = models.TextField() time = models.TimeField() url = models.URLField() ip = models.GenericIPAddressField() uuid = models.UUIDField() # TODO: add these # basic_file = models.FileField() # image = models.ImageField() objects = models.DjongoManager()
class Account(models.Model): First_name = models.CharField(max_length=50) Last_name = models.CharField(max_length=50) Username = models.CharField(max_length=50, unique=True) Emailaddress = models.EmailField(max_length=50, unique=True) Password = models.CharField(max_length=50) created_on = models.DateTimeField(auto_now_add=True, editable=False)
class Ad(models.Model): header = models.CharField(max_length=70) section_name = models.OneToOneField(Section, on_delete=True) description = models.CharField(max_length=9000) location = models.CharField() phone = models.IntegerField() email = models.EmailField() contact_person = models.CharField(max_length=20)
class Pessoa(models.Model): nome = models.CharField(max_length=100) cpf = models.CharField(max_length=15) email = models.EmailField(null=True, blank=True) curriculo = models.TextField(max_length=500, null=True, blank=True) def __str__(self): return self.nome