Skip to content

Commit

Permalink
Add audio plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tdelatorre committed Jul 19, 2018
1 parent 98db139 commit d671fb8
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/mister_cobol_web/admin.py
Expand Up @@ -12,3 +12,4 @@
admin.site.register(Tour, SingletonModelAdmin)
admin.site.register(Event)
admin.site.register(Contact, SingletonModelAdmin)
admin.site.register(Audio)
28 changes: 28 additions & 0 deletions src/mister_cobol_web/migrations/0019_audio.py
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('mister_cobol_web', '0018_contact_instagram'),
]

operations = [
migrations.CreateModel(
name='Audio',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('title', models.CharField(verbose_name='Title', max_length=50)),
('audio_file', models.FileField(verbose_name='Audio mp3', upload_to='files', default=None)),
],
options={
'ordering': ['title'],
'verbose_name': 'Audio',
'verbose_name_plural': 'Audio',
},
bases=(models.Model,),
),
]
23 changes: 23 additions & 0 deletions src/mister_cobol_web/models.py
Expand Up @@ -230,3 +230,26 @@ def __unicode__(self):

def __str__(self):
return u'{}'.format(self.title)


class Audio(models.Model):
title = models.CharField(
max_length=50, blank=False, null=False,
verbose_name=_(u'Title')
)
audio_file = models.FileField(
null=False, blank=False,
default=None, upload_to='files',
verbose_name=_(u'Audio mp3')
)

class Meta:
verbose_name = _(u'Audio')
verbose_name_plural = _(u'Audio')
ordering = ['title']

def __unicode__(self):
return u'{}'.format(self.title)

def __str__(self):
return u'{}'.format(self.title)
3 changes: 2 additions & 1 deletion src/mister_cobol_web/static/css/style.css
Expand Up @@ -563,8 +563,9 @@ body {
font-family: 'Gotham', sans-serif;
color: #efefef;
line-height: 1.5;
background: url("../images/bg-res.jpg") 50% 0 repeat fixed;
background: url("../images/bg-res.jpg") 50% 0 fixed;
background-position: center top;
background-repeat: repeat;
}

p {
Expand Down
15 changes: 15 additions & 0 deletions src/mister_cobol_web/templates/index.html
Expand Up @@ -59,6 +59,7 @@
<li class="main-logo"><a class="smooth" href="#inicio"><a href="{{ request.get_full_path }}"><img src="/static/images/main-logo.png" alt="Mister Cobol" title="Mister Cobol" border="0"></a></a></li>
<li><a class="smooth" href="#sobre-nosotros">{% trans 'SOBRE NOSOTROS' %}</a></li>
<li><a class="smooth" href="#tour">{% trans 'TOUR' %}</a></li>
<li><a class="smooth" href="#musica">{% trans 'MÚSICA' %}</a></li>
<li><a class="smooth" href="#fotos">{% trans 'FOTOS' %}</a></li>
<li><a class="smooth" href="#videos">{% trans 'VÍDEOS' %}</a></li>
<li><a class="smooth" href="#contacto">{% trans 'CONTACTO' %}</a></li>
Expand All @@ -69,6 +70,7 @@
<ul class="nav-res">
<li><a class="smooth" href="#sobre-nosotros">{% trans 'SOBRE NOSOTROS' %}</a></li>
<li><a class="smooth" href="#tour">{% trans 'TOUR' %}</a></li>
<li><a class="smooth" href="#musica">{% trans 'MÚSICA' %}</a></li>
<li><a class="smooth" href="#fotos">{% trans 'FOTOS' %}</a></li>
<li><a class="smooth" href="#videos">{% trans 'VÍDEOS' %}</a></li>
<li><a class="smooth" href="#contacto">{% trans 'CONTACTO' %}</a></li>
Expand Down Expand Up @@ -145,6 +147,18 @@ <h2 class="row-title">{% trans 'TOUR' %}</h2>
</div>
</div>

<div class="row fullview bg-black dashed" id="musica">
<div class="row-inside content">
<h2 class="row-title">{% trans 'MÚSICA' %}</h2>
{% for audio in audios %}
<div class="column-center">
<p>{{ audio.title }}</p>
<audio src="media/{{ audio.audio_file }}" controls></audio>
</div><br>
{% endfor %}
</div>
</div>

<div class="row fullview bg-darkgray dashed" id="fotos">
<div class="row-inside content">
<h2 class="row-title">{% trans 'GALERÍA DE FOTOS' %}</h2>
Expand Down Expand Up @@ -241,6 +255,7 @@ <h2 class="row-title">{% trans 'CONTACTA CON NOSOTROS' %}</h2>
});
});
</script>

</body>

</html>
2 changes: 2 additions & 0 deletions src/mister_cobol_web/views.py
Expand Up @@ -18,13 +18,15 @@ class LandingView(TemplateView):
def get_context_data(self, **kwargs):
members = Member.objects.all()
events = Event.objects.all()
audios = Audio.objects.all()
images = Image.objects.filter(for_gallery=True)
videos = Video.objects.all()

context = super().get_context_data(**kwargs)
context.update({
'members': members,
'events': events,
'audios': audios,
'images': images,
'videos': videos,
'form': ContactForm(),
Expand Down

0 comments on commit d671fb8

Please sign in to comment.