Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Lets take the data from VersionCount for select boxes #33

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 26, 2011
  1. @nigelbabu
This page is out of date. Refresh to see the latest.
View
1  apps/feedback/models.py
@@ -231,6 +231,7 @@ class VersionCount(ModelBase):
class Meta:
unique_together = (('product', 'version'))
db_table = 'version_count'
+ ordering = ['-version_int']
def update_version_int(sender, instance, **kwargs):
View
14 apps/search/forms.py
@@ -11,22 +11,22 @@
from input import (FIREFOX, MOBILE, PLATFORM_USAGE, LATEST_BETAS,
KNOWN_DEVICES, KNOWN_MANUFACTURERS)
from input.fields import DateInput, SearchInput
-
+from feedback.models import VersionCount
PROD_CHOICES = (
(FIREFOX.short, FIREFOX.pretty),
(MOBILE.short, MOBILE.pretty),
)
+VERSIONS = VersionCount.objects.filter(active=1)
+
VERSION_CHOICES = {
FIREFOX: ([('--', _lazy(u'-- all --', 'version_choice'))] +
- [(v, v) for v in (FIREFOX.extra_versions +
- FIREFOX.release_versions +
- FIREFOX.beta_versions)]),
+ [(v.version, v.version) for v in VERSIONS
+ if v.product == FIREFOX.id]),
MOBILE: ([('--', _lazy(u'-- all --', 'version_choice'))] +
- [(v, v) for v in (MOBILE.extra_versions +
- MOBILE.release_versions +
- MOBILE.beta_versions)]),
+ [(v.version, v.version) for v in VERSIONS
+ if v.product == MOBILE.id]),
}
SENTIMENT_CHOICES = [('', _lazy('-- all --', 'sentiment_choice')),
View
16 apps/search/views.py
@@ -13,12 +13,13 @@
from product_details.version_compare import Version
from tower import ugettext as _, ugettext_lazy as _lazy
-from input import (PRODUCTS, PRODUCT_IDS, FIREFOX, LATEST_BETAS,
+from input import (PRODUCTS, PRODUCT_IDS, FIREFOX, MOBILE, LATEST_BETAS,
OPINION_PRAISE, OPINION_ISSUE, OPINION_IDEA, OPINION_TYPES)
from input.decorators import cache_page, forward_mobile
from input.urlresolvers import reverse
+from feedback.models import VersionCount
from search.client import Client, SearchError
-from search.forms import ReporterSearchForm, PROD_CHOICES, VERSION_CHOICES
+from search.forms import ReporterSearchForm, PROD_CHOICES
log = commonware.log.getLogger('i.search')
@@ -195,6 +196,17 @@ def index(request):
of the page is "Search Results".
"""
+ VERSIONS = VersionCount.objects.filter(active=1)
+
+ VERSION_CHOICES = {
+ FIREFOX: ([('--', _lazy(u'-- all --', 'version_choice'))] +
+ [(v.version, v.version) for v in VERSIONS
+ if v.product == FIREFOX.id]),
+ MOBILE: ([('--', _lazy(u'-- all --', 'version_choice'))] +
+ [(v.version, v.version) for v in VERSIONS
+ if v.product == MOBILE.id]),
+ }
+
try:
meta = ('type', 'locale', 'platform', 'day_sentiment', 'manufacturer',
'device')
Something went wrong with that request. Please try again.