Esempio n. 1
0
class MistriInformation(models.Model):
    user = models.OneToOneField(
        User, on_delete=models.CASCADE, null=True,
        blank=True)  # Relation With one to one User Model And True Nullable
    mistri_id = models.CharField(max_length=10)
    uid = models.CharField(max_length=1000)
    email = models.CharField(max_length=100)
    profile_image_link = models.CharField(max_length=400)
    name = models.CharField(max_length=100)
    phone = PhoneField(blank=False, help_text='Contact phone number')
    image = models.ImageField(upload_to='media')
    dob = models.CharField(max_length=500)
    city = models.CharField(max_length=100)
    area = models.CharField(max_length=200)
    sub_area = models.CharField(max_length=200)
    address = models.CharField(max_length=200)

    ability = models.CharField(max_length=100, null=True)
    expiriance = models.CharField(max_length=200, null=True)
    emargency = models.CharField(max_length=100)
    emargency_name = models.CharField(max_length=200)
    emargency_number = PhoneField(blank=False, help_text='emargency_contuct')
    education = models.CharField(max_length=200)
    is_bick = models.CharField(max_length=20)
    is_instrument = models.CharField(max_length=20)
    helper_mistri = models.CharField(max_length=200)

    service = models.CharField(max_length=200)
    sub_service = models.CharField(max_length=200)
    service_type = models.CharField(max_length=200)

    def __str__(self):
        return 'Mistri name ==>{0}'.format(self.name)
