Exemple #1
0
class ArticlesMaster(models.Model):
    Category = (
        (u'', u'Select'),
        (u'Dart', u'Dart'),
        (u'Django', u'Django'),
        (u'Flutter', u'Flutter'),
        (u'Python', u'Python'),
        (u'Linux', u'Linux'),
    )
    category = models.CharField(max_length=25,
                                choices=Category,
                                verbose_name=_("Category"))
    description = models.CharField(max_length=250,
                                   verbose_name=_("Description"))
    created_by = CreatingUserField(related_name="ArticlesMasterCreatedBy")
    created_date = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_by = LastUserField(related_name="ArticlesMasterUpdatedBy")
    updated_date = models.DateTimeField(auto_now_add=False, auto_now=True)

    @property
    def short_description(self):
        return truncatechars(self.description, 50)

    def __str__(self):
        return self.category

    class Meta:
        verbose_name = "ArticlesMaster"
        verbose_name_plural = "ArticlesMaster"
        db_table = 'articles_master'
        ordering = ('category', )
        indexes = [models.Index(fields=['category'])]
Exemple #2
0
class InvalidCertificate(CertificateBase):
    invalid = True
    certificate_number = models.CharField(_('certificate number'),
                                          max_length=50)
    created_by = models.ForeignKey(User)
    invalidated_by = CreatingUserField(related_name="invalidated_certificate")
    invalidated_by_date_time = models.DateTimeField(auto_now_add=True)
    invalidated_reason = models.TextField()
class ProductCategory(models.Model):
    created_by = CreatingUserField(related_name="created_categories")
    modified_by = LastUserField(related_name="modified_categories")
    name = models.CharField(max_length=150, primary_key=True)
    description = models.TextField()

    audit_log = AuditLog()

    def __unicode__(self):
        return self.name
Exemple #4
0
class AuthStampedModel(Model):
    """
    An abstract base class model that provides auth and session information
    fields.
    """
    created_by = CreatingUserField(verbose_name=_("created by"), related_name="created_%(app_label)s_%(class)s_set")
    created_with_session_key = CreatingSessionKeyField(_("created with session key"))
    modified_by = LastUserField(verbose_name=_("modified by"), related_name="modified_%(app_label)s_%(class)s_set")
    modified_with_session_key = LastSessionKeyField(_("modified with session key"))

    class Meta:
        abstract = True
Exemple #5
0
class Certificate(CertificateBase):
    certificate_number = models.CharField(_('certificate number'),
                                          max_length=50,
                                          unique=True)
    created_by = CreatingUserField(related_name="created_certificate")

    def save(self, *args, **kwargs):
        if not self.verification_code:
            uuid = uuid4()
            while Certificate.objects.filter(verification_code=uuid):
                uuid = uuid4()

            self.verification_code = Baco.to_62(uuid.hex, base16)
        super(Certificate, self).save(*args, **kwargs)
class Videos(models.Model):
    class Quality(models.IntegerChoices):
        DIAMOND = 1
        SPADE = 2
        HEART = 3
        CLUB = 4

    video_category = models.ForeignKey(VideoMaster,
                                       on_delete=models.CASCADE,
                                       verbose_name=_("Article Category"))
    title = models.CharField(max_length=200, verbose_name=_("Title"))
    video_url = models.URLField(max_length=200,
                                blank=True,
                                null=True,
                                verbose_name=_("Video URL"))
    video_playlist_id = models.CharField(max_length=50,
                                         blank=True,
                                         null=True,
                                         verbose_name=_("Video Play list ID"))
    description = models.TextField(blank=True,
                                   null=True,
                                   verbose_name=_("Description"))
    tags = models.CharField(max_length=250,
                            blank=True,
                            null=True,
                            verbose_name=_("Tags"))
    title_images = models.ImageField(upload_to='Article/Images/',
                                     verbose_name=_("Title Images"))
    quality = models.IntegerField(choices=Quality.choices,
                                  blank=True,
                                  null=True,
                                  verbose_name=_("Quality"))
    created_by = CreatingUserField(related_name="VideosCreatedBy")
    created_date = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_by = LastUserField(related_name="VideosUpdatedBy")
    updated_date = models.DateTimeField(auto_now_add=False, auto_now=True)

    @property
    def short_description(self):
        return truncatechars(self.description, 50)

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = "Videos"
        verbose_name_plural = "Videos"
        db_table = 'videos'
        ordering = ('title', )
        indexes = [models.Index(fields=['title'])]
