2
2

I am disabling users from accepting answers, so naturally I want the unanswered questions tab to return all questions with 0 answers only. What's the best way (and how) to do this?

Path 1: Have all answers saved with accepted_answer == True

Path 2: Change how unanswered retrieves values from the database

I've been looking through the code for a while now but can't find out where to modify these things (I tried modifying the question and answer models themselves). Whoever does answer this, if you could tell me what files need modification it would be a great help.

asked 12 Dec '10, 03:03

dougvk's gravatar image

dougvk
81261934
accept rate: 33%

edited 12 Dec '10, 20:17

I've been wondering the exact same thing! Anyone who can help out with this?

(12 Dec '10, 20:16) jsr

Figured it out! Around line 95 of readers.py:

change

Question.objects.exclude(id__in=Question.objects.filter(children__Marked=True).distinct())

to

Question.objects.exclude(id__in=Question.objects.filter(children__gte=1).distinct()),

and to modify the tab name, i changed:

(_('hottest'), HottestQuestionsSort(_('most viewed'), _("most <strong>viewed</strong> questions in the last 24 hours"))),

and to have the questions sorted by views i changed:

class HottestQuestionsSort(pagination.SortBase):
    def apply(self, questions):
        q = questions.order_by('extra_count').reverse()
        return q
link

answered 13 Dec '10, 21:18

dougvk's gravatar image

dougvk
81261934
accept rate: 33%

Probably need to modify the view, not the model. Why not just remove the tab for unanswered from the template?

link

answered 12 Dec '10, 21:12

Justin%20Hamade's gravatar image

Justin Hamade
2243
accept rate: 17%

1

right, so Path 2 would be modifying the view. I'm just looking for someone who might understand how. The lines involved are confusing and widely spread out.

(12 Dec '10, 21:30) dougvk
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×47
×12

Asked: 12 Dec '10, 03:03

Seen: 534 times

Last updated: 13 Dec '10, 21:18

powered by OSQA