Esempio n. 2
0
class Accounts(models.Model):
    id = models.AutoField(primary_key=True)
    title = models.CharField(unique=True, max_length=50, null=True, blank=True)
    description = models.CharField(max_length=100, null=True, blank=True)
    source = models.CharField(max_length=100, null=True, blank=True)
    url = models.URLField(max_length=100, null=True, blank=True)
    domain = models.CharField(max_length=100, null=True, blank=True)
    tags = models.CharField(max_length=70, null=True, blank=True)
    technology = models.CharField(max_length=100, null=True, blank=True)
    assign_to = models.CharField(max_length=50, null=True, blank=True)
    estimated_budget = models.IntegerField(null=True, blank=True)
    referred_by = models.CharField(max_length=100, null=True, blank=True)
    attachment = models.FileField(blank=True, null=True, upload_to='media/')
    full_name = models.CharField(max_length=100, null=True, blank=True)
    email = models.EmailField(null=True, blank=True)
    secondary_email1 = models.EmailField(null=True, blank=True)
    secondary_email2 = models.EmailField(null=True, blank=True)
    company = models.CharField(max_length=100, null=True, blank=True)
    designation = models.CharField(max_length=100, null=True, blank=True)
    skype_id = models.CharField(max_length=50, null=True, blank=True)
    street_address = models.CharField(max_length=100, null=True, blank=True)
    city = models.CharField(max_length=50, null=True, blank=True)
    state = models.CharField(max_length=50, null=True, blank=True)
    country = models.CharField(max_length=30, null=True, blank=True)
    phone = PhoneField(blank=True, null=True)
    secondary_phone1 = PhoneField(blank=True, null=True)
    secondary_phone2 = PhoneField(blank=True, null=True)
    status = models.CharField(max_length=20, null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField(auto_now=True, null=True)

    def __str__(self):
        return self.title
Esempio n. 3
0
class Patient_B02(models.Model):
    patient_Guardian_Rec = models.CharField(max_length=100)
    patient_Rec = models.ForeignKey(Patient_B00, on_delete=models.DO_NOTHING)
    relationship_to_Patient = models.ForeignKey(Patient_B01,
                                                on_delete=models.DO_NOTHING,
                                                max_length=100)
    first_Name = models.CharField(max_length=100)
    middle_Name = models.CharField(max_length=100)
    last_Name = models.CharField(max_length=100)
    address_1 = models.CharField(max_length=200)
    address_2 = models.CharField(max_length=200)
    city = models.CharField(max_length=200)
    state = models.CharField(max_length=200)
    zip_Code = models.IntegerField()
    phone_Home = PhoneField(blank=True, help_text='Phone Number')
    phone_Work = PhoneField(blank=True, help_text='Phone Number')
    eMail_Address = models.EmailField(max_length=100)
    company_Rec = models.CharField(max_length=100)
    active_status = models.BooleanField(default=True)

    class Meta:
        verbose_name = 'Patient_B02'

    def __str__(self):
        return self.patient_Guardian_Rec
Esempio n. 4
0
class Address(models.Model):
    ''' Phone Number Format
        +[country code][number]x[extension]
        +12223334444x55 '''

    customer = models.ForeignKey(Customers,
                                 on_delete=models.CASCADE,
                                 blank=True,
                                 null=True)
    dealer = models.ForeignKey(Dealers,
                               on_delete=models.CASCADE,
                               blank=True,
                               null=True)
    address1 = models.CharField(max_length=50)
    address2 = models.CharField(max_length=50, null=True, blank=True)
    city = models.CharField(max_length=20)
    zipCode = models.CharField("Zip/Postal Code", max_length=20)
    phone = PhoneField(help_text='Contact phone number')
    secondary_phone = PhoneField(blank=True,
                                 help_text='Secondary phone number')
    country = CountryField(blank_label='(select country)')
    date_created = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.address1

    class Meta:
        verbose_name_plural = "Addresses"
Esempio n. 5
0
class Student(models.Model):
    first_name = models.CharField(max_length=50)
    middle_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    birth_day = models.DateField()
    grade = models.PositiveSmallIntegerField(
        choices=((9, 'Grade 9'), (10, 'Grade 10'), (11, 'Grade 11'),
                 (12, 'Grade 12'), (13, 'Grade 13')))
    school = models.CharField(max_length=50)
    phone = PhoneField(help_text='Contact phone number')
    mothers_number = PhoneField(help_text='Mother\'s contact phone number',
                                blank=True,
                                null=True)
    fathers_number = PhoneField(help_text='Father\'s contact phone number',
                                blank=True,
                                null=True)
    father_of_confession = models.CharField(max_length=50,
                                            blank=True,
                                            null=True)
    servant = models.ForeignKey(Servant,
                                related_name='students',
                                on_delete=models.SET_NULL,
                                blank=True,
                                null=True)
    residency_area = models.CharField(max_length=50)

    def __str__(self):
        return self.first_name + ' ' + self.middle_name + ' ' + self.last_name
Esempio n. 6
0
class Representada(models.Model):
    ''' En esta tabla recogemos los datos de las representadas '''
    idrepresentada = models.AutoField(primary_key=True)
    nombre_fiscal = models.CharField(max_length=45, blank=False)
    cif = models.CharField(max_length=45, blank=False)
    nombre_comercial = models.CharField(max_length=45)
    direccion = models.CharField(max_length=200)
    localidad = models.CharField(max_length=200)
    provincia = models.CharField(max_length=60)
    telefono_corp_1 = PhoneField(blank=True,
                                 help_text='Teléfono fijo empresa 1')
    telefono_corp_2 = PhoneField(blank=True,
                                 help_text='Teléfono fijo empresa 2')
    email_corp = models.EmailField(
        max_length=200,
        blank=False,
        unique=True,
        error_messages={
            'blank': 'Por favor, introduzca una dirección de correo valida',
            'unique': 'Una cuenta con esta dirección de correo ya existe.'
        },
    )
    web = models.CharField(max_length=200)
    logo = models.CharField(max_length=500, blank=True)

    def __str__(self):
        return self.nombre_comercial
Esempio n. 7
0
class Quarterly_Church_Planting_Update_Form(models.Model):
    DISTRICT_CHOICES =(("Nicobar", "Nicobar"),("North Middle Andaman", "North Middle Andaman"),("South Andaman", "South Andaman"),("Anantapur","Anantapur"),("Chittoor", "Chittoor"),("East Godavari","East Godavari"))
    timothy_CHOICES = (("True", "Yes"),("False","No") )
    id = models.AutoField(primary_key=True)
    Country = CountryField(blank_label='(select country)')
    National_Regional_Director_Name = models.CharField(max_length=100, null=True, blank=True)
    Email = models.EmailField(max_length=255, unique=False,default='', verbose_name='Email')
    Mobile_Numbers =  PhoneField(blank=True, default='', help_text='Contact phone number')
    DATE_OF_REPORTING = models.DateField()
    Paul_Name = models.CharField(max_length=100, null=True, blank=True)
    District = models.CharField(max_length=200,   choices = DISTRICT_CHOICES)
    Mobile_Number =  PhoneField(blank=True, default='', help_text='Contact phone number')
    Current_Book = models.CharField(max_length=100, null=True, blank=True)
    Number_of_Timothys = models.IntegerField()
    First_Generation_Church_Plants_Timothy = models.IntegerField()
    Number_of_Titus = models.IntegerField()
    Second_Generation_Church_Plants_Titus_disciple = models.IntegerField()
    Third_Generation_Church_Plants_Titus_disciple  = models.IntegerField()
    No_of_new_believers = models.IntegerField()
    Any_Previous_batch_churches_planted = models.CharField(max_length=200,choices = timothy_CHOICES)
    Orphans_Being_Impacted = models.IntegerField()
    Baptisms = models.IntegerField()
    Widows_Being_Impacted = models.IntegerField()

    def __str__(self):
        return self.National_Regional_Director_Name
Esempio n. 8
0
class User(AbstractUser):
    username = models.CharField(max_length=255, unique=True, db_index=True)
    email = models.EmailField(max_length=255, unique=True, db_index=True)
    is_verified = models.BooleanField(default=False)
    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    phone = PhoneField(blank=True, help_text='Contact phone number')
    mpesa_no = PhoneField(blank=True, help_text='Mpesa phone number')
    is_writer = models.BooleanField(default=False)
    is_team_manager = models.BooleanField(default=False)

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = ['username']

    def __str__(self):
        return f"{self.username}-{self.email}"

    def get_tokens_for_user(self):
        refresh = RefreshToken.for_user(self)
        return {
            'refresh': str(refresh),
            'access': str(refresh.access_token),
        }
Esempio n. 9
0
class Person(models.Model):
    user = models.OneToOneField(User,
                                on_delete=models.CASCADE,
                                null=True,
                                blank=True)
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    email = models.EmailField(max_length=254)
    type = models.CharField(max_length=50)
    position = models.CharField(max_length=50)
    level = models.CharField(max_length=50, default="0")
    department = models.CharField(max_length=50, null=True, blank=True)
    status = models.CharField(max_length=50)  # autofill
    phone = PhoneField(blank=True, help_text="Contact Phone Number")
    e_contact_first_name = models.CharField(max_length=50)
    e_contact_last_name = models.CharField(max_length=50)
    e_contact_cell_phone = PhoneField(help_text="Contact Phone Number")
    e_contact_work_phone = PhoneField(
        help_text="Contact Phone Number")  # default=e_contact_cell_phone
    e_contact_relationship = models.CharField(max_length=50)

    def __str__(self):
        return 'First Name: %s, Last Name: %s' % (self.first_name,
                                                  self.last_name)

    class Meta:
        verbose_name_plural = "Personnel"
Esempio n. 10
0
class Contact(models.Model):
    title = models.CharField(max_length=100)
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    mobile_number = PhoneField(blank=True, help_text='Contact phone number')
    office_phone = PhoneField(blank=True, help_text='Contact phone number')
    fax = PhoneField(blank=True, help_text='Contact phone number')
    toll_fee = PhoneField(blank=True, help_text='Contact phone number')
    email = models.EmailField(max_length=50)
Esempio n. 11
0
class Profile(models.Model):
    class Meta:
        verbose_name = 'Profile'
        verbose_name_plural = 'Profiles'

    LEVEL = (
        ('선생님', '선생님'),
        ('학생', '학생'),
    )
    user = models.OneToOneField(settings.AUTH_USER_MODEL,
                                on_delete=models.CASCADE,
                                verbose_name='user')
    #	name=models.CharField(max_length=10,null=True)
    create_date = models.DateField(auto_now_add=True, null=True)
    특이사항 = summer_fields.SummernoteTextField(blank=True)
    이름 = models.CharField(max_length=10,
                          blank=True,
                          help_text='위에 사용자 이름과 같은 학생 이름을 다시 한 번 더 작성해 주세요.')
    profile_image = models.ImageField(blank=True, upload_to='photo/')
    학생핸드폰번호 = PhoneField(blank=True, help_text='핸드폰번호를 적어주시고, ext)칸은 비워주세요')
    부모님핸드폰번호 = PhoneField(blank=True, help_text='핸드폰번호를 적어주시고, ext)칸은 비워주세요')
    직업 = models.CharField(
        max_length=10,
        choices=LEVEL,
        blank=True,
        default='학생',
        help_text='Class Level',
    )
    CHOICE = (('본사', '본사'), ('분당분원', '분당분원'))
    지점 = models.CharField(max_length=4, choices=CHOICE, null=True)
    CHOICES = (('초등학교', '초등학교'), ('중학교', '중학교'), ('고등학교', '고등학교'), ('일반',
                                                                    '일반'))
    학교 = models.CharField(max_length=4, choices=CHOICES, null=True, blank=True)
    학교이름 = models.CharField(max_length=30, blank=True, null=True)
    학년 = models.CharField(max_length=1, blank=True, null=True)
    modify_date = models.DateTimeField('변경 날짜', null=True, blank=True)
    STATES = (('재원', '재원'), ('휴원', '휴원'), ('퇴원', '퇴원'))
    회원현황 = models.CharField(max_length=2,
                            choices=STATES,
                            null=True,
                            blank=True)

    def __Str__(self):
        return self.name

    class Meta:
        ordering = ['-create_date']

    def get_absolute_url(self):
        return reverse('accounts:detail', args=[self.id])

    def get_previous_post(self):
        return self.get_previous_by_modify_date()

    def get_next_post(self):
        return self.get_next_by_modify_date()
Esempio n. 12
0
class Insurance_B01(models.Model):
    insurance_Representative_Rec = models.CharField(max_length=200)
    insurance_Rec = models.ForeignKey(Insurance_B00, on_delete=models.CASCADE)
    first_Name = models.CharField(max_length=200)
    last_Name = models.CharField(max_length=200)
    phone_1 = PhoneField(blank=True, help_text='Contact phone number')
    phone_2 = PhoneField(blank=True, help_text='Contact phone number')
    eMail_Address = models.CharField(max_length=200)
    active_status = models.BooleanField(default=True)

    def __str__(self):
        return self.insurance_Representative_Rec
Esempio n. 13
0
class UserProfile(models.Model):
    user = models.OneToOneField(
        User,
        on_delete=models.CASCADE,
        primary_key=True,
        related_name='profile',
        verbose_name='Користувач'
    )

    phone = PhoneField(null=True, verbose_name='Робочий номер телефону співробітника')

    phone_2 = PhoneField(null=True, verbose_name='Персональний номер телефону співробітника')

    email = models.EmailField(null=True, max_length=254, verbose_name='Персональна електронна адреса')

    birthday = models.DateField(null=True, blank=True,
                                verbose_name='Дата народження')
    position = models.CharField(max_length=50,
                                verbose_name='Посада')
    avatar = models.ImageField(upload_to='images/users',
                               verbose_name='Зображення')

    def get_avatar(self):
        if not self.avatar:
            return 'image/CKT'
        return self.avatar.url

    # метод, для создания фейкового поля таблицы в режиме read only
    def avatar_tag(self):
        return mark_safe('<img src="%s" width="100" height="100" />' % self.get_avatar())

    avatar_tag.short_description = 'Фото'

    date_start_work = models.DateField(null=True, blank=True,
                                       verbose_name='Дата прийому на роботу')
    STATUS_FORM_CHOICE = (
        ('1', 'на випробному терміні'),
        ('2', 'прийнятий')
    )
    status = models.CharField(max_length=1, choices=STATUS_FORM_CHOICE, help_text='Оберіть статус')

    @receiver(post_save, sender=User)
    def create_user_profile(sender, instance, created, **kwargs):
        if created:
            UserProfile.objects.create(user=instance)

    @receiver(post_save, sender=User)
    def save_user_profile(sender, instance, **kwargs):
        instance.profile.save()

    def __str__(self):
        return '{}'.format(self.user.last_name, )
Esempio n. 14
0
class Cliente_Representada(models.Model):
    '''En esta tabla vamos a recoger todos los clientes de nuestras representadas que
    gestionamos. '''
    TIPO_DE_CLIENTE = (
        ('AP', 'Almacén Papelería'),
        ('AR', 'Almacén Regalo'),
        ('AM', 'Almacén Multiprecio'),
        ('AA', 'Almacén Amarillo'),
        ('AJ', 'Almacén Juguetes'),
        ('SC', 'Suministrador Colegios'),
        ('SO', 'Suministrador de Oficinas'),
        ('DP', 'Detall Papeleria'),
        ('DB', 'Detall Bellas Artes'),
        ('DA', 'Detall Amarillo'),
        ('DR', 'Detall Regalo'),
        ('DJ', 'Detall Juguetes'),
    )
    NIVEL_CLIENTE = (
        ('A', 'A'),
        ('B', 'B'),
        ('C', 'C'),
        ('D', 'D'),
        ('E', 'E'),
        ('F', 'F'),
    )
    idcliente_representada = models.AutoField(primary_key=True)
    nombre_fiscal = models.CharField(max_length=45, blank=False)
    cif = models.CharField(max_length=45, blank=False)
    nombre_comercial = models.CharField(max_length=45)
    tipo_cliente = models.CharField(max_length=60, choices=TIPO_DE_CLIENTE)
    nivel_cliente = models.CharField(max_length=60, choices=NIVEL_CLIENTE)
    direccion = models.CharField(max_length=200)
    localidad = models.CharField(max_length=200)
    provincia = models.CharField(max_length=60)
    telefono_corp_1 = PhoneField(blank=True,
                                 help_text='Teléfono cliente fijo 1')
    telefono_corp_2 = PhoneField(blank=True,
                                 help_text='Teléfono cliente fijo 2')
    email_corp = models.EmailField(
        max_length=200,
        blank=False,
        unique=True,
        error_messages={
            'blank': 'Por favor, introduzca una dirección de correo valida',
            'unique': 'Una cuenta con esta dirección de correo ya existe.'
        },
    )
    web = models.CharField(max_length=200)

    def __str__(self):
        return self.nombre_comercial
Esempio n. 15
0
class Retailer(models.Model):
    retailer_id = models.AutoField(primary_key=True)
    retailer_firstname = models.CharField(max_length=35)
    retailer_lastname = models.CharField(max_length=25)
    retailer_GSTIN = models.CharField(max_length=25)
    retailer_phonenumber = PhoneField(help_text='Contact mobile number')
    retailer_phonenumber2 = PhoneField(null=True, blank=True)
    retailer_register_email_id = models.EmailField()
    retailer_email_id = models.EmailField(null=True, blank=True)
    longtitue = models.FloatField()
    antitude = models.FloatField()
    complete_address = models.CharField(max_length=100)

    def __str__(self):
        return self.retailer_firstname
class User(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=100, default='')
    mobile_number = PhoneField(blank=False, help_text='Contact phone number')
    alternate_contact_number = PhoneField(blank=True,
                                          help_text='Alternate contact number')
    address = models.CharField(max_length=100, default='')
    adhar_number = models.CharField(max_length=50, default=None)
    state = models.CharField(choices=state_choices, null=False, max_length=100)
    city = models.CharField(choices=CITIES, null=False, max_length=100)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.name + str(self.mobile_number.base_number)
Esempio n. 17
0
class Branch(models.Model):
    place = models.CharField(max_length=100)
    manager = models.ForeignKey(
        Visitor,
        models.SET_NULL,
        blank=True,
        null=True,
    )
    adress = models.CharField(max_length=300, null=True)
    phone = PhoneField(blank=True)
    mail = models.CharField(max_length=50, null=True)
    fax = PhoneField(blank=True)

    def __str__(self):
        return self.place
Esempio n. 18
0
class Phone(Core):
    parent_name = models.ManyToManyField(Parent, related_name='telephones')
    mobile_phone = PhoneField('Mobile Phone',
                              blank=True,
                              help_text='Phone number for contact')
    landline_phone = PhoneField('Landline Phone',
                                blank=True,
                                help_text='Phone number for contact')

    class Meta:
        verbose_name = 'Telephone'
        verbose_name_plural = 'Telephones'

    def __str__(self):
        return f'{self.mobile_phone}'
Esempio n. 19
0
class ClientAccountantInfo(models.Model):
    client_acc_info_accountant_name = models.TextField()
    client_acc_info_accountant_phone = models.BigIntegerField()
    client_acc_info_accountant_email = models.EmailField()
    client_acc_info_accountant_counsultant_name = models.TextField()
    client_acc_info_accountant_counsultant_phone = PhoneField()
    client_acc_info_accountant_counsultant_email = models.EmailField()
    client_acc_info_ca_name = models.TextField()
    client_acc_info_ca_phone = PhoneField()
    client_acc_info_ca_email = models.EmailField()
    client_id = models.IntegerField()

    class Meta:
        managed = True
        db_table = 'client_accountant_info'
Esempio n. 20
0
class TrainerProfile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to=profile_pictures)
    city = models.CharField(max_length=10, blank=True)
    state = models.CharField(max_length=10, blank=True)
    cell = PhoneField(blank=True)
    facebook = models.URLField(null=True, blank=True)
    instagram = models.URLField(null=True, blank=True)
    twitter = models.URLField(null=True, blank=True)
    linkedin = models.URLField(null=True, blank=True)
    bio = models.TextField(null=True, blank=True)

    class Meta:
        managed = True
        app_label = 'trainer'
        verbose_name = 'Trainer Profile'

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        group = Group.objects.get(name='Trainers')
        group.user_set.add(self.user)

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)

        if not config('ONSERVER', cast=bool):
            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)

    def __str__(self):
        return self.user.username
