Ejemplo n.º 1
0
class CustomUser(AbstractUser):  #extending user model
    phone = models.BigIntegerField(null=True)
    name = models.CharField(max_length=100, null=True, blank=True)
    #admin (if belongs to native departments or not)
    admin_level = models.IntegerField(default=0)
    grp_leader = models.IntegerField(default=0)
    captain = models.IntegerField(default=0)
    coach = models.IntegerField(default=0)
    gender = models.CharField(max_length=10, null=True, blank=True)
    team = models.ForeignKey(Team, null=True, on_delete=models.CASCADE)
    sportid = models.CharField(
        max_length=40, default="0000000000000000000000000000000000000000")
    #confirmed1 = models.CharField(max_length=40, default="0000000000000000000000000000000000000000")
    #confirmed1=models.ManyToManyField(Sport)
    #0 will be 1 for those sports for which the participant has registered 2 for confirmed
    confirm1 = models.IntegerField(
        default=0)  #1 for confirmed 2 for documents 4 all done
    sport = models.ManyToManyField(Sport)
    docs = fields.FileField(upload_to="documents/", null=True, blank=True)
    docs2 = fields.FileField(upload_to="documents/", null=True, blank=True)
    deleted = models.IntegerField(default=0)
    pcramt = models.IntegerField(default=0)

    pay1 = models.IntegerField(
        default=0)  #1 for prereg, 2 for reg, 3 reg to prereg
    pay2 = models.IntegerField(default=0)
    pay3 = models.IntegerField(default=0)
    orderid1 = models.CharField(max_length=10, null=True, blank=True)
    orderid2 = models.CharField(max_length=10, null=True, blank=True)
    orderid3 = models.CharField(max_length=10, null=True, blank=True)

    def __str__(self):
        return self.username
Ejemplo n.º 2
0
class FileTesting(models.Model):
    # test static default
    field_1 = fields.FileField(upload_to='testing', dependencies=[
        FileDependency(suffix='foo', default="defaults/foo.txt",
                       processor=processors.BaseProcessor),
        FileDependency(attname='bar', default="defaults/bar.txt")
    ])
    # test default FieldFile
    field_2 = fields.FileField(upload_to='testing', dependencies=[
        FileDependency(default=_get_foo, processor=_file_to_lower)
    ])
    # test cleanup without dependencies
    field_3 = fields.FileField(upload_to='testing')
    # test no cleanup
    field_4 = fields.FileField(upload_to='testing', keep_orphans=True)
Ejemplo n.º 3
0
class Dokumen(models.Model):
    video = fields.FileField(upload_to=PathAndRename("serah_terima/dokumen/video/"))
    foto = fields.ImageField(upload_to=PathAndRename("serah_terima/dokumen/foto/"))
    salinan_laporan = fields.FileField(upload_to=PathAndRename("serah_terima/dokumen/salinan_laporan/"))
    admin_kelola = models.ForeignKey(AdminKelola,on_delete=models.CASCADE)
    status_pengelolaan_text = models.CharField(max_length=100, blank=True)
    pola_pengelolaan_text = models.CharField(max_length=100, blank=True)
    regulasi_pemanfaatan_psu_text = models.CharField(max_length=100,blank=True)
    status_pengelolaan = fields.FileField(upload_to=PathAndRename("serah_terima/dokumen/status_pengelolaan/"),blank=True, null=True)
    pola_pengelolaan = fields.FileField(upload_to=PathAndRename("serah_terima/dokumen/pola_pengelolaan/"),blank=True, null=True)
    regulasi_pemanfaatan_psu = fields.FileField(upload_to=PathAndRename("serah_terima/dokumen/regulasi_pemanfaatan_psu/"),blank=True, null=True)

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    class Meta:
        db_table= "kelola_serahterima"
Ejemplo n.º 4
0
class PageFile(TimestampAble, AbstractPage):
    name = models.CharField(max_length=255, verbose_name='Name')
    file = fields.FileField(upload_to='files/%Y/%m/%d', verbose_name='File')

    class Meta:
        verbose_name = 'File'
        verbose_name_plural = 'Files'

    def __str__(self):
        return self.name
