# For instance, Pictures do not have 'genre' field.
continue
for tag_name in tag_names:
- lang = getattr(tag_name, 'lang', settings.LANGUAGE_CODE)
+ lang = getattr(tag_name, 'lang', None) or settings.LANGUAGE_CODE
tag_sort_key = tag_name
if category == 'author':
tag_sort_key = ' '.join((tag_name.last_name,) + tag_name.first_names)
from django.conf import settings
from django.core.cache import cache
from django.db import models
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
def __str__(self):
return self.key
+
+ def get_absolute_url(self):
+ return reverse('chunks_attachment', args=[self.key, self.attachment.name.rsplit('.', 1)[-1]])
--- /dev/null
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django.urls import path
+from . import views
+
+urlpatterns = [
+ path('attachment/<key>.<slug:ext>', views.attachment, name='chunks_attachment'),
+]
--- /dev/null
+from django.shortcuts import get_object_or_404
+from . import models
+from fnpdjango.utils.views import serve_file
+
+
+def attachment(request, key, ext):
+ att = get_object_or_404(models.Attachment, key=key)
+ return serve_file(att.attachment.url)
+
from django.contrib import admin
-from django.contrib.admin.filters import FieldListFilter
+from django.contrib.admin.filters import FieldListFilter, SimpleListFilter
from django.contrib import messages
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect
}
+class PayedListFilter(SimpleListFilter):
+ title = 'pobrane'
+ parameter_name = 'payed'
+ def lookups(self, request, model_admin):
+ return (
+ ('yes', 'tak'),
+ ('no', 'nie'),
+ )
+
+ def queryset(self, request, queryset):
+ if self.value() == 'yes':
+ return queryset.filter(payment__is_dd=True, payment__realised=True).distinct()
+ if self.value() == 'no':
+ return queryset.exclude(payment__is_dd=True, payment__realised=True).distinct()
+
+
+
class BankExportFeedbackLineInline(admin.TabularInline):
model = models.BankExportFeedbackLine
extra = 0
'is_consumer',
('fundraiser_commission', EmptyFieldListFilter),
('fundraiser_bonus', EmptyFieldListFilter),
+ PayedListFilter,
]
fieldsets = [
(None, {
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
+
+
+<script>
+ window.markerConfig = {
+ destination: '6177df91cd90df729b89c94d',
+ source: 'snippet'
+ };
+</script>
+
+<script>
+!function(e,r,a){if(!e.__Marker){e.__Marker={};var t=[],n={__cs:t};["show","hide","isVisible","capture","cancelCapture","unload","reload","isExtensionInstalled","setReporter","setCustomData","on","off"].forEach(function(e){n[e]=function(){var r=Array.prototype.slice.call(arguments);r.unshift(e),t.push(r)}}),e.Marker=n;var s=r.createElement("script");s.async=1,s.src="https://edge.marker.io/latest/shim.js";var i=r.getElementsByTagName("script")[0];i.parentNode.insertBefore(s,i)}}(window,document);
+</script>
+
path('towarzystwo/<path:path>', RedirectView.as_view(
url='/pomagam/%(path)s', permanent=False)),
+ path('chunks/', include('chunks.urls')),
+
# Admin panel
path('admin/catalogue/book/import', catalogue.views.import_book, name='import_book'),
path('admin/catalogue/picture/import', picture.views.import_picture, name='import_picture'),