Permalink
Browse files

Merge pull request #101 from RedPanal/django_update

Update to Django 1.9
  • Loading branch information...
spiccinini committed Dec 3, 2016
2 parents 18185e1 + 00c8011 commit 66c9e75b9c5dcab11f637059fdfa64798c0ac44a
Showing with 505 additions and 2,152 deletions.
  1. +4 −1 .gitignore
  2. +1 −2 README.md
  3. 0 redpanal/{redpanal → }/audio/__init__.py
  4. +10 −0 redpanal/audio/apps.py
  5. +3 −2 redpanal/{redpanal → }/audio/forms.py
  6. +50 −0 redpanal/audio/migrations/0001_initial.py
  7. +26 −0 redpanal/audio/migrations/0002_auto_20161203_0121.py
  8. 0 redpanal/{redpanal → }/audio/migrations/__init__.py
  9. +3 −4 redpanal/{redpanal → }/audio/models.py
  10. 0 redpanal/{redpanal → }/audio/search_indexes.py
  11. 0 redpanal/{redpanal → }/audio/signals.py
  12. 0 redpanal/{redpanal → }/audio/templates/audio/audio_confirm_delete.html
  13. +6 −7 redpanal/{redpanal → }/audio/templates/audio/audio_detail.html
  14. +0 −1 redpanal/{redpanal → }/audio/templates/audio/audio_form.html
  15. 0 redpanal/{redpanal → }/audio/templates/audio/audio_object.html
  16. +0 −1 redpanal/{redpanal → }/audio/templates/audio/audio_teaser.html
  17. +1 −1 redpanal/{redpanal → }/audio/templates/audio/audios_list.html
  18. 0 redpanal/{redpanal → }/audio/templates/search/indexes/audio/audio_text.txt
  19. BIN redpanal/{redpanal → }/audio/test_data/tone.flac
  20. BIN redpanal/{redpanal → }/audio/test_data/tone.mp3
  21. BIN redpanal/{redpanal → }/audio/test_data/tone.ogg
  22. +3 −3 redpanal/{redpanal → }/audio/tests.py
  23. +14 −0 redpanal/audio/urls.py
  24. +2 −2 redpanal/{redpanal → }/audio/views.py
  25. +9 −7 redpanal/{redpanal → }/audio/waveform.py
  26. 0 redpanal/{redpanal → }/core/__init__.py
  27. 0 redpanal/{redpanal → }/core/forms.py
  28. 0 redpanal/{redpanal → }/core/licenses.py
  29. 0 redpanal/{redpanal → }/core/migrations/__init__.py
  30. 0 redpanal/{redpanal → }/core/models.py
  31. +1 −2 redpanal/{redpanal → }/core/templates/core/hashtaged_list.html
  32. 0 redpanal/{redpanal → }/core/templates/core/hashtaged_menu.html
  33. 0 redpanal/{redpanal → }/core/templates/core/hashtags_block.html
  34. +1 −1 redpanal/{redpanal → }/core/templates/core/mixed_list.html
  35. +3 −19 redpanal/{redpanal → }/core/tests.py
  36. +9 −0 redpanal/core/urls.py
  37. +9 −9 redpanal/{redpanal → }/core/views.py
  38. +15 −3 redpanal/manage.py
  39. 0 redpanal/{redpanal/social → project}/__init__.py
  40. +10 −0 redpanal/project/apps.py
  41. +1 −1 redpanal/{redpanal → }/project/forms.py
  42. +45 −0 redpanal/project/migrations/0001_initial.py
  43. 0 redpanal/{redpanal/project → project/migrations}/__init__.py
  44. +3 −4 redpanal/{redpanal → }/project/models.py
  45. 0 redpanal/{redpanal → }/project/search_indexes.py
  46. 0 redpanal/{redpanal → }/project/templates/project/project_confirm_delete.html
  47. +0 −1 redpanal/{redpanal → }/project/templates/project/project_create_version.html
  48. +2 −3 redpanal/{redpanal → }/project/templates/project/project_detail.html
  49. +0 −1 redpanal/{redpanal → }/project/templates/project/project_form.html
  50. 0 redpanal/{redpanal → }/project/templates/project/project_list.html
  51. +0 −1 redpanal/{redpanal → }/project/templates/project/project_object.html
  52. 0 redpanal/{redpanal → }/project/templates/project/project_teaser.html
  53. +1 −1 redpanal/{redpanal → }/project/templates/project/projects_list.html
  54. 0 redpanal/{redpanal → }/project/templates/search/indexes/project/project_text.txt
  55. +2 −2 redpanal/{redpanal → }/project/tests.py
  56. +5 −5 redpanal/{redpanal → }/project/urls.py
  57. 0 redpanal/{redpanal → }/project/views.py
  58. +0 −103 redpanal/redpanal/audio/migrations/0001_initial.py
  59. +0 −98 redpanal/redpanal/audio/migrations/0002_auto__add_field_audio_created_at.py
  60. +0 −126 ...l/audio/migrations/0003_auto__add_field_audio_channels__add_field_audio_blocksize__add_field_a.py
  61. +0 −73 redpanal/redpanal/audio/migrations/0004_auto__del_unique_audio_name.py
  62. +0 −76 redpanal/redpanal/audio/migrations/0005_auto__add_field_audio_license.py
  63. +0 −95 ...l/audio/migrations/0006_auto__add_field_audio_genre__add_field_audio_use_type__add_field_audio.py
  64. +0 −14 redpanal/redpanal/audio/urls.py
  65. +29 −35 redpanal/redpanal/common_settings.py
  66. +0 −125 redpanal/redpanal/core/migrations/0001_initial.py
  67. +0 −109 redpanal/redpanal/core/migrations/0002_auto__add_field_project_created_at.py
  68. +0 −45 redpanal/redpanal/core/migrations/0003_auto__del_project.py
  69. +0 −7 redpanal/redpanal/core/urls.py
  70. +0 −132 redpanal/redpanal/project/migrations/0001_initial.py
  71. +0 −111 redpanal/redpanal/project/migrations/0002_auto__del_unique_project_name.py
  72. +0 −87 redpanal/redpanal/project/migrations/0003_auto__add_field_project_image.py
  73. +0 −122 redpanal/redpanal/project/migrations/0004_target_to_action_object.py
  74. +0 −1 redpanal/redpanal/settings.py
  75. +0 −116 redpanal/redpanal/social/migrations/0001_initial.py
  76. +0 −99 redpanal/redpanal/social/migrations/0002_auto__add_field_message__msg_html_cache.py
  77. +0 −102 redpanal/redpanal/social/migrations/0003_migrate_action_verbs.py
  78. +0 −19 redpanal/redpanal/social/urls.py
  79. +18 −19 redpanal/redpanal/static/css/redpanal.css
  80. +0 −1 redpanal/redpanal/static/js/jquery.min.js
  81. +0 −1 redpanal/redpanal/templates/account/login.html
  82. +0 −1 redpanal/redpanal/templates/account/logout.html
  83. +0 −1 redpanal/redpanal/templates/account/signup.html
  84. +1 −1 redpanal/redpanal/templates/all_activities.html
  85. +1 −1 redpanal/redpanal/templates/discover-items-menu.html
  86. +2 −2 redpanal/redpanal/templates/index.html
  87. +16 −14 redpanal/redpanal/urls.py
  88. +0 −72 redpanal/redpanal/users/migrations/0001_initial.py
  89. +0 −84 ...l/users/migrations/0002_auto__add_field_userprofile_realname__add_field_userprofile_website__c.py
  90. +0 −77 redpanal/redpanal/users/migrations/0003_auto__add_defaultfolloweduser.py
  91. 0 redpanal/redpanal/users/migrations/__init__.py
  92. +0 −16 redpanal/redpanal/users/urls.py
  93. +7 −23 redpanal/redpanal/wsgi.py
  94. 0 redpanal/{redpanal/social/templatetags → social}/__init__.py
  95. +10 −0 redpanal/social/apps.py
  96. 0 redpanal/{redpanal → }/social/forms.py
  97. +39 −0 redpanal/social/migrations/0001_initial.py
  98. 0 redpanal/{redpanal/project → social}/migrations/__init__.py
  99. +7 −12 redpanal/{redpanal → }/social/models.py
  100. 0 redpanal/{redpanal → }/social/templates/activity/actor.html
  101. +1 −1 redpanal/{redpanal → }/social/templates/social/action_audio_created_teaser.html
  102. +1 −1 redpanal/{redpanal → }/social/templates/social/action_commented_teaser.html
  103. +1 −1 redpanal/{redpanal → }/social/templates/social/action_project_created_teaser.html
  104. 0 redpanal/{redpanal → }/social/templates/social/action_teaser.html
  105. +1 −1 redpanal/{redpanal → }/social/templates/social/actions_list.html
  106. +1 −1 redpanal/{redpanal → }/social/templates/social/follow_button.html
  107. +1 −1 redpanal/{redpanal → }/social/templates/social/followers.html
  108. +1 −1 redpanal/{redpanal → }/social/templates/social/following.html
  109. 0 redpanal/{redpanal → }/social/templates/social/message_form.html
  110. 0 redpanal/{redpanal → }/social/templates/social/message_form_popup.html
  111. 0 redpanal/{redpanal → }/social/templates/social/message_form_popup_response.html
  112. 0 redpanal/{redpanal → }/social/templates/social/message_teaser.html
  113. 0 redpanal/{redpanal → }/social/templates/social/message_with_content_form.html
  114. +1 −1 redpanal/{redpanal → }/social/templates/social/messages_for_object.html
  115. +1 −1 redpanal/{redpanal → }/social/templates/social/messages_list.html
  116. +1 −0 redpanal/social/templatetags/__init__.py
  117. +4 −5 redpanal/{redpanal/social/templatetags/social.py → social/templatetags/social_tags.py}
  118. +3 −3 redpanal/{redpanal → }/social/tests.py
  119. +20 −0 redpanal/social/urls.py
  120. 0 redpanal/{redpanal → }/social/views.py
  121. 0 redpanal/{redpanal/social/migrations → users}/__init__.py
  122. 0 redpanal/{redpanal → }/users/account_adapter.py
  123. 0 redpanal/{redpanal → }/users/admin.py
  124. +11 −0 redpanal/users/apps.py
  125. +1 −1 redpanal/{redpanal → }/users/forms.py
  126. +40 −0 redpanal/users/migrations/0001_initial.py
  127. 0 redpanal/{redpanal/users → users/migrations}/__init__.py
  128. +1 −1 redpanal/{redpanal → }/users/models.py
  129. 0 redpanal/{redpanal → }/users/search_indexes.py
  130. 0 redpanal/{redpanal → }/users/templates/search/indexes/users/userprofile_text.txt
  131. +1 −1 redpanal/{redpanal → }/users/templates/users/all_people.html
  132. +1 −1 redpanal/{redpanal → }/users/templates/users/user_activities.html
  133. +2 −2 redpanal/{redpanal → }/users/templates/users/user_interactions.html
  134. +2 −2 redpanal/{redpanal → }/users/templates/users/user_page.html
  135. +5 −5 redpanal/{redpanal → }/users/templates/users/user_prof.html
  136. 0 redpanal/{redpanal → }/users/templates/users/user_profile.html
  137. +1 −1 redpanal/{redpanal → }/users/templates/users/user_projects.html
  138. +1 −1 redpanal/{redpanal → }/users/templates/users/user_teaser.html
  139. +1 −1 redpanal/{redpanal → }/users/templates/users/user_tracks.html
  140. +1 −1 redpanal/{redpanal → }/users/templates/users/users_list.html
  141. +1 −1 redpanal/{redpanal → }/users/templates/users/users_list_full.html
  142. 0 redpanal/{redpanal → }/users/tests.py
  143. +18 −0 redpanal/users/urls.py
  144. +1 −1 redpanal/{redpanal → }/users/views.py
  145. +11 −12 requirements.txt