Esempio n. 21
0
class Profile(models.Model):
    user = models.OneToOneField(User,null=True, on_delete=models.CASCADE)
    first_name = models.CharField(max_length=128)
    second_name = models.CharField(max_length=128)
    phone = PhoneField(blank=True, help_text='Contact phone number')
    my_location  = models.CharField(max_length=128)
    my_neighborhood_name = models.ForeignKey('Neighbourhood',null=True, on_delete=models.SET_NULL)
    profile_pic = models.ImageField(upload_to='profile/', default='a.png')
    

    @classmethod
    def search_by_profile(cls, username):
        certain_user = cls.objects.filter(user__username__icontains = username)
        return certain_user

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

    @receiver(post_save, sender=User)
    def update_user_profile(sender, instance, created, **kwargs):
         if created:
            Profile.objects.create(user=instance)
            instance.profile.save()   

    @classmethod
    def get_by_id(cls, id):
        profile = Profile.objects.get(user = id)
        return profile

    @classmethod
    def filter_by_id(cls, id):
        profile = Profile.objects.filter(user = id).first()
        return profile    
Esempio n. 22
0
class Profile(models.Model):
    user = models.OneToOneField(User,
                                on_delete=models.CASCADE,
                                related_name="profiles")
    profile_image = models.ImageField(default='default.jpg',
                                      upload_to='media/profile_pics')
    cover_image = models.ImageField(default='cover.jpg',
                                    upload_to='media/cover_pics')
    phone = PhoneField(blank=True, help_text='Contact phone number')
    address = models.CharField(max_length=50, blank=True)
    dob = models.DateField(blank=True)

    def __str__(self):
        return f'{self.user.username} Profile'

    def save(self, *args, **kawrgs):
        super().save(*args, **kawrgs)

        img = Image.open(self.profile_image.path)
        cov = Image.open(self.cover_image.path)

        if img.height > 300 or img.width > 300:
            output_size = (300, 300)
            img.thumbnail(output_size)
            img.save(self.profile_image.path)
        else:
            img.save(self.profile_image.path)

        if cov.height > 650 or cov.width > 1650:
            output_size = (650, 1650)
            cov.resize(output_size)
            cov.save(self.cover_image.path)
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='profile_pics')
    phone = PhoneField(blank=True, help_text='Contact phone number')

    def __str__(self):
        return f'{self.user.username} Profile'
