def inbox(request, template_name="user_messages/inbox.html"): threads = Thread.ordered(Thread.objects.inbox(request.user)) threads_unread = Thread.ordered(Thread.objects.unread(request.user)) return render_to_response(template_name, { "threads": threads, "unread": threads_unread }, context_instance=RequestContext(request))
def get_context_data(self, **kwargs): ctx = super(ProfileDetail, self).get_context_data(**kwargs) ctx['journal_entries'] = JournalEntry.objects.filter( author=self.object).order_by('-date') ctx['journal_entries_total'] = JournalEntry.objects.filter( author=self.object).count() ctx['journal_entries_published'] = JournalEntry.objects.filter( author=self.object, publish=True).count() ctx['favorites'] = Favorite.objects.filter( user=self.object).order_by('-created_on') ctx['icons'] = Icon.objects.filter(owner=self.object) ctx['threads_all'] = Thread.ordered(Thread.objects.inbox(self.object)) ctx['threads_unread'] = Thread.ordered( Thread.objects.unread(self.object)) ctx['action_list'] = actor_stream(ctx['profile']) # need to render the form ctx['form'] = UploadFileForm() notice_settings = [] for notice in NoticeType.objects.filter( label__in=PROFILE_NOTICE_SETTINGS): notice_settings.append( NoticeSetting.for_user(self.object, notice, NOTICE_MEDIA[0][0])) ctx['notice_settings'] = notice_settings return ctx
def inbox(request, template_name="user_messages/inbox.html"): threads = Thread.ordered(Thread.objects.inbox(request.user)) threads_unread = Thread.ordered(Thread.objects.unread(request.user)) return render_to_response(template_name, { "threads": threads, "unread": threads_unread }, context_instance=RequestContext(request))
def get_context_data(self, **kwargs): ctx = super(ProfileDetail, self).get_context_data(**kwargs) ctx['diary_entries'] = DiaryEntry.objects.filter(author=self.object).order_by('-date') ctx['favorites'] = Favorite.objects.filter(user=self.object).order_by('-created_on') ctx['threads_all'] = Thread.ordered(Thread.objects.inbox(self.request.user)) ctx['threads_unread'] = Thread.ordered(Thread.objects.unread(self.request.user)) ctx['action_list'] = actor_stream(ctx['profile']) return ctx
def get_context_data(self, **kwargs): ctx = super(ProfileDetail, self).get_context_data(**kwargs) ctx['diary_entries'] = DiaryEntry.objects.filter( author=self.object).order_by('-date') ctx['favorites'] = Favorite.objects.filter( user=self.object).order_by('-created_on') ctx['threads_all'] = Thread.ordered(Thread.objects.inbox(self.object)) ctx['threads_unread'] = Thread.ordered( Thread.objects.unread(self.object)) ctx['action_list'] = actor_stream(ctx['profile']) return ctx
def get_context_data(self, **kwargs): ctx = super(ProfileDetail, self).get_context_data(**kwargs) ctx['diary_entries'] = DiaryEntry.objects.filter(author=self.object).order_by('-date') ctx['favorites'] = Favorite.objects.filter(user=self.object).order_by('-created_on') ctx['threads_all'] = Thread.ordered(Thread.objects.inbox(self.object)) ctx['threads_unread'] = Thread.ordered(Thread.objects.unread(self.object)) ctx['action_list'] = actor_stream(ctx['profile']) # need to render the form ctx['form'] = UploadFileForm() notice_settings = [] for notice in NoticeType.objects.filter(label__in=PROFILE_NOTICE_SETTINGS): notice_settings.append(NoticeSetting.for_user(self.object, notice, NOTICE_MEDIA[0][0])) ctx['notice_settings'] = notice_settings return ctx
def test_ordered(self): t1 = Message.objects.new_message(self.brosner, [self.jtauber], "Subject", "A test message").thread t2 = Message.objects.new_message(self.brosner, [self.jtauber], "Another", "Another message").thread t3 = Message.objects.new_message(self.brosner, [self.jtauber], "Pwnt", "Haha I'm spamming your inbox").thread self.assertEqual(Thread.ordered([t2, t1, t3]), [t3, t2, t1])
def test_ordered(self): t1 = Message.objects.new_message(self.brosner, [self.jtauber], "Subject", "A test message").thread t2 = Message.objects.new_message(self.brosner, [self.jtauber], "Another", "Another message").thread t3 = Message.objects.new_message(self.brosner, [self.jtauber], "Pwnt", "Haha I'm spamming your inbox").thread self.assertEqual(Thread.ordered([t2, t1, t3]), [t3, t2, t1])