View
@@ -1,5 +1,8 @@
venv/
*.pyc
-*.sqlite3
+*.sqlite3*
uploaded_media/
**/whoosh_index/
+
+
+.idea/*
View
@@ -49,8 +49,7 @@ En una terminal podés seguir los siguientes pasos, para poder tener el sitio de
5) Entrar al directorio redpanal y ejecutar:
cd redpanal
- python manage.py syncdb --all
- python manage.py migrate --fake
+ python manage.py migrate --fake-initial
python manage.py runserver
Licencia
File renamed without changes.
View
@@ -0,0 +1,10 @@
+from __future__ import unicode_literals
+from django.apps import AppConfig
+
+class AudioConfig(AppConfig):
+
+ name = 'audio'
+
+ def ready(self):
+ from actstream import registry
+ registry.register(self.get_model('Audio'))
@@ -7,8 +7,8 @@
from crispy_forms.layout import Submit
from models import Audio
-from redpanal.project.models import Project
-from redpanal.core.forms import TagField
+from project.models import Project
+from core.forms import TagField
from redpanal.utils.helpers import get_file_extension
AUDIO_EXTENSIONS = ["mp3", "ogg", "oga", "flac"]
@@ -28,6 +28,7 @@ class Meta:
widgets = {
'license': forms.RadioSelect,
}
+ fields = '__all__'
def __init__(self, data=None, *args, **kwargs):
user = kwargs.pop('user')
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2016-11-28 22:43
+from __future__ import unicode_literals
+
+import autoslug.fields
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import redpanal.utils.models
+import taggit.managers
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('taggit', '0002_auto_20150616_2121'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Audio',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=100, verbose_name='name')),
+ ('slug', autoslug.fields.AutoSlugField(blank=True, editable=False, populate_from=b'name', unique=True)),
+ ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
+ ('description', models.TextField(verbose_name='description')),
+ ('audio', models.FileField(max_length=250, upload_to=b'uploads/audios/%Y_%m', verbose_name='audio')),
+ ('license', models.CharField(choices=[(b'CC-BY-SA-4.0', 'Creative Commons Attribution-ShareAlike 4.0 International')], default=b'CC-BY-SA-4.0', max_length=30, verbose_name='license')),
+ ('genre', models.CharField(choices=[(b'pop', 'pop'), (b'rock', 'rock'), (b'jazz', 'jazz'), (b'blues', 'blues'), (b'folklore', 'folklore'), (b'electronic', 'electronic'), (b'other', 'other')], max_length=30, verbose_name='genre')),
+ ('use_type', models.CharField(choices=[(b'track', 'track'), (b'loop', 'loop'), (b'song', 'song'), (b'sample', 'sample'), (b'other', 'other')], max_length=30, verbose_name='type')),
+ ('instrument', models.CharField(choices=[(b'voice', 'voice'), (b'guitar', 'guitar'), (b'electric guitar', 'electric guitar'), (b'bass', 'bass'), (b'drums', 'drums'), (b'saxophone', 'saxophone'), (b'piano', 'piano'), (b'sinthesizer', 'sinthesizer'), (b'electronic', 'electronic'), (b'strings', 'other strings'), (b'woodwind', 'woodwind'), (b'brass', 'brass'), (b'multiple', 'multiple'), (b'other', 'other')], max_length=30, verbose_name='instrument')),
+ ('channels', models.IntegerField(editable=False, null=True)),
+ ('blocksize', models.IntegerField(editable=False, null=True)),
+ ('samplerate', models.IntegerField(editable=False, null=True)),
+ ('totalframes', models.IntegerField(editable=False, null=True)),
+ ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='hashtags')),
+ ('user', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ 'ordering': ['-created_at'],
+ 'verbose_name': 'audio',
+ 'verbose_name_plural': 'audios',
+ },
+ bases=(models.Model, redpanal.utils.models.BaseModelMixin),
+ ),
+ ]
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2016-12-03 04:21
+from __future__ import unicode_literals
+import logging
+
+from django.db import migrations
+from audio.models import audio_processing
+
+def regenerate_audio_waveforms(apps, schema_editor):
+ Audio = apps.get_model("audio", "Audio")
+ for audio in Audio.objects.all():
+ try:
+ audio_processing(audio)
+ except IOError:
+ logging.warning('IOError with audio %r', audio.name)
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('audio', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RunPython(regenerate_audio_waveforms),
+ ]
@@ -15,8 +15,8 @@
from pydub import AudioSegment
from pydub.exceptions import CouldntDecodeError
-from ..utils.models import BaseModelMixin
-from redpanal.core import licenses
+from redpanal.utils.models import BaseModelMixin
+from core import licenses
from .waveform import Waveform
logger = logging.getLogger(__name__)
@@ -106,7 +106,7 @@ class Meta:
def audio_processing(audio):
try:
sound = AudioSegment.from_file(audio.audio.path)
- Waveform(sound, width=460, height=100, bar_count=460/8).save(audio.audio.path + '.big.png')
+ Waveform(sound, width=460, height=100, bar_count=460/8).save(audio.audio.path + '.png')
Waveform(sound, width=940, height=150, bar_count=940/8).save(audio.audio.path + '.big.png')
audio.channels = sound.channels
@@ -124,4 +124,3 @@ def audio_created_signal(sender, instance, created, **kwargs):
audio_processing(instance)
post_save.connect(audio_created_signal, sender=Audio)
-registry.register(Audio)
File renamed without changes.
@@ -1,7 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
-{% load url from future %}
-{% load social %}
+{% load social_tags %}
{% block title %}{{ object.name }}{% endblock %}
@@ -44,16 +43,16 @@
<h4>{% if object.use_type != "other" %}{{ object.get_use_type_display|capfirst }}{% else %}{% trans "File" %}{% endif %} {% trans "details" %}:</h4>
<div class="download"><a href="{{ object.audio.url }}"><i class="fa fa-download"></i> {% trans "Download" %}</a></div>
<p class="description">{{ object.description|capfirst }}</p>
- <p class="tags">{% include 'core/hashtags_block.html' %}</p>
+ <p class="tags">{% include 'core/hashtags_block.html' %}</p>
<p class="">{% trans "Channels" %}: <b>{{ object.channels }}</b> | {% trans "Samplerate" %}: <b>{{ object.samplerate }}</b> | {% trans "Genre" %}: <b>{{ object.get_genre_display|capfirst }}</b> | {% trans "Instrument" %}: <b>{{ object.get_instrument_display|capfirst }}</b></p>
<div class="license-block">
<img alt="Licencia Creative Commons" style="border-width:0" src="{{ object.get_license.icon }}" />
- <p><i>"{{ object.name|capfirst }}"</i>
+ <p><i>"{{ object.name|capfirst }}"</i>
{% trans "by" %} <a href="{{ object.user.get_absolute_url }}">{{ object.user.userprofile.realname|default:object.user.username|capfirst }}</a>
- {% blocktrans with license=object.get_license.name license_url=object.get_license.url %}is licensed under a <a rel="license" href="{{ license_url }}">{{ license }}</a>{% endblocktrans %}.
- {% trans "Published" %}: {{ object.created_at }}
- {% trans "by" %} {{ object.user.userprofile.realname|default:object.user.username|capfirst }}.
+ {% blocktrans with license=object.get_license.name license_url=object.get_license.url %}is licensed under a <a rel="license" href="{{ license_url }}">{{ license }}</a>{% endblocktrans %}.
+ {% trans "Published" %}: {{ object.created_at }}
+ {% trans "by" %} {{ object.user.userprofile.realname|default:object.user.username|capfirst }}.
<a href="{% url 'audio-detail' object.slug %}" name="{{object.slug}}">{% trans "Permanent link" %}</a>.</p>
</div>
</div>
@@ -1,6 +1,5 @@
{% extends "base.html" %}
{% load i18n crispy_forms_tags %}
-{% load url from future %}
{% block title %}{% if object %}{% trans "Edit" %}{% else %}{% trans "Upload" %}{% endif %}{% trans " Audio" %}{% endblock %}
@@ -1,5 +1,4 @@
{% load i18n %}
-{% load url from future %}
<div class="teaser-audio {{ mode|default:'small' }}">
{% if mode == "in-project-detail" %}
@@ -1,4 +1,4 @@
-{% load i18n endless %}
+{% load i18n el_pagination_tags %}
{% paginate 5,2 audios %}
{% for object in audios %}
{% include "audio/audio_teaser.html" %}
@@ -7,10 +7,10 @@
from django.core.urlresolvers import reverse
from models import Audio, GENRE_CHOICES, TYPE_CHOICES, INSTRUMENT_CHOICES
-from redpanal.project.models import Project
-from redpanal.core import licenses
+from project.models import Project
+from core import licenses
from forms import AudioForm
-from ..utils.test import InstanceTestMixin
+from redpanal.utils.test import InstanceTestMixin
TEST_DATA_PATH = os.path.join(os.path.dirname(__file__), "test_data")
View
@@ -0,0 +1,14 @@
+from django.conf.urls import include, url
+from django.conf import settings
+from django.conf.urls.static import static
+
+from . import views
+
+
+urlpatterns = [
+ url(r'^upload/$', views.audio_create_update, name='audio-create'),
+ #url(r'^list/$', "list", name='audio-list',
+ url(r'^(?P<slug>[\w-]+)/$', views.AudioDetailView.as_view(), name='audio-detail'),
+ url(r'^(?P<slug>[\w-]+)/edit/$', views.audio_create_update, name='audio-edit'),
+ url(r'^(?P<slug>[\w-]+)/delete/$', views.AudioDeleteView.as_view(), name='audio-delete'),
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
@@ -9,9 +9,9 @@
from django.views.generic import ListView, UpdateView, DetailView, CreateView, DeleteView
from models import Audio
-from redpanal.project.models import Project
+from project.models import Project
from forms import AudioForm
-from ..utils.views import LoginRequiredMixin, UserRequiredMixin
+from redpanal.utils.views import LoginRequiredMixin, UserRequiredMixin
@login_required
@@ -38,22 +38,22 @@ def _get_bar_image(self, size, fill):
end = Image.new('RGBA', (width, 2), fill)
draw = ImageDraw.Draw(end)
- draw.point([(0, 0), (3, 0)], fill='#c1c1c1')
- draw.point([(0, 1), (3, 1), (1, 0), (2, 0)], fill='#555555')
+ draw.point([(0, 0), (3, 0)], fill='#c1c1c150')
+ draw.point([(0, 1), (3, 1), (1, 0), (2, 0)], fill='#c1c1c150')
bar.paste(end, (0, 0))
bar.paste(end.rotate(180), (0, height - 2))
return bar
def _generate_waveform_image(self):
""" Returns the full waveform image """
- im = Image.new('RGB', (self.width, self.height), '#f5f5f5')
+ im = Image.new('RGBA', (self.width, self.height), '#ffffffff')
for index, value in enumerate(self.peaks, start=0):
column_space = self.width/self.bar_count
column = index * column_space
upper_endpoint = self.height/2 - value
value = value or 1
- im.paste(self._get_bar_image((4, value * 2), '#424242'),
+ im.paste(self._get_bar_image((4, value * 2), '#42424250'),
(column, upper_endpoint))
return im
@@ -64,8 +64,10 @@ def save(self, filename):
self._generate_waveform_image().save(imfile, 'PNG')
+
if __name__ == '__main__':
filename = sys.argv[1]
-
- waveform = Waveform(filename, width=940, height=150, bar_count=940/8)
- waveform.save()
+ from pydub import AudioSegment
+ sound = AudioSegment.from_file(filename)
+ waveform = Waveform(sound, width=940, height=150, bar_count=940/8)
+ waveform.save(sys.argv[2])
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,12 +1,11 @@
{% extends "two_rows.html" %}
{% load i18n avatar_tags %}
-{% load url from future %}
{% block title %} #{{ tag }}{% endblock %}
{% block extra_head %}
{{ block.super }}
- <script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
+ <script src="{{ STATIC_URL }}el-pagination/js/el-pagination.js"></script>
<script>
$(function (){
$.endlessPaginate({
@@ -1,4 +1,4 @@
-{% load i18n endless model_info %}
+{% load i18n el_pagination_tags model_info %}
{% paginate mixed_objects %}
{% for object in mixed_objects %}
{% if object|get_verbose_name == 'project' %}
@@ -5,27 +5,11 @@
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
-from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
-from ..audio.models import Audio
-from ..utils.test import InstanceTestMixin
-from forms import tags_to_editable_string, parse_tags, TagParseError
-
-class RedPanalTestSuiteRunner(DjangoTestSuiteRunner):
- """
- This TestSuiteRunner if fed without app labels runs all the redpanal's apps
- tests. Eg redpanal.core.collection, cyclope.apps.articles, etc.
- """
-
- project_name = "redpanal"
-
- def run_tests(self, test_labels, extra_tests=None, **kwargs):
- if not test_labels:
- test_labels = [c.split(".")[-1] for c in settings.INSTALLED_APPS if \
- self.project_name + "." in c]
- super(RedPanalTestSuiteRunner, self).run_tests(test_labels, extra_tests,
- **kwargs)
+from audio.models import Audio
+from redpanal.utils.test import InstanceTestMixin
+from .forms import tags_to_editable_string, parse_tags, TagParseError
class CoreTestCase(TestCase):
View
@@ -0,0 +1,9 @@
+from django.conf.urls import include, url
+
+from . import views
+
+urlpatterns = [
+ url(r'^$', views.index, name='index'),
+ url(r'^live/$', views.activity_all, name="activity-all"),
+ url(r'^live/iframe$', views.activity_all_iframe, name="activity-all-iframe"),
+]
@@ -6,10 +6,10 @@
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse_lazy
-from redpanal.audio.models import Audio
-from redpanal.project.models import Project
-from redpanal.social.models import Message
-from redpanal.users.models import UserProfile
+from audio.models import Audio
+from project.models import Project
+from social.models import Message
+from users.models import UserProfile
from taggit.models import Tag
from itertools import chain
import actstream.models
@@ -38,7 +38,7 @@ def index(request):
def hashtaged_list(request, slug, filters='all'):
tag = get_object_or_404(Tag, slug=slug)
- audios = Audio.objects.filter(tags__slug=slug).order_by('-created_at') if filters == 'all' or filters == 'audios' else []
+ audios = Audio.objects.filter(tags__slug=slug).order_by('-created_at') if filters == 'all' or filters == 'audios' else []
projects = Project.objects.filter(tags__slug=slug).order_by('-created_at') if filters == 'all' or filters == 'projects' else []
messages = Message.objects.filter(tags__slug=slug).order_by('-created_at') if filters == 'all' or filters == 'messages' else []
users = User.objects.filter(userprofile__tags__slug=slug) if filters == 'all' or filters == 'users' else []
@@ -65,7 +65,7 @@ def activity_all(request):
messages = Message.objects.all()
mixed_list = sorted(chain(audios, projects, messages), key=lambda instance: instance.created_at, reverse=True)
-
+
if request.is_ajax():
return render(request, "core/mixed_list.html", {
"mixed_objects": mixed_list,
@@ -87,8 +87,8 @@ def activity_all(request):
# for session in sessions:
# data = session.get_decoded()
# uid_list.append(data.get('_auth_user_id', None))
- # logged_users = users.filter(id__in=uid_list)
-
+ # logged_users = users.filter(id__in=uid_list)
+
return render(request, "all_activities.html", {
"mixed_objects": mixed_list,
"count_audios": count_audios,
@@ -99,7 +99,7 @@ def activity_all(request):
# "logged_users": logged_users,
"refresh_after_modal": 'refresh',
})
-
+
def activity_all_iframe(request):
audios = Audio.objects.all()
Oops, something went wrong.

0 comments on commit 66c9e75

Please sign in to comment.