Esempio n. 24
0
class StaffProfile (models.Model):
    user = models.OneToOneField(CustomUser,on_delete=models.CASCADE)
    surname = models.CharField(max_length=50)
    other_name = models.CharField(max_length=50)
    telephone = PhoneField(help_text='Your Mobile Phone Number')
    def __str__(self):
        return self.surname+' '+self.othername
class Student(models.Model):
    user = models.OneToOneField(CustomUser,
                                on_delete=models.CASCADE,
                                null=True)
    class_id = models.ForeignKey(Class, on_delete=models.CASCADE, default=1)
    USN = models.CharField(primary_key='True', max_length=100)
    name = models.CharField(max_length=200)
    sex = models.CharField(max_length=50, choices=sex_choice, default='Male')
    DOB = models.DateField(default='1998-01-01')
    prntphno = PhoneField(blank="True",
                          help_text="Contact parent phone number")
    studphno = PhoneField(blank="True",
                          help_text="Contact student phone number")

    def __str__(self):
        return self.name
Esempio n. 26
0
class Patient(models.Model):
    """
    Table of patient's personal and contact information.
    """
    ### Personal Data
    person = models.AutoField(primary_key=True)
    given_name = models.CharField(max_length=100)  # Not null by default.
    surname = models.CharField(max_length=100)  # Not null by default.
    dob = models.DateField()  # Not null by default.
    gender = models.CharField(max_length=50,
                              choices=Gender.choices(),
                              default=Gender.F)
    race = models.CharField(max_length=50,
                            choices=Race.choices(),
                            default=Race.X)
    ethnicity = models.CharField(max_length=50,
                                 choices=Ethnicity.choices(),
                                 default=Ethnicity.X)

    ### Contact Info
    phone = PhoneField(blank=True)
    email = models.EmailField(validators=[validate_email
                                          ])  # Not null by default.
    street = NoCommaField(max_length=100)  # Not null by default.
    city = models.CharField(max_length=100)  # Not null by default.
    zip_code = models.CharField(max_length=5)  # Not null by default.
    state = models.CharField(max_length=50,
                             choices=States.choices(),
                             default=States.NJ)
    address_type = models.CharField(max_length=50,
                                    choices=AddressType.choices(),
                                    default=AddressType.H)
