fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests fix
[redakcja.git]
/
apps
/
catalogue
/
forms.py
diff --git
a/apps/catalogue/forms.py
b/apps/catalogue/forms.py
index
f6b2dc9
..
657a1b0
100644
(file)
--- a/
apps/catalogue/forms.py
+++ b/
apps/catalogue/forms.py
@@
-67,8
+67,8
@@
class ChunkForm(forms.ModelForm):
"""
user = forms.ModelChoiceField(queryset=
User.objects.annotate(count=Count('chunk')).
"""
user = forms.ModelChoiceField(queryset=
User.objects.annotate(count=Count('chunk')).
- order_by('-count', 'last_name', 'first_name'), required=False
)
-
+ order_by('-count', 'last_name', 'first_name'), required=False
,
+ label=_('Assigned to'))
class Meta:
model = Chunk
class Meta:
model = Chunk
@@
-104,9
+104,13
@@
class BookAppendForm(forms.Form):
Form for appending a book to another book.
It means moving all chunks from book A to book B and deleting A.
"""
Form for appending a book to another book.
It means moving all chunks from book A to book B and deleting A.
"""
-
append_to = forms.ModelChoiceField(queryset=Book.objects.all(),
append_to = forms.ModelChoiceField(queryset=Book.objects.all(),
- label=_("Append to"))
+ label=_("Append to"))
+
+ def __init__(self, book, *args, **kwargs):
+ ret = super(BookAppendForm, self).__init__(*args, **kwargs)
+ self.fields['append_to'].queryset = Book.objects.exclude(pk=book.pk)
+ return ret
class BookForm(forms.ModelForm):
class BookForm(forms.ModelForm):