Beispiel #1
0
class Migration(migrations.Migration):

    dependencies = [
        ('principal', '0006_institucionslider'),
    ]

    operations = [
        migrations.CreateModel(
            name='Slider',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('foto', models.ImageField(upload_to='img/')),
                ('titulo', models.CharField(max_length=50)),
            ],
        ),
        migrations.RemoveField(
            model_name='institucionslider',
            name='titulo',
        ),
        migrations.AlterField(
            model_name='institucionslider',
            name='foto',
            field=models.ImageField(
                upload_to=blogger.apps.principal.models.image_directory_path),
        ),
    ]
Beispiel #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Institucion',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('nombre_institucion', models.CharField(max_length=50)),
                ('slug_institucion',
                 models.SlugField(blank=True,
                                  max_length=80,
                                  null=True,
                                  unique=True)),
                ('logo_institucion',
                 models.ImageField(upload_to=blogger.apps.principal.models.
                                   image_directory_path)),
                ('descripcion_institucion', models.CharField(max_length=2000)),
                ('image_back_institucion',
                 models.ImageField(upload_to=blogger.apps.principal.models.
                                   image_directory_path)),
            ],
        ),
    ]
Beispiel #3
0
class Multimedia(models.Model):
    institucion = models.ForeignKey(Institucion)
    nombre_multimedia = models.CharField(max_length=45)
    slug_multimedia = models.CharField(max_length=45, blank=True, null=True)
    tipo_multimedia = models.CharField(max_length=1, choices=CHOICE_MULTIMEDIA)
    image_multimedia = models.ImageField(upload_to=image_directory_path,
                                         default='img/none.jpg')
    video_multimedia = models.CharField(max_length=255, blank=True, null=True)

    def __str__(self):
        return self.nombre_multimedia

    def __unicode__(self):
        return self.nombre_multimedia

    def img_resource(self):
        if self.tipo_multimedia == 'v':
            resource = 'https://img.youtube.com/vi/' + self.video_multimedia.split(
                '=')[1] + '/0.jpg'
        else:
            resource = '/static/' + self.image_multimedia.url
        return resource

    def embed_code(self):
        return self.video_multimedia.split('=')[1]

    def url_resource(self):
        return '/static/' + self.image_multimedia.url if self.tipo_multimedia == 'f' else self.video_multimedia

    def save(self, *args, **kwargs):
        self.slug_multimedia = slugify(self.nombre_multimedia)
        super(Multimedia, self).save()
Beispiel #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('principal', '0005_auto_20170725_1907'),
    ]

    operations = [
        migrations.CreateModel(
            name='Institucionslider',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('titulo', models.CharField(max_length=80)),
                ('foto', models.ImageField(upload_to=b'', verbose_name=blogger.apps.principal.models.image_directory_path)),
                ('institucion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='principal.Institucion')),
            ],
        ),
    ]
Beispiel #5
0
class Entrada(models.Model):
    institucion = models.ForeignKey(Institucion)
    usuario = models.ForeignKey(User)
    titulo_entrada = models.CharField(max_length=50)
    fecha_entrada = models.DateField(auto_now=True)
    fecha_actualizacion_entrada = models.DateField(blank=True, null=True)
    slug_entrada = models.SlugField(max_length=80,
                                    unique=True,
                                    blank=True,
                                    null=True)
    descripcion_entrada = models.CharField(max_length=2000)
    imagen_portada = models.ImageField(upload_to=image_directory_path,
                                       default='img/none.jpg')
    numero_visitas = models.IntegerField(default=0)

    def __unicode__(self):
        return self.titulo_entrada

    def __str__(self):
        return self.titulo_entrada

    def save(self, *args, **kwargs):
        self.slug_entrada = slugify(self.titulo_entrada)
        super(Entrada, self).save()