Esempio n. 27
0
class Client(models.Model):
    #locations
    IOP = 'IOP'
    Sullivan = 'Sullivan'
    Kiawah = 'Kiawah'
    Seabrook = 'Seabrook'
    MtPleasant = 'MtPleasant'
    NorthCharleston = 'NorthCharleston'
    WestAshley = 'WestAshley'
    JamesIsland = 'JamesIsland'
    GooseCreek = 'GooseCreek'
    Summerville = 'Summerville'
    Charleston = 'Charleston'
    Remote = 'Remote'
    OnVacationhere = 'On Vacation here'
    LOCATION = [
        (IOP, 'IOP'),
        (Sullivan, 'Sullivan'),
        (Kiawah, 'Kiawah'),
        (Seabrook, 'Seabrook'),
        (MtPleasant, 'MtPleasant'),
        (NorthCharleston, 'NorthCharleston'),
        (WestAshley, 'WestAshley'),
        (JamesIsland, 'JamesIsland'),
        (GooseCreek, 'GooseCreek'),
        (Summerville, 'Summerville'),
        (Charleston, 'Charleston'),
        (Remote, 'Remote'),
        (OnVacationhere, 'On Vacation here'),
    ]
    #Call times
    Morning = 'Morning'
    MidDay = 'MidDay'
    Evening = 'Evening'
    CALLTIMES = [
        (Morning, 'Morning'),
        (MidDay, 'MidDay'),
        (Evening, 'Evening'),
    ]

    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    email = models.EmailField()
    phone_number = PhoneField(blank=True, help_text='Contact phone number')
    call_time =  models.CharField(
        max_length=50,
        choices=CALLTIMES,
        default= Morning,
    )
    location =  models.CharField(
        max_length=50,
        choices=LOCATION,
        default= Remote,
    )
    address_street = models.CharField(max_length=255, null=True)
    zipcode = models.FloatField(null=True)
    created_date = models.DateField(auto_now=False, auto_now_add=True, null=True)

    def __str__(self):
        return self.last_name[:30]