Ejemplo n.º 5
0
class Video(Media):

    video = fields.FileField(_('Video'),
                             upload_to='videos/',
                             validators=[validators.video_extension_validator],
                             help_text=_('Videos for the game. ' +
                                         general_validators.HELP_TEXT_VIDEO))

    def __str__(self):
        if self.video:
            return self.__config_str__('video')

        else:
            return 'Video has been deleted!'
Ejemplo n.º 6
0
class Course(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    name = models.CharField(max_length=100)
    slides = models.URLField(null=True, blank=False)
    video = fields.FileField(null=True)

    kw_before = models.TextField(max_length=300, blank=True)
    kw_after = models.TextField(max_length=300, blank=True)

    approved = models.BooleanField(default=False)
    completed = models.BooleanField(default=False)

    def __str__(self):
        return str(self.name)
Ejemplo n.º 7
0
class Soundtrack(Media):

    soundtrack = fields.FileField(
        _('Soundtrack'),
        upload_to='sounds/',
        validators=[validators.soundtrack_extension_validator],
        help_text=_('Soundtracks for the game. ' +
                    general_validators.HELP_TEXT_SOUNDTRACK))

    def __str__(self):
        if self.soundtrack:
            return self.__config_str__('soundtrack')

        else:
            return 'Soundtrack has been deleted!'
Ejemplo n.º 8
0
class VideoTesting(models.Model):

    video_1 = fields.FileField(
        upload_to=UploadTo(name='video_1'), dependencies=[
            # testing html tag setter
            Dependency(suffix='html_tag', default=video_tag_processor),
            # testing conversion to webm
            FileDependency(suffix='webm', async_=True, processor=processors.FFMPEGProcessor(
                format='webm', vcodec='libvpx', vbitrate='128k', maxrate='128k',
                bufsize='256k', width='trunc(oh*a/2)*2', height=240,
                threads=4, acodec='libvorbis', abitrate='96k')),
            # testing conversion to mp4
            FileDependency(suffix='mp4', async_=True, processor=processors.FFMPEGProcessor(
                format='mp4', vcodec='libx264', vbitrate='128k',
                maxrate='128k', bufsize='256k', width='trunc(oh*a/2)*2',
                height=240, threads=0, acodec='libmp3lame', abitrate='96k')),
        ])

    def has_upload_permission(self, user, field_name=None):
        is_auth = user.is_authenticated if django.VERSION >= (1, 10) else user.is_authenticated()
        return (field_name == 'video_1' and is_auth and user.username == 'test_user')
Ejemplo n.º 9
0
class Lecture(models.Model):
    course = models.ForeignKey(Course, on_delete=models.CASCADE)
    name = models.CharField(max_length=100)

    video = fields.FileField(null=True)
    txt = models.TextField(max_length=300, blank=True)

    NUMBER = (
        ('0', 'Digest'),
        ('1', 'N1'),
        ('2', 'N2'),
        ('3', 'N3'),
        ('4', 'N4'),
        ('5', 'N5'),
    )
    number = models.CharField(
        max_length=1,
        choices=NUMBER,
        default='0',
    )
    def __str__(self):

        return str(self.name)
Ejemplo n.º 10
0
class VideoTesting(models.Model):

    video_1 = fields.FileField(
        upload_to=UploadTo(name='video_1'),
        dependencies=[
            # testing html tag setter
            Dependency(suffix='html_tag', default=video_tag_processor),
            # testing conversion to webm
            FileDependency(suffix='webm',
                           async=True,
                           processor=processors.FFMPEGProcessor(
                               format='webm',
                               vcodec='libvpx',
                               vbitrate='128k',
                               maxrate='128k',
                               bufsize='256k',
                               width='trunc(oh*a/2)*2',
                               height=240,
                               threads=4,
                               acodec='libvorbis',
                               abitrate='96k')),
            # testing conversion to mp4
            FileDependency(suffix='mp4',
                           async=True,
                           processor=processors.FFMPEGProcessor(
                               format='mp4',
                               vcodec='libx264',
                               vbitrate='128k',
                               maxrate='128k',
                               bufsize='256k',
                               width='trunc(oh*a/2)*2',
                               height=240,
                               threads=0,
                               acodec='libmp3lame',
                               abitrate='96k')),
        ])