Exemple #7
0
class Article(models.Model):
    class Quality(models.IntegerChoices):
        DIAMOND = 1
        SPADE = 2
        HEART = 3
        CLUB = 4

    article_category = models.ForeignKey(ArticlesMaster,
                                         on_delete=models.CASCADE,
                                         verbose_name=_("Article Category"))
    title = models.CharField(max_length=200, verbose_name=_("Title"))
    description = RichTextField(verbose_name=_("Description"))
    tags = models.CharField(max_length=250,
                            blank=True,
                            null=True,
                            verbose_name=_("Tags"))
    title_images = models.ImageField(upload_to='Article/Images/',
                                     verbose_name=_("Title Images"))
    external_links = models.URLField(max_length=200,
                                     blank=True,
                                     null=True,
                                     verbose_name=_("External Links"))
    avg_read_time = models.CharField(max_length=50,
                                     blank=True,
                                     null=True,
                                     verbose_name=_("Average read time"))
    quality = models.IntegerField(choices=Quality.choices,
                                  blank=True,
                                  null=True,
                                  verbose_name=_("Quality"))
    created_by = CreatingUserField(related_name="ArticleCreatedBy")
    created_date = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_by = LastUserField(related_name="ArticleUpdatedBy")
    updated_date = models.DateTimeField(auto_now_add=False, auto_now=True)

    @property
    def short_description(self):
        return truncatechars(self.description, 50)

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = "Article"
        verbose_name_plural = "Article"
        db_table = 'article'
        ordering = ('title', )
        indexes = [models.Index(fields=['title'])]
class AuthTimeStampedModel(Model):
    """
	An abstract base class model that provides auth and session information
	fields.
	"""
    created_by = CreatingUserField(
        verbose_name=_("created by"),
        related_name="created_%(app_label)s_%(class)s_set")
    created_at = CreatingDateTimeField(_("created at"))
    modified_by = LastUserField(
        verbose_name=_("modified by"),
        related_name="modified_%(app_label)s_%(class)s_set")
    modified_at = LastDateTimeField(_("modified at"))

    class Meta:
        abstract = True
Exemple #9
0
class CityMaster(models.Model):
    state = models.ForeignKey(StateMaster,
                              on_delete=models.CASCADE,
                              verbose_name=_("State Name"))
    city_name = models.CharField(max_length=100, verbose_name=_("City Name"))
    created_by = CreatingUserField(related_name="CityMasterCreatedBy")
    created_date = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_by = LastUserField(related_name="CityMasterUpdatedBy")
    updated_date = models.DateTimeField(auto_now_add=False, auto_now=True)

    def __str__(self):
        return self.city_name

    class Meta:
        verbose_name = "City Master"
        verbose_name_plural = "City Master"
        db_table = 'city_master'
        ordering = ('city_name', )
        indexes = [models.Index(fields=['city_name'])]
Exemple #10
0
class StateMaster(models.Model):
    COUNTRY_CHOICES = ((u'1', u'INDIA'), )
    state_name = models.CharField(max_length=100, verbose_name=_("State Name"))
    country_id = models.CharField(max_length=1,
                                  default=1,
                                  choices=COUNTRY_CHOICES,
                                  verbose_name=_("Country Name"))
    created_by = CreatingUserField(related_name="StateMasterCreatedBy")
    created_date = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_by = LastUserField(related_name="StateMasterUpdatedBy")
    updated_date = models.DateTimeField(auto_now_add=False, auto_now=True)

    def __str__(self):
        return self.state_name

    class Meta:
        verbose_name = "State Master"
        verbose_name_plural = "State Master"
        db_table = 'state_master'
        ordering = ('state_name', )
        indexes = [models.Index(fields=['state_name'])]
Exemple #11
0
class Sample(models.Model):
    barcode = models.ForeignKey(Barcode)
    project = models.ForeignKey(Project)
    customer = models.ForeignKey(Customer)
    species = models.ForeignKey(Species)
    status = models.ForeignKey(Status)
    storage = models.ForeignKey(Storage)
    sampletype = models.ForeignKey(Sampletype, default=1)
    plate_position = models.CharField(max_length=3, blank=False, null=False)
    customer_plate = models.CharField(max_length=50, blank=True)
    customer_sample = models.CharField(max_length=255, blank=True)
    concentration = models.CharField(max_length=10, blank=True, null=True)
    volume = models.CharField(max_length=10, blank=True, null=True)
    comment = models.CharField(max_length=255, blank=True, default='')
    updated = models.DateTimeField('Updated date', editable=False, default=datetime.datetime.now)
    created = models.DateTimeField('Created date', editable=False, default=datetime.datetime.now)
    created_by = CreatingUserField(related_name = "created_categories")
    created_with_session_key = CreatingSessionKeyField()
    modified_by = LastUserField() 
    modified_session = LastSessionKeyField()

    class Meta:
        unique_together = ('barcode', 'plate_position',)

    def save(self, *args, **kwargs):
        ''' On save, update timestamps '''
        if not self.id:
            self.created = datetime.datetime.today()
        self.updated = datetime.datetime.today()
        return super(Sample, self).save(*args, **kwargs)

    def save_model(self, request, obj, form, change):
        obj.user = request.user
        obj.save()

    def __str__(self):
        return self.plate_position
