X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..5d1dcf0b143ba6409b66ca13ddf31143d6e00a59:/src/social/forms.py?ds=sidebyside

diff --git a/src/social/forms.py b/src/social/forms.py
old mode 100755
new mode 100644
index 389185889..5c0973c19
--- a/src/social/forms.py
+++ b/src/social/forms.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
@@ -26,8 +25,9 @@ class ObjectSetsForm(forms.Form):
         self._obj = obj
         self._user = user
         data = kwargs.setdefault('data', {})
-        if 'tags' not in data and user.is_authenticated():
-            data['tags'] = ', '.join(t.name for t in obj.tags.filter(category='set', user=user).iterator() if t.name)
+        if 'tags' not in data and user.is_authenticated:
+            data['tags'] = ', '.join(
+                obj.tags.filter(category='set', user=user).exclude(name__in=(None, '')).values_list('name', flat=True))
         super(ObjectSetsForm, self).__init__(*args, **kwargs)
 
     def save(self, request):