addons-server/apps/compat/forms.py

28 строки
865 B
Python
Исходник Обычный вид История

2011-07-13 03:38:42 +04:00
from django import forms
from django.conf import settings
from django.forms.widgets import RadioSelect
from tower import ugettext_lazy as _
import amo
appvers = [(amo.APP_IDS[d['app']], d['main']) for d in settings.COMPAT]
APPVER_CHOICES = [
('%s-%s' % (app.id, ver), '%s %s' % (unicode(app.pretty), ver))
for app, ver in appvers
]
class AppVerForm(forms.Form):
appver = forms.ChoiceField(choices=[('', _('All'))] + APPVER_CHOICES,
required=False)
2011-07-13 03:38:42 +04:00
class CompatForm(forms.Form):
appver = forms.ChoiceField(choices=APPVER_CHOICES, required=False)
2011-07-13 03:38:42 +04:00
type = forms.ChoiceField(choices=(('all', _('All Add-ons')),
('binary', _('Binary')),
('non-binary', _('Non-binary'))),
widget=RadioSelect, required=False)