fnp
/
edumed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow for authenticated non super users to create posts and topics
[edumed.git]
/
forum
/
views.py
diff --git
a/forum/views.py
b/forum/views.py
index
7eb412e
..
41b7eb8
100644
(file)
--- a/
forum/views.py
+++ b/
forum/views.py
@@
-1,6
+1,9
@@
+from django.core.exceptions import ObjectDoesNotExist
import pybb.views
import pybb.forms
import pybb.views
import pybb.forms
+from catalogue.models import Lesson
+
from .forms import PostForm
from .models import Topic
from .forms import PostForm
from .models import Topic
@@
-48,5
+51,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