Exemple #12
0
class VideoMaster(models.Model):
    Video = (
        (u'', u'Select'),
        (u'Flutter', u'Flutter'),
        (u'Django', u'Django'),
        (u'Python', u'Python'),
        (u'Dart', u'Dart'),
    )
    video_category = models.CharField(max_length=25,
                                      choices=Video,
                                      verbose_name=_("Video Category"))
    description = models.CharField(max_length=250,
                                   verbose_name=_("Description"))
    created_by = CreatingUserField(related_name="VideoMasterCreatedBy")
    created_date = models.DateTimeField(auto_now_add=True, auto_now=False)
    updated_by = LastUserField(related_name="VideoMasterUpdatedBy")
    updated_date = models.DateTimeField(auto_now_add=False, auto_now=True)

    @property
    def short_description(self):
        return truncatechars(self.description, 50)

    def __str__(self):
        return self.video_category
Exemple #13
0
class Postulante(models.Model):
    SEXO_CHOICES = (
        ('M', 'Masculino'),
        ('F', 'Femenino'),
    )
    ESCOLARIDAD_CHOICES = (
        ('B', 'Básica'),
        ('M', 'Media'),
    )
    ESTADO_CIVIL_CHOICES = (
        ('S', 'Soltero'),
        ('C', 'Casado'),
        ('SE', 'Separado'),
        ('V', 'Viudo'),
    )
    AFP_CHOICES = (
        ('PR', 'Provida'),
        ('HA', 'Habitat'),
        ('CA', 'Capital'),
        ('MO', 'Modelo'),
        ('CU', 'Cuprum'),
        ('PV', 'Planvital'),
        ('IP', 'IPS'),
    )
    SISTEMA_DE_SALUD_CHOICES = (
        ('F', 'FONASA'),
        ('I', 'ISAPRE'),
    )
    fecha = models.DateTimeField('ingreso', null=True,
                                 blank=True)  #fecha y hora entrevista
    medio = models.CharField(max_length=140, null=True, blank=True)
    medio1 = models.ForeignKey(Medio,
                               verbose_name='medio',
                               null=True,
                               blank=True,
                               related_name='postulantes_ingresados')
    #información personal
    rut = models.CharField('RUT',
                           max_length=20,
                           null=True,
                           blank=True,
                           help_text='ej: 15774223-2')
    nombres = models.CharField(max_length=140)
    apellidos = models.CharField(max_length=140)
    fecha_de_nacimiento = models.DateField(null=True, blank=True)
    nacionalidad = models.CharField(max_length=140,
                                    default="Chilena",
                                    null=True,
                                    blank=True)
    sexo = models.CharField(max_length=1,
                            null=True,
                            blank=True,
                            choices=SEXO_CHOICES)
    escolaridad = models.CharField(max_length=1,
                                   null=True,
                                   blank=True,
                                   choices=ESCOLARIDAD_CHOICES)
    estado_civil = models.CharField(max_length=2,
                                    null=True,
                                    blank=True,
                                    choices=ESTADO_CIVIL_CHOICES)
    hijos = models.PositiveIntegerField(null=True, blank=True)
    jubilado = models.BooleanField(default=False)
    afp = models.CharField('AFP',
                           max_length=2,
                           null=True,
                           blank=True,
                           choices=AFP_CHOICES)
    sistema_de_salud = models.CharField(max_length=1,
                                        choices=SISTEMA_DE_SALUD_CHOICES,
                                        null=True,
                                        blank=True)
    #informacion de contacto
    domicilio = models.CharField(max_length=140, null=True, blank=True)
    comuna = models.CharField(max_length=140, null=True, blank=True)
    ubicacion = PlainLocationField(verbose_name='ubicación',
                                   based_fields=[domicilio, comuna],
                                   zoom=15,
                                   null=True,
                                   blank=True)

    telefono = models.CharField('teléfono',
                                max_length=140,
                                null=True,
                                blank=True)
    telefono_emergencia = models.CharField('teléfono emergencia',
                                           max_length=140,
                                           null=True,
                                           blank=True)
    email = models.EmailField(null=True, blank=True)
    #otros
    os10 = models.BooleanField('OS-10', default=False)
    vencimiento = models.DateField(null=True, blank=True)
    cargo = models.CharField(max_length=140, null=True, blank=True)
    industrial = models.BooleanField('sólo industrial', default=False)
    retail = models.BooleanField(default=False)
    ha_sido_condenado_o_detenido = models.BooleanField('anotaciones',
                                                       default=False)
    motivo = models.CharField(max_length=140, null=True, blank=True)
    observaciones = models.TextField(
        null=True,
        blank=True,
        help_text="indicar la razón por la cual no fue contratado")
    contratado = models.BooleanField(default=False)
    visto_bueno = models.BooleanField(default=False)
    instalacion = models.ForeignKey(Instalacion,
                                    verbose_name='instalación',
                                    null=True,
                                    blank=True)
    fecha_contratacion = models.DateField('fecha contratación',
                                          null=True,
                                          blank=True)

    reclutador = models.CharField(max_length=140, null=True, blank=True)
    creado_por = CreatingUserField(verbose_name='ingresado por')

    def __unicode__(self):
        return "%s %s" % (self.nombres, self.apellidos)

    class Meta:
        ordering = ('-fecha', )