def event_discussion(self): """Get discussion, comments and comment form for the event.""" self.object = self.get_object() discussion = self.object.discussion comments = discussion.comment_set.all().order_by('date') form = CommentForm() return {'discussion': discussion, 'comments': comments, 'form': form, }
def series_discussion(self): """Get discussion, comments and comment form for a series.""" discussion = self.object.discussion comments = discussion.comment_set.all().order_by('date') form = CommentForm() return {'discussion': discussion, 'comments': comments, 'form': form}
def get_context_data(self, **kwargs): """Add related info.""" context = super(OrganizationDetailView, self).get_context_data(**kwargs) form = NoteForm() notes = self.object.notes.order_by('-creation_date')[:4] # users = Organization.get_org_users(self.object) organizationcomments = Comment.objects.filter( discussion=self.object.discussion).order_by('date') organizationcommentform = CommentForm() context.update({ 'form': form, 'notes': notes, 'organizationcomments': organizationcomments, 'organizationcommentform': organizationcommentform, }) return context
def get_context_data(self, **kwargs): """Get network related info.""" context = super(NetworkDetailView, self).get_context_data(**kwargs) form = NoteForm() notes = self.object.notes.order_by('-creation_date')[:4] comments = self.object.discussion.comment_set.all().order_by('date') commentform = CommentForm() networkinvitationform = InviteToNetworkForm() context.update({ 'notes': notes, 'form': form, 'comments': comments, 'commentform': commentform, 'networkinvitationform': networkinvitationform, }) return context