class AccountModel(models.Model): id = models.UUIDField(default=uuid.uuid4, primary_key=True) user = models.OnetoOneField(User, on_delete=models.CASCADE) domain = models.CharField(max_length=50) registeration_number = models.CharField(max_length=50) phone = models.CharField(max_length=20) test = models.BooleanField(default=False)
class Pharmacy(models.Model): licenceNumber = models.PositiveIntegerField(validators = [MinValueValidator(200000000000),MaxValueValidator(999999999999)], null = False, blank = False, unique = True, verbose_name = 'شماره پروانه') fullname = models.CharField(db_index = True, max_length = 100, null = False , blank = False, verbose_name = 'نام داروخانه') address = models.OnetoOneField('Address', on_delete = models.CASCADE,null = False, blank = False, unique = True, verbose_name = 'آدرس داروخانه') contactDetails = models.OneToOneField('ContactDetails', on_delete = models.CASCADE, null = False, blank = False, unique = True, verbose_name = 'شماره تماس های داروخانه') person = models.OneToOneField('Person', on_delete = models.CASCADE, nill = False, blank = False, unique = True, verbose_name = 'مدیریت داروخانه') def __str__(self): return self.fullname
class Author(models.Model): user = models.OnetoOneField(User, on_delete=models.CASCADE) author_rating = models.IntegerField(default=0, verbose_name='Рейтинг автора') def update_rating(self): self.author_rating = ( Post.post_rating * 3) + Comment.user.comment_rating + Comment.post.comment_rating self.save()
class UserProfileInfo(models.Model): user = models.OnetoOneField(User, primary_key=True, on_delete=models.CASCADE) profile = models.ImageField(upload_to="profile_pics", blank=True, null=True) def __str__(self): return self.user.username
class UserProfile(models.Model): user = models.OnetoOneField(User, on_delete=models.CASCADE, related_name='profile') org = models.CharField('用户名', max_length=128, blank=True) telephone = models.CharField('电话', max_length=50, blank=True) mod_date = models.DateTimeField('更新日期', auto_now=True) class __str__(self): return self.user class Meta: verbose_name = '用户文档' verbose_name_plural = verbose_name
class BRMuser(models.Model): user = models.OnetoOneField(User, on_delete="models.CASCADE") nickname = models.CharField(max_length=20, null=False)
class Student(models.Model): user = models.OnetoOneField(User, on_delete=models.CASCADE) def __str__(self): return self.user.username
class Profile(models.Model): user = models.OnetoOneField(User, on_delete=models.CASCADE) image = models.ImageField(default='default.jpg', upload_to='profile_pics') def __str__(self): return f'(self.user.username) Profile'