Esempio n. 28
0
class Pacientes(models.Model):
    user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
    nombre = models.CharField(max_length=30)
    apellido_paterno = models.CharField(max_length=30)
    apellido_materno = models.CharField(max_length=30)
    nacimiento = models.DateField()
    edad = models.IntegerField()
    sexo = models.CharField(max_length=1)
    masa = models.DecimalField(decimal_places=2, max_digits=5)
    talla = models.DecimalField(decimal_places=2, max_digits=5)
    escolaridad = models.CharField(max_length=30)
    estado_civil = models.CharField(max_length=30)
    ocupacion = models.CharField(max_length=30)
    domicilio = models.CharField(max_length=200)
    telefono = PhoneField()
    email = models.EmailField(max_length=100)
    facultad = models.CharField(max_length=5, default='N')
    deporte = models.CharField(max_length=5, default='N')
    fecha_ingreso = models.DateField(default=now())
    fecha_modificacion = models.DateField(default=now())

    def save(self, *args, **kwargs):
        if not self.id:
            self.created = timezone.now()
        self.modified = timezone.now()
        return super(Pacientes, self).save(*args, **kwargs)

    def __str__(self):
        return self.user
Esempio n. 29
0
class UserDetail(models.Model):
    first_name = models.CharField(max_length=200, blank=False)
    middle_name = models.CharField(max_length=200, blank=True)
    last_name = models.CharField(max_length=200, blank=False)
    preferred_name = models.CharField(max_length=200, blank=True)
    phone_number = PhoneField(blank=True)
    email = models.EmailField(blank=True, null=True)
    linkedin = models.URLField(blank=True, null=True)
    github = models.URLField(blank=True, null=True)
    portfolio_website = models.URLField(blank=True, null=True)
    street_address = models.CharField(blank=True, max_length=200)
    city_address = models.CharField(
        blank=True,
        max_length=200,
    )
    state_address = models.CharField(
        blank=True,
        max_length=200,
    )
    zip_code = models.CharField(
        blank=True,
        max_length=200,
    )
    modified_date = models.DateField(auto_now=True, blank=True)
    created_date = models.DateField(auto_now_add=True, blank=True)

    class Meta:
        ordering = ['-modified_date']

    def __str__(self):
        return 'ID ' + str(
            self.id
        ) + ' - ' + self.first_name + ' ' + self.last_name + ' - date created: ' + str(
            self.created_date)
Esempio n. 30
0
class CustomUser(AbstractUser):

    COURSE_COORDINATOR = 1
    PROGRAM_COORDINATOR = 2
    TEACHER = 3
    STUDENT = 4

    ROLE_CHOICES = ((COURSE_COORDINATOR, 'Course coordintor'),
                    (PROGRAM_COORDINATOR, 'Program coordinator'),
                    (TEACHER, 'Teacher'), (STUDENT, 'Student'))

    first_name = models.CharField(_("first name"), max_length=150)
    last_name = models.CharField(_("last name"), max_length=150)
    username = None
    email = models.EmailField(_('email address'), unique=True)
    phone = PhoneField(_("phone"))
    role = models.PositiveSmallIntegerField(choices=ROLE_CHOICES,
                                            blank=True,
                                            null=True)

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

    objects = CustomUserManager()

    def __str__(self):
        return self.email