fnp
/
edumed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cybernaut mail footer
[edumed.git]
/
forum
/
views.py
diff --git
a/forum/views.py
b/forum/views.py
index
7eb412e
..
6750d99
100644
(file)
--- a/
forum/views.py
+++ b/
forum/views.py
@@
-1,3
+1,5
@@
+# -*- coding: utf-8 -*-
+from django.core.exceptions import ObjectDoesNotExist
import pybb.views
import pybb.forms
import pybb.views
import pybb.forms
@@
-18,7
+20,7
@@
class PostEditMixin(pybb.views.PostEditMixin):
pybb_post = self.object
pybb_topic = pybb_post.topic
pybb_post = self.object
pybb_topic = pybb_post.topic
- topic, topic_created = Topic.objects.get_or_create(pybb_topic
=
pybb_topic)
+ topic, topic_created = Topic.objects.get_or_create(pybb_topic
=
pybb_topic)
if pybb_post == pybb_topic.head:
topic.lesson = form.cleaned_data['lesson']
if pybb_post == pybb_topic.head:
topic.lesson = form.cleaned_data['lesson']
@@
-48,5
+50,9
@@
class EditPostView(PostEditMixin, pybb.views.EditPostView):
def get_form_kwargs(self):
kwargs = super(EditPostView, self).get_form_kwargs()
def get_form_kwargs(self):
kwargs = super(EditPostView, self).get_form_kwargs()
- kwargs['initial']['lesson'] = self.object.topic.edumed_topic.lesson
+ try:
+ lesson = self.object.topic.edumed_topic.lesson
+ except ObjectDoesNotExist:
+ lesson = None
+ kwargs['initial']['lesson'] = lesson
return kwargs
return kwargs